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

Unified Diff: messageResponder.js

Issue 29361722: Issue 4592 - Adapt messaging code for the new element hiding emulation filters (Closed) Base URL: https://bitbucket.org/fhd/adblockplusui
Patch Set: Created Nov. 3, 2016, 6:20 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 | « background.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: messageResponder.js
===================================================================
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -20,17 +20,17 @@
if (!global.ext)
global.ext = require("ext_background");
var Prefs = require("prefs").Prefs;
var Utils = require("utils").Utils;
var FilterStorage = require("filterStorage").FilterStorage;
var FilterNotifier = require("filterNotifier").FilterNotifier;
var defaultMatcher = require("matcher").defaultMatcher;
- var CSSRules = require("cssRules").CSSRules;
+ var ElemHideEmulation = require("elemHideEmulation").ElemHideEmulation;
var NotificationStorage = require("notification").Notification;
var filterClasses = require("filterClasses");
var Filter = filterClasses.Filter;
var BlockingFilter = filterClasses.BlockingFilter;
var RegExpFilter = filterClasses.RegExpFilter;
var Synchronizer = require("synchronizer").Synchronizer;
@@ -215,32 +215,31 @@
break;
case "filters.blocked":
var filter = defaultMatcher.matchesAny(message.url,
RegExpFilter.typeMap[message.requestType], message.docDomain,
message.thirdParty);
callback(filter instanceof BlockingFilter);
break;
case "filters.get":
- if (message.what == "cssproperties")
+ if (message.what == "elemhideemulation")
{
var filters = [];
var checkWhitelisted = require("whitelisting").checkWhitelisted;
if (Prefs.enabled && !checkWhitelisted(sender.page, sender.frame,
RegExpFilter.typeMap.DOCUMENT |
RegExpFilter.typeMap.ELEMHIDE))
{
- filters = CSSRules.getRulesForDomain(sender.frame.url.hostname);
+ filters = ElemHideEmulation.getRulesForDomain(sender.frame.url.hostname);
kzar 2016/11/04 14:37:21 Nit: Mind fixing this long line?
Felix Dahlke 2016/11/04 17:38:46 Done.
filters = filters.map(function(filter)
{
return {
- prefix: filter.selectorPrefix,
- suffix: filter.selectorSuffix,
- regexp: filter.regexpString,
+ features: filter.features,
+ selector: filter.selector,
text: filter.text
};
});
}
callback(filters);
break;
}
« no previous file with comments | « background.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld