Bug 1758250 - deal with non-existing url values from session restore so they don't brick other functionality, r=dao

Differential Revision: https://phabricator.services.mozilla.com/D142947
This commit is contained in:
Gijs Kruitbosch
2022-04-12 10:39:03 +00:00
parent 1769de9be5
commit 1fb46fa941
2 changed files with 5 additions and 3 deletions

View File

@@ -2211,11 +2211,12 @@
break;
case "currentURI":
getter = () => {
let url = SessionStore.getLazyTabValue(aTab, "url");
// Avoid recreating the same nsIURI object over and over again...
if (browser._cachedCurrentURI) {
return browser._cachedCurrentURI;
}
let url =
SessionStore.getLazyTabValue(aTab, "url") || "about:blank";
return (browser._cachedCurrentURI = Services.io.newURI(url));
};
break;
@@ -2255,7 +2256,8 @@
break;
case "remoteType":
getter = () => {
let url = SessionStore.getLazyTabValue(aTab, "url");
let url =
SessionStore.getLazyTabValue(aTab, "url") || "about:blank";
// Avoid recreating the same nsIURI object over and over again...
let uri;
if (browser._cachedCurrentURI) {

View File

@@ -4341,7 +4341,7 @@ var SessionStoreInternal = {
* @returns a flag indicates whether a connection has been made
*/
prepareConnectionToHost(tab, url) {
if (!url.startsWith("about:")) {
if (url && !url.startsWith("about:")) {
let principal = Services.scriptSecurityManager.createNullPrincipal({
userContextId: tab.userContextId,
});