Bug 1492154 - Allow for invalid origin in principal and fix misspelled principal uri and url in sessionstore. r=IanN a=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Sat, 27 Oct 2018 23:56:21 +0200
changeset 28298 883ee2aed9c0
parent 28297 6b4a44972c3b
child 28299 ef15e15768b5
push id2125
push userfrgrahl@gmx.net
push dateSat, 27 Oct 2018 21:58:33 +0000
treeherdercomm-esr52@76b95caa256a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersIanN, IanN
bugs1492154
Bug 1492154 - Allow for invalid origin in principal and fix misspelled principal uri and url in sessionstore. r=IanN a=IanN
suite/common/src/nsSessionStore.js
--- a/suite/common/src/nsSessionStore.js
+++ b/suite/common/src/nsSessionStore.js
@@ -1688,28 +1688,35 @@ SessionStoreService.prototype = {
       }
       catch (ex) {
         // Chances are that this is getEntryAtIndex throwing, as seen in bug 669196.
         // We've already asserted in _collectTabData, so we won't show that again.
         continue;
       }
 
       // sessionStorage is saved per principal (cf. nsGlobalWindow::GetSessionStorage)
-      let origin = principal.origin;
+      let origin;
+      try {
+        origin = principal.origin;
+      }
+      catch (ex) {
+        origin = principal.URI.spec;
+      }
+
       if (storageData[origin])
         continue;
 
-      let isHTTPS = principal.uri && principal.url.schemeIs("https");
+      let isHTTPS = principal.URI && principal.URI.schemeIs("https");
       if (!(aFullData || this._checkPrivacyLevel(isHTTPS, aIsPinned)))
         continue;
 
       let storage, storageItemCount = 0;
 
       let window = aDocShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
-                                              .getInterface(Components.interfaces.nsIDOMWindow);
+                            .getInterface(Components.interfaces.nsIDOMWindow);
       try {
         let storageManager = aDocShell.QueryInterface(Components.interfaces.nsIDOMStorageManager);
         storage = storageManager.getStorage(window, principal);
 
         // See Bug 1232955 - storage.length can throw, catch that failure here inside the try.
         if (storage)
           storageItemCount = storage.length;
       }