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

Unified Diff: firstRun.js

Issue 4731979438227456: Issue 1663 - Emulate background page and implement proper message responder (Closed)
Patch Set: Fixed sender API Created Dec. 17, 2014, 7:37 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 | « ext/content.js ('k') | messageResponder.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firstRun.js
===================================================================
--- a/firstRun.js
+++ b/firstRun.js
@@ -247,20 +247,23 @@
{
ext.backgroundPage.sendMessage({type: "app.options"});
}
function updateToggleButtons()
{
ext.backgroundPage.sendMessage({type: "subscriptions.get"}, function(subscriptions)
{
+ var known = Object.create(null);
+ for (var i = 0; i < subscriptions.length; i++)
+ known[subscriptions[i].url] = true;
for (var i = 0; i < featureSubscriptions.length; i++)
{
var featureSubscription = featureSubscriptions[i];
- updateToggleButton(featureSubscription.feature, subscriptions.indexOf(featureSubscription.url) >= 0);
+ updateToggleButton(featureSubscription.feature, featureSubscription.url in known);
}
});
}
function updateToggleButton(feature, isEnabled)
{
var button = E("toggle-" + feature);
if (isEnabled)
« no previous file with comments | « ext/content.js ('k') | messageResponder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld