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

Delta Between Two Patch Sets: messageResponder.js

Issue 29329677: Issue 2396 - Add CSS property filter message responder (Closed)
Left Patch Set: Addressed feedback from Thomas Created Nov. 3, 2015, 2:07 p.m.
Right Patch Set: Remove specificOnly parameter from getRulesForDomain stub Created Nov. 5, 2015, 3:54 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « background.js ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 Eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 FilterStorage.addFilter(result.filter); 191 FilterStorage.addFilter(result.filter);
192 break; 192 break;
193 case "filters.blocked": 193 case "filters.blocked":
194 var filter = defaultMatcher.matchesAny(message.url, message.requestType, 194 var filter = defaultMatcher.matchesAny(message.url, message.requestType,
195 message.docDomain, message.thirdParty); 195 message.docDomain, message.thirdParty);
196 callback(filter instanceof BlockingFilter); 196 callback(filter instanceof BlockingFilter);
197 break; 197 break;
198 case "filters.get": 198 case "filters.get":
199 if (message.what == "cssproperties") 199 if (message.what == "cssproperties")
200 { 200 {
201 if (!message.domain) 201 var filters = [];
202 var isFrameWhitelisted = require("whitelisting").isFrameWhitelisted;
203
204 if (!isFrameWhitelisted(sender.page, sender.frame,
205 RegExpFilter.typeMap.DOCUMENT |
206 RegExpFilter.typeMap.ELEMHIDE))
202 { 207 {
203 callback([]); 208 filters = CSSRules.getRulesForDomain(sender.frame.url.hostname);
204 break; 209 filters = filters.map(function(filter)
210 {
211 return {
212 prefix: filter.selectorPrefix,
213 suffix: filter.selectorSuffix,
214 regexp: filter.regexpString
215 };
216 });
205 } 217 }
206 var specificOnly = require("whitelisting").isFrameWhitelisted(
Thomas Greiner 2015/11/03 14:26:02 I noticed that in "get-selectors" (see https://hg.
kzar 2015/11/03 15:49:49 Done.
207 sender.page, sender.frame, RegExpFilter.typeMap.GENERICHIDE
208 );
209 var filters = CSSRules.getRulesForDomain(message.domain, specificOnly) ;
210 filters = filters.map(function(filter)
211 {
212 return {
213 prefix: filter.selectorPrefix,
214 suffix: filter.selectorSuffix,
215 regexp: filter.regexpString
216 };
217 });
218 callback(filters); 218 callback(filters);
219 break; 219 break;
220 } 220 }
221 221
222 var subscription = Subscription.fromURL(message.subscriptionUrl); 222 var subscription = Subscription.fromURL(message.subscriptionUrl);
223 if (!subscription) 223 if (!subscription)
224 { 224 {
225 callback([]); 225 callback([]);
226 break; 226 break;
227 } 227 }
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 subscription.title = message.title; 341 subscription.title = message.title;
342 subscription.homepage = message.homepage; 342 subscription.homepage = message.homepage;
343 FilterStorage.addSubscription(subscription); 343 FilterStorage.addSubscription(subscription);
344 if (!subscription.lastDownload) 344 if (!subscription.lastDownload)
345 Synchronizer.execute(subscription); 345 Synchronizer.execute(subscription);
346 } 346 }
347 break; 347 break;
348 } 348 }
349 }); 349 });
350 })(this); 350 })(this);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld