From 0c7b83192336fbd24620628a46a92204f6afe746 Mon Sep 17 00:00:00 2001 From: Jared Wein Date: Thu, 29 Jan 2015 13:08:08 -0500 Subject: [PATCH] Bug 1115153 - Loop: Create API to allow web to retrieve the loop.gettingStarted.seen pref. r=MattN --- browser/components/uitour/UITour.jsm | 21 ++++++++++++------- .../uitour/test/browser_UITour_loop.js | 8 +++++++ 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/browser/components/uitour/UITour.jsm b/browser/components/uitour/UITour.jsm index 00caf1491291..9737ded28eaa 100644 --- a/browser/components/uitour/UITour.jsm +++ b/browser/components/uitour/UITour.jsm @@ -1559,20 +1559,20 @@ this.UITour = { getConfiguration: function(aMessageManager, aWindow, aConfiguration, aCallbackID) { switch (aConfiguration) { - case "availableTargets": - this.getAvailableTargets(aMessageManager, aWindow, aCallbackID); - break; - case "sync": - this.sendPageCallback(aMessageManager, aCallbackID, { - setup: Services.prefs.prefHasUserValue("services.sync.username"), - }); - break; case "appinfo": let props = ["defaultUpdateChannel", "version"]; let appinfo = {}; props.forEach(property => appinfo[property] = Services.appinfo[property]); this.sendPageCallback(aMessageManager, aCallbackID, appinfo); break; + case "availableTargets": + this.getAvailableTargets(aMessageManager, aWindow, aCallbackID); + break; + case "loop": + this.sendPageCallback(aMessageManager, aCallbackID, { + gettingStartedSeen: Services.prefs.getBoolPref("loop.gettingStarted.seen"), + }); + break; case "selectedSearchEngine": Services.search.init(rv => { let engine; @@ -1586,6 +1586,11 @@ this.UITour = { }); }); break; + case "sync": + this.sendPageCallback(aMessageManager, aCallbackID, { + setup: Services.prefs.prefHasUserValue("services.sync.username"), + }); + break; default: log.error("getConfiguration: Unknown configuration requested: " + aConfiguration); break; diff --git a/browser/components/uitour/test/browser_UITour_loop.js b/browser/components/uitour/test/browser_UITour_loop.js index 284cd5fbb575..d2372632279f 100644 --- a/browser/components/uitour/test/browser_UITour_loop.js +++ b/browser/components/uitour/test/browser_UITour_loop.js @@ -60,6 +60,14 @@ let tests = [ done(); }); }, + function test_getConfigurationLoop(done) { + let gettingStartedSeen = Services.prefs.getBoolPref("loop.gettingStarted.seen"); + gContentAPI.getConfiguration("loop", (data) => { + is(data.gettingStartedSeen, gettingStartedSeen, + "The configuration property should equal that of the pref"); + done(); + }); + }, function test_hideMenuHidesAnnotations(done) { let infoPanel = document.getElementById("UITourTooltip"); let highlightPanel = document.getElementById("UITourHighlightContainer");