Bug 1482055 - Cleanup old cookies at shutdown if network.cookie.lifetimePolicy is ACCEPT_SESSION, r=johannh
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 17 Oct 2018 19:53:51 +0200
changeset 500251 2c633215c5148a0ea416237b749032e44e7708fb
parent 500250 31175b7c468b1f8f8589728f8a29d433e1594cd6
child 500252 200b836d3aa5a1375edebcec36f8afa3c0cb24c0
push id1864
push userffxbld-merge
push dateMon, 03 Dec 2018 15:51:40 +0000
treeherdermozilla-release@f040763d99ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohannh
bugs1482055
milestone64.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 1482055 - Cleanup old cookies at shutdown if network.cookie.lifetimePolicy is ACCEPT_SESSION, r=johannh
browser/modules/Sanitizer.jsm
--- a/browser/modules/Sanitizer.jsm
+++ b/browser/modules/Sanitizer.jsm
@@ -706,16 +706,24 @@ async function sanitizeOnShutdown(progre
 }
 
 async function sanitizeSessionPrincipals() {
   if (Services.prefs.getIntPref(PREF_COOKIE_LIFETIME,
                                 Ci.nsICookieService.ACCEPT_NORMALLY) != Ci.nsICookieService.ACCEPT_SESSION) {
     return;
   }
 
+  // When PREF_COOKIE_LIFETIME is set to ACCEPT_SESSION, any new cookie will be
+  // marked as session only. But we don't touch the existing ones. For this
+  // reason, here we delete any existing cookie, at shutdown.
+  await new Promise(resolve => {
+    Services.clearData.deleteData(Ci.nsIClearDataService.CLEAR_COOKIES,
+                                  resolve);
+  });
+
   let principals = await new Promise(resolve => {
     quotaManagerService.getUsage(request => {
       if (request.resultCode != Cr.NS_OK) {
         // We are probably shutting down. We don't want to propagate the
         // error, rejecting the promise.
         resolve([]);
         return;
       }