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: Rebased Created Feb. 13, 2015, 4:16 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.common ('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
@@ -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);
}
« no previous file with comments | « metadata.common ('k') | webrequest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld