Bug 1115153 - Loop: Create API to allow web to retrieve the loop.gettingStarted.seen pref. r=MattN, a=sledru
authorJared Wein <jwein@mozilla.com>
Thu, 29 Jan 2015 13:08:08 -0500
changeset 243689 5690b3943d75
parent 243688 756c22d18cdf
child 243690 e7fd0d7ff120
push id4436
push usermozilla@noorenberghe.ca
push date2015-02-05 02:33 +0000
treeherdermozilla-beta@5690b3943d75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN, sledru
bugs1115153
milestone36.0
Bug 1115153 - Loop: Create API to allow web to retrieve the loop.gettingStarted.seen pref. r=MattN, a=sledru
browser/modules/UITour.jsm
browser/modules/test/browser_UITour_loop.js
--- a/browser/modules/UITour.jsm
+++ b/browser/modules/UITour.jsm
@@ -1402,43 +1402,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/modules/test/browser_UITour_loop.js
+++ b/browser/modules/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) => {