CINXE.COM
Index: browser/components/preferences/privacy.js =================================================================== RCS file: /cvsroot/mozilla/browser/components/preferences/privacy.js,v retrieving revision 1.25 diff -u -8 -p -r1.25 privacy.js --- browser/components/preferences/privacy.js 25 Feb 2008 08:50:16 -0000 1.25 +++ browser/components/preferences/privacy.js 10 Mar 2008 23:23:32 -0000 @@ -156,53 +156,73 @@ var gPrivacyPane = { // COOKIES /* * Preferences: * * network.cookie.cookieBehavior * - determines how the browser should handle cookies: * 0 means enable all cookies - * 1 means allow cookies from the "originating" server only; see + * 1 means reject third party cookies; see * netwerk/cookie/src/nsCookieService.cpp for a hairier definition * 2 means disable all cookies * network.cookie.lifetimePolicy * - determines how long cookies are stored: * 0 means keep cookies until they expire * 1 means ask how long to keep each cookie * 2 means keep cookies until the browser is closed */ /** * Reads the network.cookie.cookieBehavior preference value and - * enables/disables the "Keep until:" UI accordingly, returning true + * enables/disables the rest of the cookie UI accordingly, returning true * if cookies are enabled. */ readAcceptCookies: function () { var pref = document.getElementById("network.cookie.cookieBehavior"); + var acceptThirdParty = document.getElementById("acceptThirdParty"); var keepUntil = document.getElementById("keepUntil"); var menu = document.getElementById("keepCookiesUntil"); - // anything other than "disable all cookies" maps to "accept cookies" + // enable the rest of the UI for anything other than "disable all cookies" var acceptCookies = (pref.value != 2); - keepUntil.disabled = menu.disabled = !acceptCookies; + keepUntil.disabled = menu.disabled = acceptThirdParty.disabled = !acceptCookies; return acceptCookies; }, + readAcceptThirdPartyCookies: function () + { + var pref = document.getElementById("network.cookie.cookieBehavior"); + return pref.value == 0; + }, + /** * Enables/disables the "keep until" label and menulist in response to the * "accept cookies" checkbox being checked or unchecked. */ writeAcceptCookies: function () { - var checkbox = document.getElementById("acceptCookies"); - return checkbox.checked ? 0 : 2; + var accept = document.getElementById("acceptCookies"); + var acceptThirdParty = document.getElementById("acceptThirdParty"); + + // if we're enabling cookies, automatically check 'accept third party' + if (accept.checked) + acceptThirdParty.checked = true; + + return accept.checked ? (acceptThirdParty.checked ? 0 : 1) : 2; + }, + + writeAcceptThirdPartyCookies: function () + { + var accept = document.getElementById("acceptCookies"); + var acceptThirdParty = document.getElementById("acceptThirdParty"); + return accept.checked ? (acceptThirdParty.checked ? 0 : 1) : 2; }, /** * Displays fine-grained, per-site preferences for cookies. */ showCookieExceptions: function () { var bundlePreferences = document.getElementById("bundlePreferences"); Index: browser/components/preferences/privacy.xul =================================================================== RCS file: /cvsroot/mozilla/browser/components/preferences/privacy.xul,v retrieving revision 1.26 diff -u -8 -p -r1.26 privacy.xul --- browser/components/preferences/privacy.xul 8 Mar 2008 01:07:48 -0000 1.26 +++ browser/components/preferences/privacy.xul 10 Mar 2008 23:23:32 -0000 @@ -137,16 +137,22 @@ preference="network.cookie.cookieBehavior" accesskey="&acceptCookies.accesskey;" onsyncfrompreference="return gPrivacyPane.readAcceptCookies();" onsynctopreference="return gPrivacyPane.writeAcceptCookies();"/> <button id="cookieExceptions" oncommand="gPrivacyPane.showCookieExceptions();" label="&cookieExceptions.label;" accesskey="&cookieExceptions.accesskey;" preference="pref.privacy.disable_button.cookie_exceptions"/> </hbox> + <checkbox id="acceptThirdParty" label="&acceptThirdParty.label;" class="indent" + preference="network.cookie.cookieBehavior" + accesskey="&acceptThirdParty.accesskey;" + onsyncfrompreference="return gPrivacyPane.readAcceptThirdPartyCookies();" + onsynctopreference="return gPrivacyPane.writeAcceptThirdPartyCookies();"/> + <hbox id="keepRow"> <hbox id="keepBox" align="center" class="indent"> <label id="keepUntil" control="keepCookiesUntil" accesskey="&keepUntil.accesskey;">&keepUntil.label;</label> <menulist id="keepCookiesUntil" preference="network.cookie.lifetimePolicy"> <menupopup>