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
Родитель 71016c4df5
Коммит e9ba135d9f
2 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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,
});