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

Delta Between Two Patch Sets: lib/subscriptionInit.js

Issue 29827646: Issue 6783 - opt-in to anti circumvention filter list on upgrade (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: Updated comments Created July 16, 2018, 3:49 p.m.
Right Patch Set: Change the name of the preference key Created July 17, 2018, 2:29 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 | « lib/prefs.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-present eyeo GmbH 3 * Copyright (C) 2006-present 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 let antiAdblockSubscription = Subscription.fromURL( 205 let antiAdblockSubscription = Subscription.fromURL(
206 Prefs.subscriptions_antiadblockurl 206 Prefs.subscriptions_antiadblockurl
207 ); 207 );
208 antiAdblockSubscription.disabled = true; 208 antiAdblockSubscription.disabled = true;
209 subscriptions.push(antiAdblockSubscription); 209 subscriptions.push(antiAdblockSubscription);
210 } 210 }
211 } 211 }
212 212
213 // Add default ad blocking subscriptions (e.g. EasyList, Anti-Circumvention) 213 // Add default ad blocking subscriptions (e.g. EasyList, Anti-Circumvention)
214 let addDefaultSubscription = shouldAddDefaultSubscriptions(); 214 let addDefaultSubscription = shouldAddDefaultSubscriptions();
215 if (addDefaultSubscription || !Prefs.subscriptions_checkedanticv) 215 if (addDefaultSubscription || !Prefs.subscriptions_addedanticv)
216 { 216 {
217 return fetch("subscriptions.xml") 217 return fetch("subscriptions.xml")
218 .then(response => response.text()) 218 .then(response => response.text())
219 .then(text => 219 .then(text =>
220 { 220 {
221 let doc = new DOMParser().parseFromString(text, "application/xml"); 221 let doc = new DOMParser().parseFromString(text, "application/xml");
222 let nodes = doc.getElementsByTagName("subscription"); 222 let nodes = doc.getElementsByTagName("subscription");
223 223
224 let defaultSubscriptions = chooseFilterSubscriptions(nodes); 224 let defaultSubscriptions = chooseFilterSubscriptions(nodes);
225 if (defaultSubscriptions) 225 if (defaultSubscriptions)
(...skipping 13 matching lines...) Expand all
239 if (!addDefaultSubscription && type != "circumvention") 239 if (!addDefaultSubscription && type != "circumvention")
240 continue; 240 continue;
241 241
242 let subscription = Subscription.fromURL(url); 242 let subscription = Subscription.fromURL(url);
243 subscription.disabled = false; 243 subscription.disabled = false;
244 subscription.title = node.getAttribute("title"); 244 subscription.title = node.getAttribute("title");
245 subscription.homepage = node.getAttribute("homepage"); 245 subscription.homepage = node.getAttribute("homepage");
246 subscription.type = type; 246 subscription.type = type;
247 subscriptions.push(subscription); 247 subscriptions.push(subscription);
248 if (subscription.type == "circumvention") 248 if (subscription.type == "circumvention")
249 Prefs.subscriptions_checkedanticv = true; 249 Prefs.subscriptions_addedanticv = true;
kzar 2018/07/16 16:37:47 Nit: Maybe "added" instead of "checked" in the pre
hub 2018/07/16 19:07:35 I use "checked" because the code checked it and to
kzar 2018/07/17 10:32:32 Up to you.
hub 2018/07/17 14:29:28 Changed it.
250 } 250 }
251 } 251 }
252 } 252 }
253 253
254 return subscriptions; 254 return subscriptions;
255 }); 255 });
256 } 256 }
257 257
258 return subscriptions; 258 return subscriptions;
259 } 259 }
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 * 333 *
334 * @param {function} callback 334 * @param {function} callback
335 */ 335 */
336 exports.setSubscriptionsCallback = callback => 336 exports.setSubscriptionsCallback = callback =>
337 { 337 {
338 subscriptionsCallback = callback; 338 subscriptionsCallback = callback;
339 }; 339 };
340 340
341 // Exports for tests only 341 // Exports for tests only
342 exports.chooseFilterSubscriptions = chooseFilterSubscriptions; 342 exports.chooseFilterSubscriptions = chooseFilterSubscriptions;
LEFTRIGHT
« lib/prefs.js ('k') | no next file » | Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Toggle Comments ('s')

Powered by Google App Engine
This is Rietveld