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

Side by Side Diff: chrome/content/ui/sidebar.js

Issue 29361127: Issue 4587 - Blockable items list calls reloadDisabledFilters() unnecessarily often (Closed) Base URL: https://hg.adblockplus.org/adblockplus
Patch Set: Created Oct. 31, 2016, 9:18 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 for (let attr in defaults) 87 for (let attr in defaults)
88 if (!wnd.hasAttribute(attr)) 88 if (!wnd.hasAttribute(attr))
89 wnd.setAttribute(attr, defaults[attr]); 89 wnd.setAttribute(attr, defaults[attr]);
90 } 90 }
91 91
92 let {addBrowserLocationListener} = require("appSupport"); 92 let {addBrowserLocationListener} = require("appSupport");
93 updateContentLocation(); 93 updateContentLocation();
94 94
95 // Initialize matcher for disabled filters 95 // Initialize matcher for disabled filters
96 reloadDisabledFilters(); 96 reloadDisabledFilters();
97 FilterNotifier.addListener(reloadDisabledFilters); 97 FilterNotifier.on("subscription.added", reloadDisabledFilters);
98 FilterNotifier.on("subscription.removed", reloadDisabledFilters);
99 FilterNotifier.on("subscription.disabled", reloadDisabledFilters);
100 FilterNotifier.on("subscription.updated", reloadDisabledFilters);
101 FilterNotifier.on("filter.added", reloadDisabledFilters);
102 FilterNotifier.on("filter.removed", reloadDisabledFilters);
103 FilterNotifier.on("filter.disabled", reloadDisabledFilters);
98 Prefs.addListener(onPrefChange); 104 Prefs.addListener(onPrefChange);
99 105
100 // Activate flasher 106 // Activate flasher
101 list.addEventListener("select", onSelectionChange, false); 107 list.addEventListener("select", onSelectionChange, false);
102 108
103 // Initialize data 109 // Initialize data
104 handleLocationChange(); 110 handleLocationChange();
105 111
106 // Install a progress listener to catch location changes 112 // Install a progress listener to catch location changes
107 if (addBrowserLocationListener) 113 if (addBrowserLocationListener)
(...skipping 30 matching lines...) Expand all
138 { 144 {
139 if ("filter" in item && item.filter) 145 if ("filter" in item && item.filter)
140 return Filter.fromText(item.filter); 146 return Filter.fromText(item.filter);
141 else 147 else
142 return null; 148 return null;
143 } 149 }
144 150
145 // To be called on unload 151 // To be called on unload
146 function cleanUp() { 152 function cleanUp() {
147 requestNotifier.shutdown(); 153 requestNotifier.shutdown();
148 FilterNotifier.removeListener(reloadDisabledFilters); 154 FilterNotifier.off("subscription.added", reloadDisabledFilters);
155 FilterNotifier.off("subscription.removed", reloadDisabledFilters);
156 FilterNotifier.off("subscription.disabled", reloadDisabledFilters);
157 FilterNotifier.off("subscription.updated", reloadDisabledFilters);
158 FilterNotifier.off("filter.added", reloadDisabledFilters);
159 FilterNotifier.off("filter.removed", reloadDisabledFilters);
160 FilterNotifier.off("filter.disabled", reloadDisabledFilters);
149 Prefs.removeListener(onPrefChange); 161 Prefs.removeListener(onPrefChange);
150 E("list").view = null; 162 E("list").view = null;
151 163
152 let {removeBrowserLocationListener} = require("appSupport"); 164 let {removeBrowserLocationListener} = require("appSupport");
153 if (removeBrowserLocationListener) 165 if (removeBrowserLocationListener)
154 removeBrowserLocationListener(mainWin, handleLocationChange); 166 removeBrowserLocationListener(mainWin, handleLocationChange);
155 mainWin.removeEventListener("unload", mainUnload, false); 167 mainWin.removeEventListener("unload", mainUnload, false);
156 } 168 }
157 169
158 /** 170 /**
(...skipping 1157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 return {tooltip: this.itemsDummyTooltip}; 1328 return {tooltip: this.itemsDummyTooltip};
1317 }, 1329 },
1318 1330
1319 invalidateItem: function(item) 1331 invalidateItem: function(item)
1320 { 1332 {
1321 let row = this.data.indexOf(item); 1333 let row = this.data.indexOf(item);
1322 if (row >= 0) 1334 if (row >= 0)
1323 this.boxObject.invalidateRow(row); 1335 this.boxObject.invalidateRow(row);
1324 } 1336 }
1325 } 1337 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld