Index: popupBlocker.js |
=================================================================== |
--- a/popupBlocker.js |
+++ b/popupBlocker.js |
@@ -15,6 +15,8 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
+var logRequest = require("devtools").logRequest; |
+ |
if (require("info").platform == "chromium") |
{ |
var tabsLoading = {}; |
@@ -31,27 +33,25 @@ |
if (!documentHost) |
return; |
- tabsLoading[details.tabId] = documentHost; |
- checkPotentialPopup(details.tabId, details.url, documentHost); |
+ tabsLoading[details.tabId] = {page: sourcePage, host: documentHost}; |
+ checkPotentialPopup(details.tabId, details.url, sourcePage, documentHost); |
}); |
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) |
{ |
- if (!(tabId in tabsLoading)) |
- { |
- // Not a pop-up we've previously seen |
+ var opener = tabsLoading[tabId]; |
+ if (!opener) |
return; |
- } |
if ("url" in changeInfo) |
- checkPotentialPopup(tabId, tab.url, tabsLoading[tabId]); |
+ checkPotentialPopup(tabId, tab.url, opener.page, opener.host); |
if ("status" in changeInfo && changeInfo.status == "complete" && tab.url != "about:blank") |
delete tabsLoading[tabId]; |
}); |
} |
-function checkPotentialPopup(tabId, url, documentHost) |
+function checkPotentialPopup(tabId, url, sourcePage, documentHost) |
{ |
url = new URL(url || "about:blank"); |
@@ -62,4 +62,6 @@ |
if (filter instanceof BlockingFilter) |
chrome.tabs.remove(tabId); |
+ |
+ logRequest(sourcePage, url, "POPUP", documentHost, null, filter); |
} |