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: Avoid breaking the background.html test page Created Nov. 3, 2015, 4:16 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 var filters = []; 201 var filters = [];
202 var isFrameWhitelisted = require("whitelisting").isFrameWhitelisted; 202 var isFrameWhitelisted = require("whitelisting").isFrameWhitelisted;
203 203
204 if (message.domain && 204 if (!isFrameWhitelisted(sender.page, sender.frame,
205 !isFrameWhitelisted(sender.page, sender.frame,
206 RegExpFilter.typeMap.DOCUMENT | 205 RegExpFilter.typeMap.DOCUMENT |
207 RegExpFilter.typeMap.ELEMHIDE)) 206 RegExpFilter.typeMap.ELEMHIDE))
Wladimir Palant 2015/11/05 13:02:13 This is going to be rather problematic in Firefox.
kzar 2015/11/05 15:51:04 Acknowledged.
208 { 207 {
209 var specificOnly = isFrameWhitelisted( 208 filters = CSSRules.getRulesForDomain(sender.frame.url.hostname);
210 sender.page, sender.frame, RegExpFilter.typeMap.GENERICHIDE
211 );
Wladimir Palant 2015/11/05 13:02:13 This check makes no sense, CSS property rules are
kzar 2015/11/05 15:51:04 Done.
212 filters = CSSRules.getRulesForDomain(message.domain, specificOnly);
213 filters = filters.map(function(filter) 209 filters = filters.map(function(filter)
214 { 210 {
215 return { 211 return {
216 prefix: filter.selectorPrefix, 212 prefix: filter.selectorPrefix,
217 suffix: filter.selectorSuffix, 213 suffix: filter.selectorSuffix,
218 regexp: filter.regexpString 214 regexp: filter.regexpString
219 }; 215 };
220 }); 216 });
221 } 217 }
222 callback(filters); 218 callback(filters);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 subscription.title = message.title; 341 subscription.title = message.title;
346 subscription.homepage = message.homepage; 342 subscription.homepage = message.homepage;
347 FilterStorage.addSubscription(subscription); 343 FilterStorage.addSubscription(subscription);
348 if (!subscription.lastDownload) 344 if (!subscription.lastDownload)
349 Synchronizer.execute(subscription); 345 Synchronizer.execute(subscription);
350 } 346 }
351 break; 347 break;
352 } 348 }
353 }); 349 });
354 })(this); 350 })(this);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld