Index: background.js |
=================================================================== |
--- a/background.js |
+++ b/background.js |
@@ -519,6 +519,50 @@ |
else |
sendResponse(false); |
break; |
+ case "check-whitelisted-urls": |
+ var documentHost = extractHostFromFrame(sender.frame); |
+ var sitekey = getKey(sender.page, sender.frame); |
+ |
+ var result = Object.create(null); |
+ for (var i = 0; i < msg.urls.length; i++) |
+ { |
+ var requestUrl = msg.urls[i]; |
+ var requestHost = extractHostFromURL(requestUrl); |
+ |
+ var filter = defaultMatcher.matchesAny( |
+ requestUrl, msg.mediatype, documentHost, |
+ isThirdParty(requestHost, documentHost), |
+ sitekey |
+ ); |
+ |
+ result[requestUrl] = filter instanceof WhitelistFilter; |
+ } |
+ |
+ sendResponse(result); |
+ break; |
+ case "get-filters-from-selectors": |
+ var filters = []; |
+ var selectors = []; |
+ |
+ if (!isFrameWhitelisted(sender.page, sender.frame, "ELEMHIDE")) |
+ { |
+ var documentHost = extractHostFromFrame(sender.frame); |
+ |
+ for (var i = 0; i < msg.selectors.length; i++) |
+ { |
+ var selector = msg.selectors[i]; |
+ var filter = documentHost + "##" + selector; |
+ |
+ if (!ElemHide.getException(Filter.fromText(filter), documentHost)) |
+ { |
+ filters.push(filter); |
+ selectors.push(selector); |
+ } |
+ } |
+ } |
+ |
+ sendResponse({filters: filters, selectors: selectors}); |
+ break; |
case "get-domain-enabled-state": |
// Returns whether this domain is in the exclusion list. |
// The browser action popup asks us this. |