From 89fa8ab607719f404cd9eac29fae5a6a68c33164 Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Sat, 22 Jun 2002 21:21:44 +0000 Subject: [PATCH] Remap cookie prefs to be something chimera understands before we get to the pref panel. Ignore p3p and foreign cookies. --- camino/CHPreferenceManager.mm | 14 ++++++++++++++ camino/PreferencePanes/Privacy/PrivacyPane.mm | 6 +++--- camino/src/preferences/PreferenceManager.mm | 14 ++++++++++++++ chimera/CHPreferenceManager.mm | 14 ++++++++++++++ chimera/PreferencePanes/Privacy/PrivacyPane.mm | 6 +++--- chimera/src/preferences/PreferenceManager.mm | 14 ++++++++++++++ 6 files changed, 62 insertions(+), 6 deletions(-) diff --git a/camino/CHPreferenceManager.mm b/camino/CHPreferenceManager.mm index 5e99c6646b2..007fd093454 100644 --- a/camino/CHPreferenceManager.mm +++ b/camino/CHPreferenceManager.mm @@ -166,6 +166,20 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count); return; } + // fix up the cookie prefs. If 'p3p' or 'accept foreign cookies' are on, remap them to + // something that chimera can deal with. + PRInt32 acceptCookies = 0; + static const char* kCookieBehaviorPref = "network.cookie.cookieBehavior"; + prefs->GetIntPref(kCookieBehaviorPref, &acceptCookies); + if ( acceptCookies == 1 ) { // accept foreign cookies, assume off + acceptCookies = 2; + prefs->SetIntPref(kCookieBehaviorPref, acceptCookies); + } + else if ( acceptCookies == 3 ) { // p3p, assume all cookies on + acceptCookies = 0; + prefs->SetIntPref(kCookieBehaviorPref, acceptCookies); + } + // get home page from Internet Config string = [self getICStringPref:kICWWWHomePage]; if (string) { diff --git a/camino/PreferencePanes/Privacy/PrivacyPane.mm b/camino/PreferencePanes/Privacy/PrivacyPane.mm index 17f8cd923f1..174dd99bfb0 100644 --- a/camino/PreferencePanes/Privacy/PrivacyPane.mm +++ b/camino/PreferencePanes/Privacy/PrivacyPane.mm @@ -35,11 +35,11 @@ return; // Hookup cookie prefs. Relies on the tags of the radio buttons in the matrix being - // set such that "enable all" is 0 and "disable all" is 2. + // set such that "enable all" is 0 and "disable all" is 2. If mozilla has other prefs + // that we don't quite know about, we assume they were remapped by the CHPreferenceManager + // at startup. PRInt32 acceptCookies = 0; mPrefService->GetIntPref("network.cookie.cookieBehavior", &acceptCookies); - if ( acceptCookies == 1 ) // be safe in case of importing a mozilla profile - acceptCookies = 2; if ( [mCookies selectCellWithTag:acceptCookies] != YES ) NS_WARNING("Bad value for network.cookie.cookieBehavior"); diff --git a/camino/src/preferences/PreferenceManager.mm b/camino/src/preferences/PreferenceManager.mm index 5e99c6646b2..007fd093454 100644 --- a/camino/src/preferences/PreferenceManager.mm +++ b/camino/src/preferences/PreferenceManager.mm @@ -166,6 +166,20 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count); return; } + // fix up the cookie prefs. If 'p3p' or 'accept foreign cookies' are on, remap them to + // something that chimera can deal with. + PRInt32 acceptCookies = 0; + static const char* kCookieBehaviorPref = "network.cookie.cookieBehavior"; + prefs->GetIntPref(kCookieBehaviorPref, &acceptCookies); + if ( acceptCookies == 1 ) { // accept foreign cookies, assume off + acceptCookies = 2; + prefs->SetIntPref(kCookieBehaviorPref, acceptCookies); + } + else if ( acceptCookies == 3 ) { // p3p, assume all cookies on + acceptCookies = 0; + prefs->SetIntPref(kCookieBehaviorPref, acceptCookies); + } + // get home page from Internet Config string = [self getICStringPref:kICWWWHomePage]; if (string) { diff --git a/chimera/CHPreferenceManager.mm b/chimera/CHPreferenceManager.mm index 5e99c6646b2..007fd093454 100644 --- a/chimera/CHPreferenceManager.mm +++ b/chimera/CHPreferenceManager.mm @@ -166,6 +166,20 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count); return; } + // fix up the cookie prefs. If 'p3p' or 'accept foreign cookies' are on, remap them to + // something that chimera can deal with. + PRInt32 acceptCookies = 0; + static const char* kCookieBehaviorPref = "network.cookie.cookieBehavior"; + prefs->GetIntPref(kCookieBehaviorPref, &acceptCookies); + if ( acceptCookies == 1 ) { // accept foreign cookies, assume off + acceptCookies = 2; + prefs->SetIntPref(kCookieBehaviorPref, acceptCookies); + } + else if ( acceptCookies == 3 ) { // p3p, assume all cookies on + acceptCookies = 0; + prefs->SetIntPref(kCookieBehaviorPref, acceptCookies); + } + // get home page from Internet Config string = [self getICStringPref:kICWWWHomePage]; if (string) { diff --git a/chimera/PreferencePanes/Privacy/PrivacyPane.mm b/chimera/PreferencePanes/Privacy/PrivacyPane.mm index 17f8cd923f1..174dd99bfb0 100644 --- a/chimera/PreferencePanes/Privacy/PrivacyPane.mm +++ b/chimera/PreferencePanes/Privacy/PrivacyPane.mm @@ -35,11 +35,11 @@ return; // Hookup cookie prefs. Relies on the tags of the radio buttons in the matrix being - // set such that "enable all" is 0 and "disable all" is 2. + // set such that "enable all" is 0 and "disable all" is 2. If mozilla has other prefs + // that we don't quite know about, we assume they were remapped by the CHPreferenceManager + // at startup. PRInt32 acceptCookies = 0; mPrefService->GetIntPref("network.cookie.cookieBehavior", &acceptCookies); - if ( acceptCookies == 1 ) // be safe in case of importing a mozilla profile - acceptCookies = 2; if ( [mCookies selectCellWithTag:acceptCookies] != YES ) NS_WARNING("Bad value for network.cookie.cookieBehavior"); diff --git a/chimera/src/preferences/PreferenceManager.mm b/chimera/src/preferences/PreferenceManager.mm index 5e99c6646b2..007fd093454 100644 --- a/chimera/src/preferences/PreferenceManager.mm +++ b/chimera/src/preferences/PreferenceManager.mm @@ -166,6 +166,20 @@ app_getModuleInfo(nsStaticModuleInfo **info, PRUint32 *count); return; } + // fix up the cookie prefs. If 'p3p' or 'accept foreign cookies' are on, remap them to + // something that chimera can deal with. + PRInt32 acceptCookies = 0; + static const char* kCookieBehaviorPref = "network.cookie.cookieBehavior"; + prefs->GetIntPref(kCookieBehaviorPref, &acceptCookies); + if ( acceptCookies == 1 ) { // accept foreign cookies, assume off + acceptCookies = 2; + prefs->SetIntPref(kCookieBehaviorPref, acceptCookies); + } + else if ( acceptCookies == 3 ) { // p3p, assume all cookies on + acceptCookies = 0; + prefs->SetIntPref(kCookieBehaviorPref, acceptCookies); + } + // get home page from Internet Config string = [self getICStringPref:kICWWWHomePage]; if (string) {