[TabGuard] Check for chains of about:blank puppet tabs.

This commit is contained in:
hackademix 2023-06-22 22:48:31 +02:00
parent 327c3e19ea
commit 73da318de5
No known key found for this signature in database
GPG Key ID: 231A83AFDA9C2434
1 changed files with 9 additions and 6 deletions

View File

@ -162,12 +162,15 @@ var TabGuard = (() => {
}
// 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;
}
while (tab.url === "about:blank") {
if (!tab.openerTabId) {
break;
}
const openerTab = TabCache.get(tab.openerTabId);
if (openerTab) {
tab.url = openerTab.url;
} else {
break;
}
}
if (tab.url !== "about:blank") {