Bug 1457180 - gPrivacyPane.readKeepCookiesUntil() must support only nsICookieService.ACCEPT_SESSION and nsICookieService.ACCEPT_NORMALLY values, r=gijs
authorAndrea Marchesini <amarchesini@mozilla.com>
Thu, 03 May 2018 08:25:30 +0200
changeset 472924 e44dc88af55ca3d293bd3f48311f529d9bfa13ae
parent 472923 be69e9f75001133362e1b50c98d0ef10dea34a22
child 472925 2c900172250aa0fd23cec4d12cc0158f25fa2818
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs
bugs1457180
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1457180 - gPrivacyPane.readKeepCookiesUntil() must support only nsICookieService.ACCEPT_SESSION and nsICookieService.ACCEPT_NORMALLY values, r=gijs
browser/components/preferences/in-content/privacy.js
--- a/browser/components/preferences/in-content/privacy.js
+++ b/browser/components/preferences/in-content/privacy.js
@@ -808,27 +808,27 @@ var gPrivacyPane = {
    * - determines how long cookies are stored:
    *     0   means keep cookies until they expire
    *     2   means keep cookies until the browser is closed
    */
 
   readKeepCookiesUntil() {
     let privateBrowsing = Preferences.get("browser.privatebrowsing.autostart").value;
     if (privateBrowsing) {
-      return "2";
+      return Ci.nsICookieService.ACCEPT_SESSION;
     }
 
     let lifetimePolicy = Preferences.get("network.cookie.lifetimePolicy").value;
-    if (lifetimePolicy != Ci.nsICookieService.ACCEPT_NORMALLY &&
-      lifetimePolicy != Ci.nsICookieService.ACCEPT_SESSION &&
-      lifetimePolicy != Ci.nsICookieService.ACCEPT_FOR_N_DAYS) {
-      return Ci.nsICookieService.ACCEPT_NORMALLY;
+    if (lifetimePolicy == Ci.nsICookieService.ACCEPT_SESSION) {
+      return Ci.nsICookieService.ACCEPT_SESSION;
     }
 
-    return lifetimePolicy;
+    // network.cookie.lifetimePolicy can be set to any value, but we just
+    // support ACCEPT_SESSION and ACCEPT_NORMALLY. Let's force ACCEPT_NORMALLY.
+    return Ci.nsICookieService.ACCEPT_NORMALLY;
   },
 
   /**
    * Reads the network.cookie.cookieBehavior preference value and
    * enables/disables the rest of the cookie UI accordingly.
    *
    * Returns "0" if cookies are accepted and "2" if they are entirely disabled.
    */