author | Wolfgang Rosenauer <wr@rosenauer.org> |
Thu, 23 Feb 2012 11:18:26 +0100 | |
changeset 400 | 6a1811ef3174 |
parent 65 | 6a711ebb385d |
permissions | -rw-r--r-- |
24
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1 |
From: various contributors |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2 |
Subject: lockdown hooks for Gecko |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
4 |
diff --git a/extensions/cookie/nsCookiePermission.cpp b/extensions/cookie/nsCookiePermission.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
5 |
--- a/extensions/cookie/nsCookiePermission.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
6 |
+++ b/extensions/cookie/nsCookiePermission.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
7 |
@@ -1,10 +1,10 @@ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
8 |
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
9 |
-/* vim:ts=2:sw=2:et: */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
10 |
+/* vim: set ts=2 sw=2 et: */ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
11 |
/* ***** BEGIN LICENSE BLOCK ***** |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
12 |
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
13 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
14 |
* The contents of this file are subject to the Mozilla Public License Version |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
15 |
* 1.1 (the "License"); you may not use this file except in compliance with |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
16 |
* the License. You may obtain a copy of the License at |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
17 |
* http://www.mozilla.org/MPL/ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
18 |
* |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
19 |
@@ -81,16 +81,17 @@ static const PRBool kDefaultPolicy = PR_ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
20 |
static const char kCookiesLifetimePolicy[] = "network.cookie.lifetimePolicy"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
21 |
static const char kCookiesLifetimeDays[] = "network.cookie.lifetime.days"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
22 |
static const char kCookiesAlwaysAcceptSession[] = "network.cookie.alwaysAcceptSessionCookies"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
23 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
24 |
static const char kCookiesPrefsMigrated[] = "network.cookie.prefsMigrated"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
25 |
// obsolete pref names for migration |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
26 |
static const char kCookiesLifetimeEnabled[] = "network.cookie.lifetime.enabled"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
27 |
static const char kCookiesLifetimeBehavior[] = "network.cookie.lifetime.behavior"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
28 |
+static const char kCookiesHonorExceptions[] = "network.cookie.honorExceptions"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
29 |
static const char kCookiesAskPermission[] = "network.cookie.warnAboutCookies"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
30 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
31 |
static const char kPermissionType[] = "cookie"; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
32 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
33 |
#ifdef MOZ_MAIL_NEWS |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
34 |
// returns PR_TRUE if URI appears to be the URI of a mailnews protocol |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
35 |
// XXXbz this should be a protocol flag, not a scheme list, dammit! |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
36 |
static PRBool |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
37 |
@@ -120,16 +121,17 @@ nsCookiePermission::Init() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
38 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
39 |
// failure to access the pref service is non-fatal... |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
40 |
nsCOMPtr<nsIPrefBranch2> prefBranch = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
41 |
do_GetService(NS_PREFSERVICE_CONTRACTID); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
42 |
if (prefBranch) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
43 |
prefBranch->AddObserver(kCookiesLifetimePolicy, this, PR_FALSE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
44 |
prefBranch->AddObserver(kCookiesLifetimeDays, this, PR_FALSE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
45 |
prefBranch->AddObserver(kCookiesAlwaysAcceptSession, this, PR_FALSE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
46 |
+ prefBranch->AddObserver(kCookiesHonorExceptions, this, PR_FALSE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
47 |
PrefChanged(prefBranch, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
48 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
49 |
// migration code for original cookie prefs |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
50 |
PRBool migrated; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
51 |
rv = prefBranch->GetBoolPref(kCookiesPrefsMigrated, &migrated); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
52 |
if (NS_FAILED(rv) || !migrated) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
53 |
PRBool warnAboutCookies = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
54 |
prefBranch->GetBoolPref(kCookiesAskPermission, &warnAboutCookies); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
55 |
@@ -173,16 +175,20 @@ nsCookiePermission::PrefChanged(nsIPrefB |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
56 |
if (PREF_CHANGED(kCookiesLifetimeDays) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
57 |
NS_SUCCEEDED(aPrefBranch->GetIntPref(kCookiesLifetimeDays, &val))) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
58 |
// save cookie lifetime in seconds instead of days |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
59 |
mCookiesLifetimeSec = val * 24 * 60 * 60; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
60 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
61 |
if (PREF_CHANGED(kCookiesAlwaysAcceptSession) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
62 |
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesAlwaysAcceptSession, &val))) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
63 |
mCookiesAlwaysAcceptSession = val; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
64 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
65 |
+ if (PREF_CHANGED(kCookiesHonorExceptions) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
66 |
+ NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesHonorExceptions, &val))) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
67 |
+ mCookiesHonorExceptions = val; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
68 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
69 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
70 |
NS_IMETHODIMP |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
71 |
nsCookiePermission::SetAccess(nsIURI *aURI, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
72 |
nsCookieAccess aAccess) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
73 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
74 |
// |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
75 |
// NOTE: nsCookieAccess values conveniently match up with |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
76 |
@@ -202,16 +208,21 @@ nsCookiePermission::CanAccess(nsIURI |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
77 |
// it. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
78 |
if (IsFromMailNews(aURI)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
79 |
*aResult = ACCESS_DENY; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
80 |
return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
81 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
82 |
#endif // MOZ_MAIL_NEWS |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
83 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
84 |
// finally, check with permission manager... |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
85 |
+ if (!mCookiesHonorExceptions) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
86 |
+ *aResult = ACCESS_DEFAULT; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
87 |
+ return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
88 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
89 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
90 |
nsresult rv = mPermMgr->TestPermission(aURI, kPermissionType, (PRUint32 *) aResult); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
91 |
if (NS_SUCCEEDED(rv)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
92 |
switch (*aResult) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
93 |
// if we have one of the publicly-available values, just return it |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
94 |
case nsIPermissionManager::UNKNOWN_ACTION: // ACCESS_DEFAULT |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
95 |
case nsIPermissionManager::ALLOW_ACTION: // ACCESS_ALLOW |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
96 |
case nsIPermissionManager::DENY_ACTION: // ACCESS_DENY |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
97 |
break; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
98 |
diff --git a/extensions/cookie/nsCookiePermission.h b/extensions/cookie/nsCookiePermission.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
99 |
--- a/extensions/cookie/nsCookiePermission.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
100 |
+++ b/extensions/cookie/nsCookiePermission.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
101 |
@@ -54,30 +54,32 @@ public: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
102 |
NS_DECL_ISUPPORTS |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
103 |
NS_DECL_NSICOOKIEPERMISSION |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
104 |
NS_DECL_NSIOBSERVER |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
105 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
106 |
nsCookiePermission() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
107 |
: mCookiesLifetimeSec(LL_MAXINT) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
108 |
, mCookiesLifetimePolicy(0) // ACCEPT_NORMALLY |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
109 |
, mCookiesAlwaysAcceptSession(PR_FALSE) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
110 |
+ , mCookiesHonorExceptions(PR_TRUE) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
111 |
{} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
112 |
virtual ~nsCookiePermission() {} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
113 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
114 |
nsresult Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
115 |
void PrefChanged(nsIPrefBranch *, const char *); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
116 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
117 |
private: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
118 |
PRBool InPrivateBrowsing(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
119 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
120 |
nsCOMPtr<nsIPermissionManager> mPermMgr; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
121 |
nsCOMPtr<nsIPrivateBrowsingService> mPBService; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
122 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
123 |
PRInt64 mCookiesLifetimeSec; // lifetime limit specified in seconds |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
124 |
PRUint8 mCookiesLifetimePolicy; // pref for how long cookies are stored |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
125 |
PRPackedBool mCookiesAlwaysAcceptSession; // don't prompt for session cookies |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
126 |
+ PRPackedBool mCookiesHonorExceptions; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
127 |
}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
128 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
129 |
// {EF565D0A-AB9A-4A13-9160-0644CDFD859A} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
130 |
#define NS_COOKIEPERMISSION_CID \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
131 |
{0xEF565D0A, 0xAB9A, 0x4A13, {0x91, 0x60, 0x06, 0x44, 0xcd, 0xfd, 0x85, 0x9a }} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
132 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
133 |
#endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
134 |
diff --git a/extensions/permissions/nsContentBlocker.cpp b/extensions/permissions/nsContentBlocker.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
135 |
--- a/extensions/permissions/nsContentBlocker.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
136 |
+++ b/extensions/permissions/nsContentBlocker.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
137 |
@@ -71,32 +71,38 @@ static const char *kTypeString[NUMBER_OF |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
138 |
NS_IMPL_ISUPPORTS3(nsContentBlocker, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
139 |
nsIContentPolicy, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
140 |
nsIObserver, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
141 |
nsSupportsWeakReference) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
142 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
143 |
nsContentBlocker::nsContentBlocker() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
144 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
145 |
memset(mBehaviorPref, BEHAVIOR_ACCEPT, NUMBER_OF_TYPES); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
146 |
+ memset(mHonorExceptions, PR_TRUE, NUMBER_OF_TYPES); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
147 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
148 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
149 |
nsresult |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
150 |
nsContentBlocker::Init() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
151 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
152 |
nsresult rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
153 |
mPermissionManager = do_GetService(NS_PERMISSIONMANAGER_CONTRACTID, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
154 |
NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
155 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
156 |
nsCOMPtr<nsIPrefService> prefService = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
157 |
NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
158 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
159 |
nsCOMPtr<nsIPrefBranch> prefBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
160 |
rv = prefService->GetBranch("permissions.default.", getter_AddRefs(prefBranch)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
161 |
NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
162 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
163 |
+ nsCOMPtr<nsIPrefBranch> honorExceptionsPrefBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
164 |
+ rv = prefService->GetBranch("permissions.honorExceptions.", |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
165 |
+ getter_AddRefs(honorExceptionsPrefBranch)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
166 |
+ NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
167 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
168 |
// Migrate old image blocker pref |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
169 |
nsCOMPtr<nsIPrefBranch> oldPrefBranch; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
170 |
oldPrefBranch = do_QueryInterface(prefService); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
171 |
PRInt32 oldPref; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
172 |
rv = oldPrefBranch->GetIntPref("network.image.imageBehavior", &oldPref); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
173 |
if (NS_SUCCEEDED(rv) && oldPref) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
174 |
PRInt32 newPref; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
175 |
switch (oldPref) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
176 |
@@ -116,39 +122,49 @@ nsContentBlocker::Init() |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
177 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
178 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
179 |
// The branch is not a copy of the prefservice, but a new object, because |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
180 |
// it is a non-default branch. Adding obeservers to it will only work if |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
181 |
// we make sure that the object doesn't die. So, keep a reference to it. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
182 |
mPrefBranchInternal = do_QueryInterface(prefBranch, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
183 |
NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
184 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
185 |
+ mHonorExceptionsPrefBranchInternal = |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
186 |
+ do_QueryInterface(honorExceptionsPrefBranch, &rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
187 |
+ NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
188 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
189 |
rv = mPrefBranchInternal->AddObserver("", this, PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
190 |
- PrefChanged(prefBranch, nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
191 |
+ NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
192 |
+ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
193 |
+ rv = mHonorExceptionsPrefBranchInternal->AddObserver("", this, PR_TRUE); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
194 |
+ PrefChanged(nsnull); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
195 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
196 |
return rv; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
197 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
198 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
199 |
#undef LIMIT |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
200 |
#define LIMIT(x, low, high, default) ((x) >= (low) && (x) <= (high) ? (x) : (default)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
201 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
202 |
void |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
203 |
-nsContentBlocker::PrefChanged(nsIPrefBranch *aPrefBranch, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
204 |
- const char *aPref) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
205 |
+nsContentBlocker::PrefChanged(const char *aPref) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
206 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
207 |
- PRInt32 val; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
208 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
209 |
-#define PREF_CHANGED(_P) (!aPref || !strcmp(aPref, _P)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
210 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
211 |
- for(PRUint32 i = 0; i < NUMBER_OF_TYPES; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
212 |
- if (PREF_CHANGED(kTypeString[i]) && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
213 |
- NS_SUCCEEDED(aPrefBranch->GetIntPref(kTypeString[i], &val))) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
214 |
- mBehaviorPref[i] = LIMIT(val, 1, 3, 1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
215 |
+ for (PRUint32 i = 0; i < NUMBER_OF_TYPES; ++i) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
216 |
+ if (!aPref || !strcmp(kTypeString[i], aPref)) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
217 |
+ PRInt32 val; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
218 |
+ PRBool b; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
219 |
+ if (mPrefBranchInternal && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
220 |
+ NS_SUCCEEDED(mPrefBranchInternal->GetIntPref(kTypeString[i], &val))) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
221 |
+ mBehaviorPref[i] = LIMIT(val, 1, 3, 1); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
222 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
223 |
+ if (mHonorExceptionsPrefBranchInternal && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
224 |
+ NS_SUCCEEDED(mHonorExceptionsPrefBranchInternal->GetBoolPref(kTypeString[i], &b))) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
225 |
+ mHonorExceptions[i] = b; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
226 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
227 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
228 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
229 |
- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
230 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
231 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
232 |
// nsIContentPolicy Implementation |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
233 |
NS_IMETHODIMP |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
234 |
nsContentBlocker::ShouldLoad(PRUint32 aContentType, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
235 |
nsIURI *aContentLocation, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
236 |
nsIURI *aRequestingLocation, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
237 |
nsISupports *aRequestingContext, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
238 |
@@ -264,21 +280,23 @@ nsContentBlocker::TestPermission(nsIURI |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
239 |
// This default will also get used if there is an unknown value in the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
240 |
// permission list, or if the permission manager returns unknown values. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
241 |
*aPermission = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
242 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
243 |
// check the permission list first; if we find an entry, it overrides |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
244 |
// default prefs. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
245 |
// Don't forget the aContentType ranges from 1..8, while the |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
246 |
// array is indexed 0..7 |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
247 |
- PRUint32 permission; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
248 |
- nsresult rv = mPermissionManager->TestPermission(aCurrentURI, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
249 |
- kTypeString[aContentType - 1], |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
250 |
- &permission); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
251 |
- NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
252 |
+ PRUint32 permission = 0; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
253 |
+ if (mHonorExceptions[aContentType - 1]) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
254 |
+ nsresult rv = mPermissionManager->TestPermission(aCurrentURI, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
255 |
+ kTypeString[aContentType - 1], |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
256 |
+ &permission); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
257 |
+ NS_ENSURE_SUCCESS(rv, rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
258 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
259 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
260 |
// If there is nothing on the list, use the default. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
261 |
if (!permission) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
262 |
permission = mBehaviorPref[aContentType - 1]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
263 |
*aFromPrefs = PR_TRUE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
264 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
265 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
266 |
// Use the fact that the nsIPermissionManager values map to |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
267 |
@@ -294,17 +312,17 @@ nsContentBlocker::TestPermission(nsIURI |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
268 |
case BEHAVIOR_NOFOREIGN: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
269 |
// Third party checking |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
270 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
271 |
// Need a requesting uri for third party checks to work. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
272 |
if (!aFirstURI) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
273 |
return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
274 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
275 |
PRBool trustedSource = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
276 |
- rv = aFirstURI->SchemeIs("chrome", &trustedSource); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
277 |
+ nsresult rv = aFirstURI->SchemeIs("chrome", &trustedSource); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
278 |
NS_ENSURE_SUCCESS(rv,rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
279 |
if (!trustedSource) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
280 |
rv = aFirstURI->SchemeIs("resource", &trustedSource); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
281 |
NS_ENSURE_SUCCESS(rv,rv); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
282 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
283 |
if (trustedSource) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
284 |
return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
285 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
286 |
@@ -360,12 +378,11 @@ nsContentBlocker::TestPermission(nsIURI |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
287 |
NS_IMETHODIMP |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
288 |
nsContentBlocker::Observe(nsISupports *aSubject, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
289 |
const char *aTopic, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
290 |
const PRUnichar *aData) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
291 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
292 |
NS_ASSERTION(!strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic), |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
293 |
"unexpected topic - we only deal with pref changes!"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
294 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
295 |
- if (mPrefBranchInternal) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
296 |
- PrefChanged(mPrefBranchInternal, NS_LossyConvertUTF16toASCII(aData).get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
297 |
+ PrefChanged(NS_LossyConvertUTF16toASCII(aData).get()); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
298 |
return NS_OK; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
299 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
300 |
diff --git a/extensions/permissions/nsContentBlocker.h b/extensions/permissions/nsContentBlocker.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
301 |
--- a/extensions/permissions/nsContentBlocker.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
302 |
+++ b/extensions/permissions/nsContentBlocker.h |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
303 |
@@ -61,26 +61,28 @@ public: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
304 |
NS_DECL_NSIOBSERVER |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
305 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
306 |
nsContentBlocker(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
307 |
nsresult Init(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
308 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
309 |
private: |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
310 |
~nsContentBlocker() {} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
311 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
312 |
- void PrefChanged(nsIPrefBranch *, const char *); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
313 |
+ void PrefChanged(const char *); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
314 |
nsresult TestPermission(nsIURI *aCurrentURI, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
315 |
nsIURI *aFirstURI, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
316 |
PRInt32 aContentType, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
317 |
PRBool *aPermission, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
318 |
PRBool *aFromPrefs); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
319 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
320 |
nsCOMPtr<nsIPermissionManager> mPermissionManager; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
321 |
nsCOMPtr<nsIPrefBranch2> mPrefBranchInternal; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
322 |
+ nsCOMPtr<nsIPrefBranch2> mHonorExceptionsPrefBranchInternal; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
323 |
PRUint8 mBehaviorPref[NUMBER_OF_TYPES]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
324 |
+ PRPackedBool mHonorExceptions[NUMBER_OF_TYPES]; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
325 |
}; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
326 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
327 |
#define NS_CONTENTBLOCKER_CID \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
328 |
{ 0x4ca6b67b, 0x5cc7, 0x4e71, \ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
329 |
{ 0xa9, 0x8a, 0x97, 0xaf, 0x1c, 0x13, 0x48, 0x62 } } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
330 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
331 |
#define NS_CONTENTBLOCKER_CONTRACTID "@mozilla.org/permissions/contentblocker;1" |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
332 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
333 |
diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
334 |
--- a/modules/libpref/src/init/all.js |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
335 |
+++ b/modules/libpref/src/init/all.js |
65
6a711ebb385d
Update to snapshot 20100410
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
336 |
@@ -853,16 +853,17 @@ pref("network.automatic-ntlm-auth.truste |
24
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
337 |
// response to a NTLM challenge. By default, this is disabled since servers |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
338 |
// should almost never need the LM hash, and the LM hash is what makes NTLM |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
339 |
// authentication less secure. See bug 250691 for further details. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
340 |
// NOTE: automatic-ntlm-auth which leverages the OS-provided NTLM |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
341 |
// implementation will not be affected by this preference. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
342 |
pref("network.ntlm.send-lm-response", false); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
343 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
344 |
pref("permissions.default.image", 1); // 1-Accept, 2-Deny, 3-dontAcceptForeign |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
345 |
+pref("permissions.honorExceptions.image", true); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
346 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
347 |
pref("network.proxy.type", 5); |
65
6a711ebb385d
Update to snapshot 20100410
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
348 |
|
6a711ebb385d
Update to snapshot 20100410
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
349 |
pref("network.proxy.ftp", ""); |
6a711ebb385d
Update to snapshot 20100410
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
350 |
pref("network.proxy.ftp_port", 0); |
6a711ebb385d
Update to snapshot 20100410
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
351 |
pref("network.proxy.gopher", ""); |
6a711ebb385d
Update to snapshot 20100410
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
352 |
pref("network.proxy.gopher_port", 0); |
6a711ebb385d
Update to snapshot 20100410
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
353 |
pref("network.proxy.http", ""); |
6a711ebb385d
Update to snapshot 20100410
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
24
diff
changeset
|
354 |
@@ -872,16 +873,17 @@ pref("network.proxy.ssl_port", |
24
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
355 |
pref("network.proxy.socks", ""); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
356 |
pref("network.proxy.socks_port", 0); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
357 |
pref("network.proxy.socks_version", 5); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
358 |
pref("network.proxy.socks_remote_dns", false); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
359 |
pref("network.proxy.no_proxies_on", "localhost, 127.0.0.1"); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
360 |
pref("network.proxy.failover_timeout", 1800); // 30 minutes |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
361 |
pref("network.online", true); //online/offline |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
362 |
pref("network.cookie.cookieBehavior", 0); // 0-Accept, 1-dontAcceptForeign, 2-dontUse |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
363 |
+pref("network.cookie.honorExceptions", true); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
364 |
pref("network.cookie.lifetimePolicy", 0); // accept normally, 1-askBeforeAccepting, 2-acceptForSession,3-acceptForNDays |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
365 |
pref("network.cookie.alwaysAcceptSessionCookies", false); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
366 |
pref("network.cookie.prefsMigrated", false); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
367 |
pref("network.cookie.lifetime.days", 90); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
368 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
369 |
// The PAC file to load. Ignored unless network.proxy.type is 2. |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
370 |
pref("network.proxy.autoconfig_url", ""); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
371 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
372 |
diff --git a/xpinstall/src/nsXPInstallManager.cpp b/xpinstall/src/nsXPInstallManager.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
373 |
--- a/xpinstall/src/nsXPInstallManager.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
374 |
+++ b/xpinstall/src/nsXPInstallManager.cpp |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
375 |
@@ -300,36 +300,46 @@ nsXPInstallManager::InitManagerInternal( |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
376 |
packageList[j++] = item->GetSafeURLString(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
377 |
packageList[j++] = item->mIconURL.get(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
378 |
packageList[j++] = item->mCertName.get(); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
379 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
380 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
381 |
//----------------------------------------------------- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
382 |
// Get permission to install |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
383 |
//----------------------------------------------------- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
384 |
+ nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID)); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
385 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
386 |
#ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
387 |
if ( mChromeType == CHROME_SKIN ) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
388 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
389 |
// We may want to enable the simple installation UI once |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
390 |
// bug 343037 is fixed |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
391 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
392 |
// skins get a simpler/friendlier dialog |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
393 |
// XXX currently not embeddable |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
394 |
- OKtoInstall = ConfirmChromeInstall( mParentWindow, packageList ); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
395 |
+ PRBool themesDisabled = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
396 |
+ if (pref) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
397 |
+ pref->GetBoolPref("config.lockdown.disable_themes", &themesDisabled); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
398 |
+ OKtoInstall = !themesDisabled && |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
399 |
+ ConfirmChromeInstall( mParentWindow, packageList ); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
400 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
401 |
else |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
402 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
403 |
#endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
404 |
+ PRBool extensionsDisabled = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
405 |
+ if (pref) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
406 |
+ pref->GetBoolPref("config.lockdown.disable_extensions", &extensionsDisabled); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
407 |
+ if (!extensionsDisabled) { |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
408 |
rv = dlgSvc->ConfirmInstall( mParentWindow, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
409 |
packageList, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
410 |
numStrings, |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
411 |
&OKtoInstall ); |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
412 |
if (NS_FAILED(rv)) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
413 |
OKtoInstall = PR_FALSE; |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
414 |
+ } |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
415 |
#ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
416 |
} |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
417 |
#endif |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
418 |
|
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
419 |
if (OKtoInstall) |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
420 |
{ |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
421 |
//----------------------------------------------------- |
ca988be0905b
Update and integrate new lockdown patches.
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
422 |
// Open the progress dialog |