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

Delta Between Two Patch Sets: lib/subscriptionInit.js

Issue 29805597: Issue 6699 - Support the "circumvention" filter list as default subscription (Closed) Base URL: https://hg.adblockplus.org/adblockpluschrome/
Left Patch Set: More review fixes. Created June 14, 2018, 7:59 p.m.
Right Patch Set: Use "==" instead of "in" Created June 19, 2018, 12:40 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 | « no previous file | qunit/subscriptions.xml » ('j') | 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 let matchCount = 0; 105 let matchCount = 0;
106 for (let subscription of subscriptions) 106 for (let subscription of subscriptions)
107 { 107 {
108 let prefixes = subscription.getAttribute("prefixes"); 108 let prefixes = subscription.getAttribute("prefixes");
109 let prefix = prefixes && prefixes.split(",").find( 109 let prefix = prefixes && prefixes.split(",").find(
110 lang => new RegExp("^" + lang + "\\b").test(Utils.appLocale) 110 lang => new RegExp("^" + lang + "\\b").test(Utils.appLocale)
111 ); 111 );
112 112
113 let subscriptionType = subscription.getAttribute("type"); 113 let subscriptionType = subscription.getAttribute("type");
114 114
115 if (subscriptionType in ["ads", "circumvention"] && 115 if ((subscriptionType == "ads" || subscriptionType == "circumvention") &&
Manish Jethani 2018/06/19 09:23:30 We should probably just use == here instead of the
hub 2018/06/19 12:41:14 Done.
116 !selectedItem[subscriptionType]) 116 !selectedItem[subscriptionType])
117 selectedItem[subscriptionType] = subscription; 117 selectedItem[subscriptionType] = subscription;
118 118
119 if (prefix) 119 if (prefix)
120 { 120 {
121 // The "ads" subscription is the one driving the selection. 121 // The "ads" subscription is the one driving the selection.
122 if (subscriptionType == "ads") 122 if (subscriptionType == "ads")
123 { 123 {
124 if (!selectedPrefix || selectedPrefix.length < prefix.length) 124 if (!selectedPrefix || selectedPrefix.length < prefix.length)
125 { 125 {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 * 324 *
325 * @param {function} callback 325 * @param {function} callback
326 */ 326 */
327 exports.setSubscriptionsCallback = callback => 327 exports.setSubscriptionsCallback = callback =>
328 { 328 {
329 subscriptionsCallback = callback; 329 subscriptionsCallback = callback;
330 }; 330 };
331 331
332 // Exports for tests only 332 // Exports for tests only
333 exports.chooseFilterSubscriptions = chooseFilterSubscriptions; 333 exports.chooseFilterSubscriptions = chooseFilterSubscriptions;
LEFTRIGHT

Powered by Google App Engine
This is Rietveld