Bug 1315524 - Clear sessionStorage when expiring or sanitizing cookies on clean shutdown. r=mikedeboer
authorKestrel <kestrel@vmail.me>
Sun, 06 Nov 2016 02:24:00 -0500
changeset 462259 ba7751450a450324f7d500dca6a75dd9d52a9e95
parent 462258 e8c7c25bb30c25484d8f5a733d2858a168a50fb7
child 462260 3110a34c9897ec7135322baa875dc0a6c419138f
push id41683
push userbmo:steffen.wilberg@web.de
push dateMon, 16 Jan 2017 21:50:32 +0000
reviewersmikedeboer
bugs1315524
milestone53.0a1
Bug 1315524 - Clear sessionStorage when expiring or sanitizing cookies on clean shutdown. r=mikedeboer
browser/components/sessionstore/SessionSaver.jsm
--- a/browser/components/sessionstore/SessionSaver.jsm
+++ b/browser/components/sessionstore/SessionSaver.jsm
@@ -209,27 +209,30 @@ var SessionSaverInternal = {
           break;
         }
 
         delete state._closedWindows[i]._shouldRestore;
         state.windows.unshift(state._closedWindows.pop());
       }
     }
 
-    // Clear all cookies on clean shutdown according to user preferences
+    // Clear all cookies and storage on clean shutdown according to user preferences
     if (RunState.isClosing) {
       let expireCookies = Services.prefs.getIntPref("network.cookie.lifetimePolicy") ==
                           Services.cookies.QueryInterface(Ci.nsICookieService).ACCEPT_SESSION;
       let sanitizeCookies = Services.prefs.getBoolPref("privacy.sanitize.sanitizeOnShutdown") &&
                             Services.prefs.getBoolPref("privacy.clearOnShutdown.cookies");
       let restart = Services.prefs.getBoolPref("browser.sessionstore.resume_session_once");
-      // Don't clear cookies when restarting
+      // Don't clear when restarting
       if ((expireCookies || sanitizeCookies) && !restart) {
         for (let window of state.windows) {
           delete window.cookies;
+          for (let tab of window.tabs) {
+            delete tab.storage;
+          }
         }
       }
     }
 
     stopWatchFinish("COLLECT_DATA_MS", "COLLECT_DATA_LONGEST_OP_MS");
     return this._writeState(state);
   },