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

Delta Between Two Patch Sets: background.js

Issue 29329677: Issue 2396 - Add CSS property filter message responder (Closed)
Left Patch Set: Created Nov. 3, 2015, 10:12 a.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:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | messageResponder.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 { 56 {
57 return parent.ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-"); 57 return parent.ext.i18n.getMessage("@@ui_locale").replace(/_/g, "-");
58 } 58 }
59 } 59 }
60 }; 60 };
61 61
62 modules.prefs = { 62 modules.prefs = {
63 Prefs: { 63 Prefs: {
64 "subscriptions_exceptionsurl": "https://easylist-downloads.adblockplus.org /exceptionrules.txt" 64 "subscriptions_exceptionsurl": "https://easylist-downloads.adblockplus.org /exceptionrules.txt"
65 } 65 }
66 } 66 };
67 67
68 modules.subscriptionClasses = { 68 modules.subscriptionClasses = {
69 Subscription: function(url) 69 Subscription: function(url)
70 { 70 {
71 this.url = url; 71 this.url = url;
72 this.title = "Subscription " + url; 72 this.title = "Subscription " + url;
73 this.disabled = false; 73 this.disabled = false;
74 this.lastDownload = 1234; 74 this.lastDownload = 1234;
75 }, 75 },
76 76
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 this.disabled = false; 157 this.disabled = false;
158 } 158 }
159 }; 159 };
160 modules.filterClasses.Filter.fromText = function(text) 160 modules.filterClasses.Filter.fromText = function(text)
161 { 161 {
162 return new modules.filterClasses.Filter(text); 162 return new modules.filterClasses.Filter(text);
163 }; 163 };
164 164
165 modules.filterValidation = 165 modules.filterValidation =
166 { 166 {
167 parseFilter: function(text) 167 parseFilter: function(text)
168 { 168 {
169
170 if (params.filterError) 169 if (params.filterError)
171 return {error: "Invalid filter"}; 170 return {error: "Invalid filter"};
172 return {filter: modules.filterClasses.Filter.fromText(text)}; 171 return {filter: modules.filterClasses.Filter.fromText(text)};
173 }, 172 },
174 parseFilters: function(text) 173 parseFilters: function(text)
175 { 174 {
176 if (params.filterError) 175 if (params.filterError)
177 return {errors: ["Invalid filter"]}; 176 return {errors: ["Invalid filter"]};
178 return { 177 return {
179 filters: text.split("\n").map(modules.filterClasses.Filter.fromText), 178 filters: text.split("\n").map(modules.filterClasses.Filter.fromText),
180 errors: [] 179 errors: []
181 }; 180 };
182 } 181 }
183 }; 182 };
184 183
185 modules.synchronizer = { 184 modules.synchronizer = {
186 Synchronizer: {} 185 Synchronizer: {}
187 }; 186 };
188 187
189 modules.matcher = { 188 modules.matcher = {
190 defaultMatcher: { 189 defaultMatcher: {
191 matchesAny: function(url, requestType, docDomain, thirdParty) 190 matchesAny: function(url, requestType, docDomain, thirdParty)
192 { 191 {
193 var blocked = params.blockedURLs.split(","); 192 var blocked = params.blockedURLs.split(",");
194 if (blocked.indexOf(url) >= 0) 193 if (blocked.indexOf(url) >= 0)
195 return new modules.filterClasses.BlockingFilter(); 194 return new modules.filterClasses.BlockingFilter();
196 else 195 else
197 return null; 196 return null;
198 } 197 }
198 }
199 };
200
201 modules.cssRules = {
202 CSSRules: {
203 getRulesForDomain: function(domain) { }
199 } 204 }
200 }; 205 };
201 206
202 var notifierListeners = []; 207 var notifierListeners = [];
203 modules.filterNotifier = { 208 modules.filterNotifier = {
204 FilterNotifier: { 209 FilterNotifier: {
205 addListener: function(listener) 210 addListener: function(listener)
206 { 211 {
207 if (notifierListeners.indexOf(listener) < 0) 212 if (notifierListeners.indexOf(listener) < 0)
208 notifierListeners.push(listener); 213 notifierListeners.push(listener);
(...skipping 30 matching lines...) Expand all
239 vc: { 244 vc: {
240 compare: function(v1, v2) 245 compare: function(v1, v2)
241 { 246 {
242 return parseFloat(v1) - parseFloat(v2); 247 return parseFloat(v1) - parseFloat(v2);
243 } 248 }
244 } 249 }
245 }; 250 };
246 251
247 var filters = [ 252 var filters = [
248 "@@||alternate.de^$document", 253 "@@||alternate.de^$document",
249 "@@||der.postillion.com^$document", 254 "@@||der.postillion.com^$document",
250 "@@||taz.de^$document", 255 "@@||taz.de^$document",
251 "@@||amazon.de^$document", 256 "@@||amazon.de^$document",
252 "||biglemon.am/bg_poster/banner.jpg", 257 "||biglemon.am/bg_poster/banner.jpg",
253 "winfuture.de###header_logo_link", 258 "winfuture.de###header_logo_link",
254 "###WerbungObenRechts10_GesamtDIV", 259 "###WerbungObenRechts10_GesamtDIV",
255 "###WerbungObenRechts8_GesamtDIV", 260 "###WerbungObenRechts8_GesamtDIV",
256 "###WerbungObenRechts9_GesamtDIV", 261 "###WerbungObenRechts9_GesamtDIV",
257 "###WerbungUntenLinks4_GesamtDIV", 262 "###WerbungUntenLinks4_GesamtDIV",
258 "###WerbungUntenLinks7_GesamtDIV", 263 "###WerbungUntenLinks7_GesamtDIV",
259 "###WerbungUntenLinks8_GesamtDIV", 264 "###WerbungUntenLinks8_GesamtDIV",
(...skipping 14 matching lines...) Expand all
274 "https://easylist-downloads.adblockplus.org/fanboy-social.txt", 279 "https://easylist-downloads.adblockplus.org/fanboy-social.txt",
275 "~user~786254" 280 "~user~786254"
276 ]; 281 ];
277 var knownSubscriptions = Object.create(null); 282 var knownSubscriptions = Object.create(null);
278 for (var subscriptionUrl of subscriptions) 283 for (var subscriptionUrl of subscriptions)
279 knownSubscriptions[subscriptionUrl] = modules.subscriptionClasses.Subscripti on.fromURL(subscriptionUrl); 284 knownSubscriptions[subscriptionUrl] = modules.subscriptionClasses.Subscripti on.fromURL(subscriptionUrl);
280 var customSubscription = knownSubscriptions["~user~786254"]; 285 var customSubscription = knownSubscriptions["~user~786254"];
281 286
282 global.seenDataCorruption = params.seenDataCorruption; 287 global.seenDataCorruption = params.seenDataCorruption;
283 global.filterlistsReinitialized = params.filterlistsReinitialized; 288 global.filterlistsReinitialized = params.filterlistsReinitialized;
284 289
285 if (params.addSubscription) 290 if (params.addSubscription)
286 { 291 {
287 // We don't know how long it will take for the page to fully load 292 // We don't know how long it will take for the page to fully load
288 // so we'll post the message after one second 293 // so we'll post the message after one second
289 setTimeout(function() 294 setTimeout(function()
290 { 295 {
291 window.postMessage({ 296 window.postMessage({
292 type: "message", 297 type: "message",
293 payload: { 298 payload: {
294 title: "Custom subscription", 299 title: "Custom subscription",
295 url: "http://example.com/custom.txt", 300 url: "http://example.com/custom.txt",
296 type: "add-subscription" 301 type: "add-subscription"
297 } 302 }
298 }, "*"); 303 }, "*");
299 }, 1000); 304 }, 1000);
300 } 305 }
301 })(this); 306 })(this);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld