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

Delta Between Two Patch Sets: js/desktop-options.js

Issue 29712599: Issue 6420 - Fixed poping up whitelisted website notification for several custom filter lists (Closed)
Left Patch Set: Addressed Thomas's comment Created March 2, 2018, 3:58 p.m.
Right Patch Set: Created March 5, 2018, 8:26 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
« ext/content.js ('K') | « ext/content.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 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 for (let property in collections) 1139 for (let property in collections)
1140 collections[property].clearAll(); 1140 collections[property].clearAll();
1141 1141
1142 setCustomFiltersView("empty"); 1142 setCustomFiltersView("empty");
1143 browser.runtime.sendMessage({ 1143 browser.runtime.sendMessage({
1144 type: "subscriptions.get", 1144 type: "subscriptions.get",
1145 special: true 1145 special: true
1146 }, 1146 },
1147 (subscriptions) => 1147 (subscriptions) =>
1148 { 1148 {
1149 // Load filters 1149 let customFilterPromises = subscriptions.map(getSubscriptionFilters);
1150 for (let subscription of subscriptions) 1150 Promise.all(customFilterPromises).then((filters) =>
1151 { 1151 {
1152 browser.runtime.sendMessage({ 1152 loadCustomFilters([].concat(...filters));
1153 type: "filters.get", 1153 isCustomFiltersLoaded = true;
1154 subscriptionUrl: subscription.url 1154 });
1155 },
1156 (filters) =>
1157 {
1158 // Reset each time as there might be several custom filters
1159 if (isCustomFiltersLoaded)
1160 isCustomFiltersLoaded = false;
1161
1162 loadCustomFilters(filters);
1163 isCustomFiltersLoaded = true;
1164 });
1165 }
1166 }); 1155 });
1167 loadRecommendations(); 1156 loadRecommendations();
1168 browser.runtime.sendMessage({ 1157 browser.runtime.sendMessage({
1169 type: "prefs.get", 1158 type: "prefs.get",
1170 key: "subscriptions_exceptionsurl" 1159 key: "subscriptions_exceptionsurl"
1171 }, 1160 },
1172 (url) => 1161 (url) =>
1173 { 1162 {
1174 acceptableAdsUrl = url; 1163 acceptableAdsUrl = url;
1175 1164
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
1330 else 1319 else
1331 { 1320 {
1332 collections.more.removeItem(subscription); 1321 collections.more.removeItem(subscription);
1333 } 1322 }
1334 } 1323 }
1335 1324
1336 collections.filterLists.removeItem(subscription); 1325 collections.filterLists.removeItem(subscription);
1337 setPrivacyConflict(); 1326 setPrivacyConflict();
1338 break; 1327 break;
1339 } 1328 }
1329 }
1330
1331 function getSubscriptionFilters(subscription)
1332 {
1333 return browser.runtime.sendMessage({
1334 type: "filters.get",
1335 subscriptionUrl: subscription.url});
1340 } 1336 }
1341 1337
1342 function hidePref(key, value) 1338 function hidePref(key, value)
1343 { 1339 {
1344 let element = document.querySelector("[data-pref='" + key + "']"); 1340 let element = document.querySelector("[data-pref='" + key + "']");
1345 if (element) 1341 if (element)
1346 element.setAttribute("aria-hidden", value); 1342 element.setAttribute("aria-hidden", value);
1347 } 1343 }
1348 1344
1349 function getPref(key, callback) 1345 function getPref(key, callback)
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 "ui_warn_tracking"] 1465 "ui_warn_tracking"]
1470 }); 1466 });
1471 browser.runtime.sendMessage({ 1467 browser.runtime.sendMessage({
1472 type: "subscriptions.listen", 1468 type: "subscriptions.listen",
1473 filter: ["added", "disabled", "homepage", "lastDownload", "removed", 1469 filter: ["added", "disabled", "homepage", "lastDownload", "removed",
1474 "title", "downloadStatus", "downloading"] 1470 "title", "downloadStatus", "downloading"]
1475 }); 1471 });
1476 1472
1477 window.addEventListener("DOMContentLoaded", onDOMLoaded, false); 1473 window.addEventListener("DOMContentLoaded", onDOMLoaded, false);
1478 window.addEventListener("hashchange", onHashChange, false); 1474 window.addEventListener("hashchange", onHashChange, false);
LEFTRIGHT

Powered by Google App Engine
This is Rietveld