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

Unified Diff: popupBlocker.js

Issue 6393086494113792: Issue 154 - Added devtools panel showing blocked and blockable items (Closed)
Patch Set: Updated dependencies Created Jan. 30, 2016, 4:01 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 | « metadata.safari ('k') | webrequest.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: popupBlocker.js
===================================================================
--- a/popupBlocker.js
+++ b/popupBlocker.js
@@ -17,6 +17,7 @@
if (require("info").platform == "chromium")
{
+ var logRequest = require("devtools").logRequest;
var tabsLoading = {};
chrome.webNavigation.onCreatedNavigationTarget.addListener(function(details)
@@ -35,10 +36,11 @@
RegExpFilter.typeMap.GENERICBLOCK);
tabsLoading[details.tabId] = {
+ page: sourcePage,
documentHost: documentHost,
specificOnly: specificOnly
};
- checkPotentialPopup(details.tabId, details.url, documentHost, specificOnly);
+ checkPotentialPopup(details.tabId, details.url, sourcePage, documentHost, specificOnly);
});
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab)
@@ -52,8 +54,9 @@
if ("url" in changeInfo)
{
var source = tabsLoading[tabId];
- checkPotentialPopup(tabId, tab.url, source.documentHost,
- source.specificOnly);
+ checkPotentialPopup(tabId, tab.url, source.page,
+ source.documentHost,
+ source.specificOnly);
}
if ("status" in changeInfo && changeInfo.status == "complete" && tab.url != "about:blank")
@@ -61,16 +64,19 @@
});
}
-function checkPotentialPopup(tabId, url, documentHost, specificOnly)
+function checkPotentialPopup(tabId, url, sourcePage, documentHost, specificOnly)
{
- url = new URL(url || "about:blank");
+ var urlObj = new URL(url || "about:blank");
+ var urlString = stringifyURL(urlObj);
+ var thirdParty = isThirdParty(urlObj, documentHost);
var filter = defaultMatcher.matchesAny(
- stringifyURL(url), RegExpFilter.typeMap.POPUP,
- documentHost, isThirdParty(url, documentHost),
- null, specificOnly
+ urlString, RegExpFilter.typeMap.POPUP,
+ documentHost, thirdParty, null, specificOnly
);
if (filter instanceof BlockingFilter)
chrome.tabs.remove(tabId);
+
+ logRequest(sourcePage, urlString, "POPUP", documentHost, thirdParty, null, filter);
}
« no previous file with comments | « metadata.safari ('k') | webrequest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld