Bug 1515665 - no window passwed when creating SessionStorage in SessionStorage.jsm, r=ehsan
authorAndrea Marchesini <amarchesini@mozilla.com>
Wed, 23 Jan 2019 19:19:20 +0100
changeset 515164 c6b3ea3602511a0cb54c02cdd912584420f705d4
parent 515163 188f4b17a553dd31889c64fa5695df535a7cf0a1
child 515165 6a1c4140f4796d03368e9ab4b8f547209422fdd5
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs1515665
milestone66.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 1515665 - no window passwed when creating SessionStorage in SessionStorage.jsm, r=ehsan
browser/components/sessionstore/SessionStorage.jsm
--- a/browser/components/sessionstore/SessionStorage.jsm
+++ b/browser/components/sessionstore/SessionStorage.jsm
@@ -140,22 +140,24 @@ var SessionStorageInternal = {
         let dataPrincipal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin);
         principal = Services.scriptSecurityManager.createCodebasePrincipal(dataPrincipal.URI, attrs);
       } catch (e) {
         console.error(e);
         continue;
       }
 
       let storageManager = aDocShell.QueryInterface(Ci.nsIDOMStorageManager);
-      let window = aDocShell.domWindow;
 
-      // There is no need to pass documentURI, it's only used to fill documentURI property of
-      // domstorage event, which in this case has no consumer. Prevention of events in case
-      // of missing documentURI will be solved in a followup bug to bug 600307.
-      let storage = storageManager.createStorage(window, principal, "", aDocShell.usePrivateBrowsing);
+      // There is no need to pass documentURI, it's only used to fill
+      // documentURI property of domstorage event, which in this case has no
+      // consumer. Prevention of events in case of missing documentURI will be
+      // solved in a followup bug to bug 600307.
+      // Null window because the current window doesn't match the principal yet
+      // and loads about:blank.
+      let storage = storageManager.createStorage(null, principal, "", aDocShell.usePrivateBrowsing);
 
       for (let key of Object.keys(data)) {
         try {
           storage.setItem(key, data[key]);
         } catch (e) {
           // throws e.g. for URIs that can't have sessionStorage
           console.error(e);
         }