Bug 1115153 - Loop: Create API to allow web to retrieve the loop.gettingStarted.seen pref. r=MattN
authorJared Wein <jwein@mozilla.com>
Thu, 29 Jan 2015 13:08:08 -0500
changeset 226636 2bb76f992d1e198bb163dd1ca62acd160658cda8
parent 226635 65f735ba947e4ea0fe0fd47f944270b2ebe468c1
child 226637 4f22f76a622daa8af4f39da526540bec87a7e50b
push id28202
push userkwierso@gmail.com
push dateThu, 29 Jan 2015 23:27:24 +0000
treeherdermozilla-central@29b05d283b00 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1115153
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1115153 - Loop: Create API to allow web to retrieve the loop.gettingStarted.seen pref. r=MattN
browser/components/uitour/UITour.jsm
browser/components/uitour/test/browser_UITour_loop.js
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -1554,43 +1554,48 @@ this.UITour = {
       owner: aWindow.gBrowser.selectedTab,
       relatedToCurrent: true
     });
     aWindow.gBrowser.selectedTab = tab;
   },
 
   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;
           if (Components.isSuccessCode(rv)) {
             engine = Services.search.defaultEngine;
           } else {
             engine = { identifier: "" };
           }
           this.sendPageCallback(aMessageManager, aCallbackID, {
             searchEngineIdentifier: engine.identifier
           });
         });
         break;
+      case "sync":
+        this.sendPageCallback(aMessageManager, aCallbackID, {
+          setup: Services.prefs.prefHasUserValue("services.sync.username"),
+        });
+        break;
       default:
         log.error("getConfiguration: Unknown configuration requested: " + aConfiguration);
         break;
     }
   },
 
   setConfiguration: function(aConfiguration, aValue) {
     switch (aConfiguration) {
--- a/browser/components/uitour/test/browser_UITour_loop.js
+++ b/browser/components/uitour/test/browser_UITour_loop.js
@@ -55,16 +55,24 @@ let tests = [
     gContentAPI.showMenu("loop");
     gContentAPI.getConfiguration("availableTargets", (data) => {
       for (let targetName of ["loop-newRoom", "loop-roomList", "loop-signInUpLink"]) {
         isnot(data.targets.indexOf(targetName), -1, targetName + " should exist");
       }
       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");
 
     gContentAPI.showMenu("loop", function menuCallback() {
       gContentAPI.showHighlight("loop-roomList");
       gContentAPI.showInfo("loop-newRoom", "Make a new room", "AKA. conversation");
       UITour.getTarget(window, "loop-newRoom").then((target) => {