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

Unified Diff: background.js

Issue 5739851907334144: Update browser actions everytime filters are loaded or saved (Closed)
Patch Set: Created Feb. 24, 2014, 4:17 p.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 | popup.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
===================================================================
--- a/background.js
+++ b/background.js
@@ -63,6 +63,22 @@
addSubscription(prevVersion);
}
}
+
+ // update browser actions when whitelisting might have changed,
+ // due to loading filters or saving filter changes
+ if (action == "load" || action == "save")
+ {
+ ext.windows.getAll(function(windows)
+ {
+ for (var i = 0; i < windows.length; i++)
+ {
+ windows[i].getAllTabs(function(tabs)
+ {
+ tabs.forEach(refreshIconAndContextMenu);
+ });
+ }
+ });
+ }
});
// Special-case domains for which we cannot use style-based hiding rules.
@@ -401,18 +417,6 @@
}
});
-// Show icon as browser action for all tabs that already exist
-ext.windows.getAll(function(windows)
-{
- for (var i = 0; i < windows.length; i++)
- {
- windows[i].getAllTabs(function(tabs)
- {
- tabs.forEach(refreshIconAndContextMenu);
- });
- }
-});
-
// Update icon if a tab changes location
ext.tabs.onLoading.addListener(function(tab)
{
« no previous file with comments | « no previous file | popup.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld