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

Unified Diff: messageResponder.js

Issue 29329677: Issue 2396 - Add CSS property filter message responder (Closed)
Patch Set: Created Nov. 3, 2015, 10:12 a.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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: messageResponder.js
diff --git a/messageResponder.js b/messageResponder.js
index a6886cbbe74380c6901224cc87b8d405de5a8da8..5914e85ac9be6852269d6081f401877323259da4 100644
--- a/messageResponder.js
+++ b/messageResponder.js
@@ -25,7 +25,8 @@
var FilterStorage = require("filterStorage").FilterStorage;
var FilterNotifier = require("filterNotifier").FilterNotifier;
var defaultMatcher = require("matcher").defaultMatcher;
-
+ var CSSRules = require("cssRules").CSSRules;
+
var filterClasses = require("filterClasses");
var Filter = filterClasses.Filter;
var BlockingFilter = filterClasses.BlockingFilter;
@@ -194,13 +195,28 @@
callback(filter instanceof BlockingFilter);
break;
case "filters.get":
+ if (message.what == "cssproperties" && "domain" in message)
Thomas Greiner 2015/11/03 10:57:02 This condition allows the following invalid messag
kzar 2015/11/03 14:09:51 Done.
+ {
+ callback(CSSRules.getRulesForDomain(
Thomas Greiner 2015/11/03 10:57:02 Please avoid forcing everything into a single stat
kzar 2015/11/03 14:09:51 I thought it was pretty readable as it was but fai
Thomas Greiner 2015/11/03 14:26:01 Thanks, I appreciate it. It would've even allowed
kzar 2015/11/03 15:49:49 Done.
+ message.domain, message.specificOnly).map(function(filter)
Thomas Greiner 2015/11/03 10:57:03 The content script doesn't know whether it's suppo
kzar 2015/11/03 14:09:51 Done.
+ {
+ return {
+ prefix: filter.selectorPrefix,
+ suffix: filter.selectorSuffix,
+ regexp: filter.regexpString()
Thomas Greiner 2015/11/03 10:57:03 `CSSPropertyFilter.prototype.regexpString` is a st
kzar 2015/11/03 14:09:51 Whoops good point, Done.
+ };
+ })
+ );
+ break;
+ }
+
var subscription = Subscription.fromURL(message.subscriptionUrl);
if (!subscription)
{
callback([]);
break;
}
-
+
callback(subscription.filters.map(convertFilter));
break;
case "filters.importRaw":
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld