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

Unified 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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/ui/sidebar.js
===================================================================
--- a/chrome/content/ui/sidebar.js
+++ b/chrome/content/ui/sidebar.js
@@ -89,17 +89,23 @@ function init() {
wnd.setAttribute(attr, defaults[attr]);
}
let {addBrowserLocationListener} = require("appSupport");
updateContentLocation();
// Initialize matcher for disabled filters
reloadDisabledFilters();
- FilterNotifier.addListener(reloadDisabledFilters);
+ FilterNotifier.on("subscription.added", reloadDisabledFilters);
+ FilterNotifier.on("subscription.removed", reloadDisabledFilters);
+ FilterNotifier.on("subscription.disabled", reloadDisabledFilters);
+ FilterNotifier.on("subscription.updated", reloadDisabledFilters);
+ FilterNotifier.on("filter.added", reloadDisabledFilters);
+ FilterNotifier.on("filter.removed", reloadDisabledFilters);
+ FilterNotifier.on("filter.disabled", reloadDisabledFilters);
Prefs.addListener(onPrefChange);
// Activate flasher
list.addEventListener("select", onSelectionChange, false);
// Initialize data
handleLocationChange();
@@ -140,17 +146,23 @@ function getFilter(item)
return Filter.fromText(item.filter);
else
return null;
}
// To be called on unload
function cleanUp() {
requestNotifier.shutdown();
- FilterNotifier.removeListener(reloadDisabledFilters);
+ FilterNotifier.off("subscription.added", reloadDisabledFilters);
+ FilterNotifier.off("subscription.removed", reloadDisabledFilters);
+ FilterNotifier.off("subscription.disabled", reloadDisabledFilters);
+ FilterNotifier.off("subscription.updated", reloadDisabledFilters);
+ FilterNotifier.off("filter.added", reloadDisabledFilters);
+ FilterNotifier.off("filter.removed", reloadDisabledFilters);
+ FilterNotifier.off("filter.disabled", reloadDisabledFilters);
Prefs.removeListener(onPrefChange);
E("list").view = null;
let {removeBrowserLocationListener} = require("appSupport");
if (removeBrowserLocationListener)
removeBrowserLocationListener(mainWin, handleLocationChange);
mainWin.removeEventListener("unload", mainUnload, false);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld