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

Unified Diff: background.js

Issue 6393086494113792: Issue 154 - Added devtools panel showing blocked and blockable items (Closed)
Patch Set: Fixed typo in JSDoc syntax Created Feb. 2, 2016, 4:31 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 | « no previous file | chrome/devtools.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
===================================================================
--- a/background.js
+++ b/background.js
@@ -30,8 +30,7 @@
}
with(require("whitelisting"))
{
- this.isPageWhitelisted = isPageWhitelisted;
- this.isFrameWhitelisted = isFrameWhitelisted;
+ this.checkWhitelisted = checkWhitelisted;
this.processKey = processKey;
this.getKey = getKey;
}
@@ -53,6 +52,7 @@
var updateIcon = require("icon").updateIcon;
var initNotifications = require("notificationHelper").initNotifications;
var showNextNotificationForUrl = require("notificationHelper").showNextNotificationForUrl;
+var devtools = require("devtools");
var seenDataCorruption = false;
var filterlistsReinitialized = false;
@@ -126,7 +126,7 @@
// Adds or removes browser action icon according to options.
function refreshIconAndContextMenu(page)
{
- var whitelisted = isPageWhitelisted(page);
+ var whitelisted = !!checkWhitelisted(page);
updateIcon(page, whitelisted);
// show or hide the context menu entry dependent on whether
@@ -285,13 +285,15 @@
{
case "get-selectors":
var selectors = [];
+ var trace = devtools && devtools.hasPanel(sender.page);
- if (!isFrameWhitelisted(sender.page, sender.frame,
- RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeMap.ELEMHIDE))
+ if (!checkWhitelisted(sender.page, sender.frame,
+ RegExpFilter.typeMap.DOCUMENT |
+ RegExpFilter.typeMap.ELEMHIDE))
{
var noStyleRules = false;
- var specificOnly = isFrameWhitelisted(sender.page, sender.frame,
- RegExpFilter.typeMap.GENERICHIDE);
+ var specificOnly = checkWhitelisted(sender.page, sender.frame,
+ RegExpFilter.typeMap.GENERICHIDE);
var host = extractHostFromFrame(sender.frame);
for (var i = 0; i < noStyleRulesHosts.length; i++)
@@ -313,10 +315,10 @@
}
}
- sendResponse(selectors);
+ sendResponse({selectors: selectors, trace: trace});
break;
case "should-collapse":
- if (isFrameWhitelisted(sender.page, sender.frame, RegExpFilter.typeMap.DOCUMENT))
+ if (checkWhitelisted(sender.page, sender.frame))
{
sendResponse(false);
break;
@@ -354,7 +356,7 @@
// The browser action popup asks us this.
if(sender.page)
{
- sendResponse({enabled: !isPageWhitelisted(sender.page)});
+ sendResponse({enabled: !checkWhitelisted(sender.page)});
return;
}
break;
@@ -393,6 +395,12 @@
frame: sender.frame
}));
break;
+ case "trace-elemhide":
+ devtools.logHiddenElements(
+ sender.page, msg.selectors,
+ extractHostFromFrame(sender.frame)
+ );
+ break;
case "forward":
if (sender.page)
{
« no previous file with comments | « no previous file | chrome/devtools.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld