Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: popupBlocker.js

Issue 5138680696012800: Issue 616 - Enforce $generichide and $genericblock in Chrome (Closed)
Patch Set: Removed redundant logic in popup blocking changes. Created March 12, 2015, 7:45 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « background.js ('k') | webrequest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: popupBlocker.js
diff --git a/popupBlocker.js b/popupBlocker.js
index 2735f0a987d5d6dbdd093efe9c5d51cfaaeb3be6..62b242a58abc03b364c0d5f294b41ce078068b25 100644
--- a/popupBlocker.js
+++ b/popupBlocker.js
@@ -31,8 +31,13 @@ if (require("info").platform == "chromium")
if (!documentHost)
return;
- tabsLoading[details.tabId] = documentHost;
- checkPotentialPopup(details.tabId, details.url, documentHost);
+ var specificOnly = isFrameWhitelisted(sourcePage, sourceFrame, "GENERICBLOCK");
+
+ tabsLoading[details.tabId] = {
+ documentHost: documentHost,
+ specificOnly: specificOnly
+ };
+ checkPotentialPopup(details.tabId, details.url, specificOnly, documentHost);
});
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab)
@@ -44,20 +49,24 @@ if (require("info").platform == "chromium")
}
if ("url" in changeInfo)
- checkPotentialPopup(tabId, tab.url, tabsLoading[tabId]);
+ {
+ var source = tabsLoading[tabId];
+ checkPotentialPopup(tabId, tab.url, source.specificOnly, source.documentHost);
+ }
if ("status" in changeInfo && changeInfo.status == "complete" && tab.url != "about:blank")
delete tabsLoading[tabId];
});
}
-function checkPotentialPopup(tabId, url, documentHost)
+function checkPotentialPopup(tabId, url, specificOnly, documentHost)
Sebastian Noack 2015/03/12 19:59:36 Nit: I'd put the documentHost first to match the s
kzar 2015/03/12 20:42:12 Done.
{
url = new URL(url || "about:blank");
var filter = defaultMatcher.matchesAny(
stringifyURL(url), "POPUP",
- documentHost, isThirdParty(url, documentHost)
+ documentHost, isThirdParty(url, documentHost),
+ undefined, specificOnly
Sebastian Noack 2015/03/12 19:59:36 Nit: Please null instead undefined.
kzar 2015/03/12 20:42:12 Done.
);
if (filter instanceof BlockingFilter)
« no previous file with comments | « background.js ('k') | webrequest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld