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: Using Services.vc Created Dec. 19, 2014, 5:45 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') | messageResponder.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: firstRun.js
===================================================================
--- a/firstRun.js
+++ b/firstRun.js
@@ -251,20 +251,23 @@
function updateToggleButtons()
{
ext.backgroundPage.sendMessage({
type: "subscriptions.get",
downloadable: true,
ignoreDisabled: true
}, 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') | messageResponder.js » ('J')

Powered by Google App Engine
This is Rietveld