author | Wolfgang Rosenauer <wr@rosenauer.org> |
Sun, 29 Nov 2009 19:46:53 +0100 | |
changeset 5 | 17b1dd932700 |
parent 4 | 523b1d92948c |
permissions | -rw-r--r-- |
4
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
1 |
From: Robert O'Callahan |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
2 |
Subject: Lockdown feature for Gecko |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
3 |
References: |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
4 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
5 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
6 |
Index: extensions/cookie/nsCookiePermission.cpp |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
7 |
=================================================================== |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
8 |
--- extensions/cookie/nsCookiePermission.cpp.orig |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
9 |
+++ extensions/cookie/nsCookiePermission.cpp |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
10 |
@@ -86,6 +86,7 @@ static const char kCookiesPrefsMigrated[ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
11 |
// obsolete pref names for migration |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
12 |
static const char kCookiesLifetimeEnabled[] = "network.cookie.lifetime.enabled"; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
13 |
static const char kCookiesLifetimeBehavior[] = "network.cookie.lifetime.behavior"; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
14 |
+static const char kCookiesHonorExceptions[] = "network.cookie.honorExceptions"; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
15 |
static const char kCookiesAskPermission[] = "network.cookie.warnAboutCookies"; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
16 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
17 |
static const char kPermissionType[] = "cookie"; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
18 |
@@ -125,6 +126,7 @@ nsCookiePermission::Init() |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
19 |
prefBranch->AddObserver(kCookiesLifetimePolicy, this, PR_FALSE); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
20 |
prefBranch->AddObserver(kCookiesLifetimeDays, this, PR_FALSE); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
21 |
prefBranch->AddObserver(kCookiesAlwaysAcceptSession, this, PR_FALSE); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
22 |
+ prefBranch->AddObserver(kCookiesHonorExceptions, this, PR_FALSE); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
23 |
#ifdef MOZ_MAIL_NEWS |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
24 |
prefBranch->AddObserver(kCookiesDisabledForMailNews, this, PR_FALSE); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
25 |
#endif |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
26 |
@@ -182,6 +184,10 @@ nsCookiePermission::PrefChanged(nsIPrefB |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
27 |
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesAlwaysAcceptSession, &val))) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
28 |
mCookiesAlwaysAcceptSession = val; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
29 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
30 |
+ if (PREF_CHANGED(kCookiesHonorExceptions) && |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
31 |
+ NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesHonorExceptions, &val))) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
32 |
+ mCookiesHonorExceptions = val; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
33 |
+ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
34 |
#ifdef MOZ_MAIL_NEWS |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
35 |
if (PREF_CHANGED(kCookiesDisabledForMailNews) && |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
36 |
NS_SUCCEEDED(aPrefBranch->GetBoolPref(kCookiesDisabledForMailNews, &val))) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
37 |
@@ -232,6 +238,11 @@ nsCookiePermission::CanAccess(nsIURI |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
38 |
#endif // MOZ_MAIL_NEWS |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
39 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
40 |
// finally, check with permission manager... |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
41 |
+ if (!mCookiesHonorExceptions) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
42 |
+ *aResult = ACCESS_DEFAULT; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
43 |
+ return NS_OK; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
44 |
+ } |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
45 |
+ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
46 |
nsresult rv = mPermMgr->TestPermission(aURI, kPermissionType, (PRUint32 *) aResult); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
47 |
if (NS_SUCCEEDED(rv)) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
48 |
switch (*aResult) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
49 |
Index: extensions/cookie/nsCookiePermission.h |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
50 |
=================================================================== |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
51 |
--- extensions/cookie/nsCookiePermission.h.orig |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
52 |
+++ extensions/cookie/nsCookiePermission.h |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
53 |
@@ -61,6 +61,7 @@ public: |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
54 |
#ifdef MOZ_MAIL_NEWS |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
55 |
, mCookiesDisabledForMailNews(PR_TRUE) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
56 |
#endif |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
57 |
+ , mCookiesHonorExceptions(PR_TRUE) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
58 |
{} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
59 |
virtual ~nsCookiePermission() {} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
60 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
61 |
@@ -76,7 +77,7 @@ private: |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
62 |
#ifdef MOZ_MAIL_NEWS |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
63 |
PRPackedBool mCookiesDisabledForMailNews; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
64 |
#endif |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
65 |
- |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
66 |
+ PRPackedBool mCookiesHonorExceptions; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
67 |
}; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
68 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
69 |
// {EF565D0A-AB9A-4A13-9160-0644CDFD859A} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
70 |
Index: extensions/permissions/nsContentBlocker.cpp |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
71 |
=================================================================== |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
72 |
--- extensions/permissions/nsContentBlocker.cpp.orig |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
73 |
+++ extensions/permissions/nsContentBlocker.cpp |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
74 |
@@ -76,6 +76,7 @@ NS_IMPL_ISUPPORTS3(nsContentBlocker, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
75 |
nsContentBlocker::nsContentBlocker() |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
76 |
{ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
77 |
memset(mBehaviorPref, BEHAVIOR_ACCEPT, NUMBER_OF_TYPES); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
78 |
+ memset(mHonorExceptions, PR_TRUE, NUMBER_OF_TYPES); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
79 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
80 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
81 |
nsresult |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
82 |
@@ -92,6 +93,11 @@ nsContentBlocker::Init() |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
83 |
rv = prefService->GetBranch("permissions.default.", getter_AddRefs(prefBranch)); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
84 |
NS_ENSURE_SUCCESS(rv, rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
85 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
86 |
+ nsCOMPtr<nsIPrefBranch> honorExceptionsPrefBranch; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
87 |
+ rv = prefService->GetBranch("permissions.honorExceptions.", |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
88 |
+ getter_AddRefs(honorExceptionsPrefBranch)); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
89 |
+ NS_ENSURE_SUCCESS(rv, rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
90 |
+ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
91 |
// Migrate old image blocker pref |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
92 |
nsCOMPtr<nsIPrefBranch> oldPrefBranch; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
93 |
oldPrefBranch = do_QueryInterface(prefService); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
94 |
@@ -121,8 +127,15 @@ nsContentBlocker::Init() |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
95 |
mPrefBranchInternal = do_QueryInterface(prefBranch, &rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
96 |
NS_ENSURE_SUCCESS(rv, rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
97 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
98 |
+ mHonorExceptionsPrefBranchInternal = |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
99 |
+ do_QueryInterface(honorExceptionsPrefBranch, &rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
100 |
+ NS_ENSURE_SUCCESS(rv, rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
101 |
+ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
102 |
rv = mPrefBranchInternal->AddObserver("", this, PR_TRUE); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
103 |
- PrefChanged(prefBranch, nsnull); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
104 |
+ NS_ENSURE_SUCCESS(rv, rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
105 |
+ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
106 |
+ rv = mHonorExceptionsPrefBranchInternal->AddObserver("", this, PR_TRUE); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
107 |
+ PrefChanged(nsnull); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
108 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
109 |
return rv; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
110 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
111 |
@@ -131,19 +144,22 @@ nsContentBlocker::Init() |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
112 |
#define LIMIT(x, low, high, default) ((x) >= (low) && (x) <= (high) ? (x) : (default)) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
113 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
114 |
void |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
115 |
-nsContentBlocker::PrefChanged(nsIPrefBranch *aPrefBranch, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
116 |
- const char *aPref) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
117 |
+nsContentBlocker::PrefChanged(const char *aPref) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
118 |
{ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
119 |
- PRInt32 val; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
120 |
- |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
121 |
-#define PREF_CHANGED(_P) (!aPref || !strcmp(aPref, _P)) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
122 |
- |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
123 |
- for(PRUint32 i = 0; i < NUMBER_OF_TYPES; ++i) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
124 |
- if (PREF_CHANGED(kTypeString[i]) && |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
125 |
- NS_SUCCEEDED(aPrefBranch->GetIntPref(kTypeString[i], &val))) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
126 |
- mBehaviorPref[i] = LIMIT(val, 1, 3, 1); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
127 |
+ for (PRUint32 i = 0; i < NUMBER_OF_TYPES; ++i) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
128 |
+ if (!aPref || !strcmp(kTypeString[i], aPref)) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
129 |
+ PRInt32 val; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
130 |
+ PRBool b; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
131 |
+ if (mPrefBranchInternal && |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
132 |
+ NS_SUCCEEDED(mPrefBranchInternal->GetIntPref(kTypeString[i], &val))) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
133 |
+ mBehaviorPref[i] = LIMIT(val, 1, 3, 1); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
134 |
+ } |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
135 |
+ if (mHonorExceptionsPrefBranchInternal && |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
136 |
+ NS_SUCCEEDED(mHonorExceptionsPrefBranchInternal->GetBoolPref(kTypeString[i], &b))) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
137 |
+ mHonorExceptions[i] = b; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
138 |
+ } |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
139 |
+ } |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
140 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
141 |
- |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
142 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
143 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
144 |
// nsIContentPolicy Implementation |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
145 |
@@ -268,11 +284,13 @@ nsContentBlocker::TestPermission(nsIURI |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
146 |
// default prefs. |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
147 |
// Don't forget the aContentType ranges from 1..8, while the |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
148 |
// array is indexed 0..7 |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
149 |
- PRUint32 permission; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
150 |
- nsresult rv = mPermissionManager->TestPermission(aCurrentURI, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
151 |
- kTypeString[aContentType - 1], |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
152 |
- &permission); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
153 |
- NS_ENSURE_SUCCESS(rv, rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
154 |
+ PRUint32 permission = 0; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
155 |
+ if (mHonorExceptions[aContentType - 1]) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
156 |
+ nsresult rv = mPermissionManager->TestPermission(aCurrentURI, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
157 |
+ kTypeString[aContentType - 1], |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
158 |
+ &permission); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
159 |
+ NS_ENSURE_SUCCESS(rv, rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
160 |
+ } |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
161 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
162 |
// If there is nothing on the list, use the default. |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
163 |
if (!permission) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
164 |
@@ -298,7 +316,7 @@ nsContentBlocker::TestPermission(nsIURI |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
165 |
return NS_OK; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
166 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
167 |
PRBool trustedSource = PR_FALSE; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
168 |
- rv = aFirstURI->SchemeIs("chrome", &trustedSource); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
169 |
+ nsresult rv = aFirstURI->SchemeIs("chrome", &trustedSource); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
170 |
NS_ENSURE_SUCCESS(rv,rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
171 |
if (!trustedSource) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
172 |
rv = aFirstURI->SchemeIs("resource", &trustedSource); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
173 |
@@ -363,8 +381,6 @@ nsContentBlocker::Observe(nsISupports |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
174 |
{ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
175 |
NS_ASSERTION(!strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic), |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
176 |
"unexpected topic - we only deal with pref changes!"); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
177 |
- |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
178 |
- if (mPrefBranchInternal) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
179 |
- PrefChanged(mPrefBranchInternal, NS_LossyConvertUTF16toASCII(aData).get()); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
180 |
+ PrefChanged(NS_LossyConvertUTF16toASCII(aData).get()); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
181 |
return NS_OK; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
182 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
183 |
Index: extensions/permissions/nsContentBlocker.h |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
184 |
=================================================================== |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
185 |
--- extensions/permissions/nsContentBlocker.h.orig |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
186 |
+++ extensions/permissions/nsContentBlocker.h |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
187 |
@@ -66,7 +66,7 @@ public: |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
188 |
private: |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
189 |
~nsContentBlocker() {} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
190 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
191 |
- void PrefChanged(nsIPrefBranch *, const char *); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
192 |
+ void PrefChanged(const char *); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
193 |
nsresult TestPermission(nsIURI *aCurrentURI, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
194 |
nsIURI *aFirstURI, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
195 |
PRInt32 aContentType, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
196 |
@@ -75,7 +75,9 @@ private: |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
197 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
198 |
nsCOMPtr<nsIPermissionManager> mPermissionManager; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
199 |
nsCOMPtr<nsIPrefBranch2> mPrefBranchInternal; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
200 |
+ nsCOMPtr<nsIPrefBranch2> mHonorExceptionsPrefBranchInternal; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
201 |
PRUint8 mBehaviorPref[NUMBER_OF_TYPES]; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
202 |
+ PRPackedBool mHonorExceptions[NUMBER_OF_TYPES]; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
203 |
}; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
204 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
205 |
#define NS_CONTENTBLOCKER_CID \ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
206 |
Index: modules/libpref/src/init/all.js |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
207 |
=================================================================== |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
208 |
--- modules/libpref/src/init/all.js.orig |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
209 |
+++ modules/libpref/src/init/all.js |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
210 |
@@ -798,6 +798,7 @@ pref("network.automatic-ntlm-auth.truste |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
211 |
pref("network.ntlm.send-lm-response", false); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
212 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
213 |
pref("permissions.default.image", 1); // 1-Accept, 2-Deny, 3-dontAcceptForeign |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
214 |
+pref("permissions.honorExceptions.image", true); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
215 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
216 |
#ifndef XP_MACOSX |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
217 |
#ifdef XP_UNIX |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
218 |
@@ -825,6 +826,7 @@ pref("network.proxy.no_proxies_on", |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
219 |
pref("network.proxy.failover_timeout", 1800); // 30 minutes |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
220 |
pref("network.online", true); //online/offline |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
221 |
pref("network.cookie.cookieBehavior", 0); // 0-Accept, 1-dontAcceptForeign, 2-dontUse |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
222 |
+pref("network.cookie.honorExceptions", true); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
223 |
pref("network.cookie.disableCookieForMailNews", true); // disable all cookies for mail |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
224 |
pref("network.cookie.lifetimePolicy", 0); // accept normally, 1-askBeforeAccepting, 2-acceptForSession,3-acceptForNDays |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
225 |
pref("network.cookie.alwaysAcceptSessionCookies", false); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
226 |
Index: widget/src/gtk2/nsWindow.cpp |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
227 |
=================================================================== |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
228 |
--- widget/src/gtk2/nsWindow.cpp.orig |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
229 |
+++ widget/src/gtk2/nsWindow.cpp |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
230 |
@@ -81,6 +81,7 @@ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
231 |
#include "nsIServiceManager.h" |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
232 |
#include "nsIStringBundle.h" |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
233 |
#include "nsGfxCIID.h" |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
234 |
+#include "nsIPrefService.h" |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
235 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
236 |
#ifdef ACCESSIBILITY |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
237 |
#include "nsIAccessibilityService.h" |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
238 |
@@ -91,7 +92,6 @@ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
239 |
static PRBool sAccessibilityChecked = PR_FALSE; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
240 |
/* static */ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
241 |
PRBool nsWindow::sAccessibilityEnabled = PR_FALSE; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
242 |
-static const char sSysPrefService [] = "@mozilla.org/system-preference-service;1"; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
243 |
static const char sAccEnv [] = "GNOME_ACCESSIBILITY"; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
244 |
static const char sAccessibilityKey [] = "config.use_system_prefs.accessibility"; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
245 |
#endif |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
246 |
@@ -3992,18 +3992,18 @@ nsWindow::NativeCreate(nsIWidget |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
247 |
sAccessibilityEnabled = atoi(envValue) != 0; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
248 |
LOG(("Accessibility Env %s=%s\n", sAccEnv, envValue)); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
249 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
250 |
- //check gconf-2 setting |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
251 |
+ //check preference setting |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
252 |
else { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
253 |
- nsCOMPtr<nsIPrefBranch> sysPrefService = |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
254 |
- do_GetService(sSysPrefService, &rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
255 |
- if (NS_SUCCEEDED(rv) && sysPrefService) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
256 |
- |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
257 |
- // do the work to get gconf setting. |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
258 |
- // will be done soon later. |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
259 |
- sysPrefService->GetBoolPref(sAccessibilityKey, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
260 |
+ nsCOMPtr<nsIPrefService> prefService = |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
261 |
+ do_GetService(NS_PREFSERVICE_CONTRACTID, &rv); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
262 |
+ if (NS_SUCCEEDED(rv) && prefService) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
263 |
+ nsCOMPtr<nsIPrefBranch> prefBranch; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
264 |
+ rv = prefService->GetBranch(nsnull, getter_AddRefs(prefBranch)); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
265 |
+ if (NS_SUCCEEDED(rv) && prefBranch) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
266 |
+ prefBranch->GetBoolPref(sAccessibilityKey, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
267 |
&sAccessibilityEnabled); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
268 |
+ } |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
269 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
270 |
- |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
271 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
272 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
273 |
if (sAccessibilityEnabled) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
274 |
Index: xpinstall/src/nsXPInstallManager.cpp |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
275 |
=================================================================== |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
276 |
--- xpinstall/src/nsXPInstallManager.cpp.orig |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
277 |
+++ xpinstall/src/nsXPInstallManager.cpp |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
278 |
@@ -290,6 +290,7 @@ nsXPInstallManager::InitManagerInternal( |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
279 |
//----------------------------------------------------- |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
280 |
// Get permission to install |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
281 |
//----------------------------------------------------- |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
282 |
+ nsCOMPtr<nsIPrefBranch> pref(do_GetService(NS_PREFSERVICE_CONTRACTID)); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
283 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
284 |
#ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
285 |
if ( mChromeType == CHROME_SKIN ) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
286 |
@@ -299,17 +300,26 @@ nsXPInstallManager::InitManagerInternal( |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
287 |
|
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
288 |
// skins get a simpler/friendlier dialog |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
289 |
// XXX currently not embeddable |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
290 |
- OKtoInstall = ConfirmChromeInstall( mParentWindow, packageList ); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
291 |
+ PRBool themesDisabled = PR_FALSE; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
292 |
+ if (pref) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
293 |
+ pref->GetBoolPref("config.lockdown.disable_themes", &themesDisabled); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
294 |
+ OKtoInstall = !themesDisabled && |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
295 |
+ ConfirmChromeInstall( mParentWindow, packageList ); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
296 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
297 |
else |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
298 |
{ |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
299 |
#endif |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
300 |
- rv = dlgSvc->ConfirmInstall( mParentWindow, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
301 |
- packageList, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
302 |
- numStrings, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
303 |
- &OKtoInstall ); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
304 |
- if (NS_FAILED(rv)) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
305 |
- OKtoInstall = PR_FALSE; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
306 |
+ PRBool extensionsDisabled = PR_FALSE; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
307 |
+ if (pref) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
308 |
+ pref->GetBoolPref("config.lockdown.disable_extensions", &extensionsDisabled); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
309 |
+ if (!extensionsDisabled) { |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
310 |
+ rv = dlgSvc->ConfirmInstall( mParentWindow, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
311 |
+ packageList, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
312 |
+ numStrings, |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
313 |
+ &OKtoInstall ); |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
314 |
+ if (NS_FAILED(rv)) |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
315 |
+ OKtoInstall = PR_FALSE; |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
316 |
+ } |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
317 |
#ifdef ENABLE_SKIN_SIMPLE_INSTALLATION_UI |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
318 |
} |
523b1d92948c
Add mozilla-xulrunner192 package
Wolfgang Rosenauer <wr@rosenauer.org>
parents:
diff
changeset
|
319 |
#endif |