| 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); |
|
kzar
2016/01/31 13:33:53
Nit: Mind wrapping this and the long line below?
|
| }); |
| 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"); |
|
kzar
2016/01/31 13:33:52
Shouldn't we put the `url || "about:blank"` worka
Sebastian Noack
2016/02/02 10:39:53
Note that Chrome's native URL object treating '' a
kzar
2016/02/02 15:42:09
IMO the polyfill should take care of those inconsi
Sebastian Noack
2016/02/02 16:33:45
A polyfill is a temporary solution, until browsers
|
| + 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); |
| } |