[TabGuard] Fixed regression in about:blank handling (thanks NDevTK for reporting).
This commit is contained in:
parent
651e476650
commit
c22eafc35b
|
@ -121,11 +121,24 @@ var TabGuard = (() => {
|
||||||
code: "window.origin === 'null' ? window.location.href : window.origin"
|
code: "window.origin === 'null' ? window.location.href : window.origin"
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
// We don't have permissions to run in this tab, probably because it has been left empty.
|
||||||
debug(e);
|
debug(e);
|
||||||
}
|
}
|
||||||
|
// If it's about:blank and it has got an opener, let's assume the opener
|
||||||
|
// is the real origin and it's using the empty tab to run scripts.
|
||||||
|
if (tab.url === "about:blank") {
|
||||||
|
if (tab.openerTabId > 0) {
|
||||||
|
let openerTab = TabCache.get(tab.openerTabId);
|
||||||
|
if (openerTab) {
|
||||||
|
tab.url = openerTab.url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (tab.url !== "about:blank") {
|
||||||
debug(`Real origin for ${tab._externalUrl} (tab ${tab.id}) is ${tab.url}.`);
|
debug(`Real origin for ${tab._externalUrl} (tab ${tab.id}) is ${tab.url}.`);
|
||||||
if (!ns.policy.can(tab.url, "script")) return;
|
if (!ns.policy.can(tab.url, "script")) return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
suspiciousDomains.push(getDomain(tab.url));
|
suspiciousDomains.push(getDomain(tab.url));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue