Bug 1492154 - Allow for invalid origin in principal and fix misspelled principal uri and url in sessionstore. r=IanN
authorFrank-Rainer Grahl <frgrahl@gmx.net>
Sat, 27 Oct 2018 23:21:58 +0200
changeset 33598 bb81266621e3ebdf81a0b849952ddd4f9dc82320
parent 33597 b9ca6e1d8ca97f51ab10265623caa1c032878c67
child 33599 5ea8d388a319d4956614fd9833e4ac0c7791ca0c
push id388
push userclokep@gmail.com
push dateMon, 28 Jan 2019 20:54:56 +0000
reviewersIanN
bugs1492154
Bug 1492154 - Allow for invalid origin in principal and fix misspelled principal uri and url in sessionstore. r=IanN
suite/components/sessionstore/nsSessionStore.js
--- a/suite/components/sessionstore/nsSessionStore.js
+++ b/suite/components/sessionstore/nsSessionStore.js
@@ -1702,21 +1702,28 @@ 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(Ci.nsIInterfaceRequestor)
                             .getInterface(Ci.nsIDOMWindow);
       try {