Bug 1302468 - use UpdateUtils to determine the update channel for UITour, r=MattN
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 14 Nov 2017 15:58:17 +0000
changeset 443531 6879d23d39e816acd3325a65ec1c251c5a24ad02
parent 443530 4d1a6d34cbda3d429ce74fc56747aec25f2cf04f
child 443532 0855fc7ce11e2ae83c6eaab45c5dc8b69192d1f8
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMattN
bugs1302468
milestone59.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 1302468 - use UpdateUtils to determine the update channel for UITour, r=MattN MozReview-Commit-ID: 2FvxdWSfDLK
browser/components/uitour/UITour.jsm
browser/components/uitour/test/browser_UITour.js
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -5,42 +5,44 @@
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["UITour"];
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/AppConstants.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/TelemetryController.jsm");
 Cu.import("resource://gre/modules/Timer.jsm");
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 Cu.importGlobalProperties(["URL"]);
 
+XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
+  "resource:///modules/BrowserUITelemetry.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
+  "resource:///modules/CustomizableUI.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
+  "resource://gre/modules/FxAccounts.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
   "resource://gre/modules/LightweightThemeManager.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ResetProfile",
-  "resource://gre/modules/ResetProfile.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
-  "resource:///modules/CustomizableUI.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry",
-  "resource://gre/modules/UITelemetry.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
-  "resource:///modules/BrowserUITelemetry.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PageActions",
+  "resource:///modules/PageActions.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ProfileAge",
   "resource://gre/modules/ProfileAge.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ReaderParent",
   "resource:///modules/ReaderParent.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PageActions",
-  "resource:///modules/PageActions.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
-  "resource://gre/modules/FxAccounts.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "ResetProfile",
+  "resource://gre/modules/ResetProfile.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry",
+  "resource://gre/modules/UITelemetry.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
+  "resource://gre/modules/UpdateUtils.jsm");
 
 // See LOG_LEVELS in Console.jsm. Common examples: "All", "Info", "Warn", & "Error".
 const PREF_LOG_LEVEL      = "browser.uitour.loglevel";
 const PREF_SEENPAGEIDS    = "browser.uitour.seenPageIDs";
 
 const BACKGROUND_PAGE_ACTIONS_ALLOWED = new Set([
   "forceShowReaderIcon",
   "getConfiguration",
@@ -1615,27 +1617,28 @@ this.UITour = {
       default:
         log.error("setConfiguration: Unknown configuration requested: " + aConfiguration);
         break;
     }
   },
 
   getAppInfo(aMessageManager, aWindow, aCallbackID) {
     (async () => {
-      let props = ["defaultUpdateChannel", "version"];
-      let appinfo = {};
-      props.forEach(property => appinfo[property] = Services.appinfo[property]);
+      let appinfo = {version: Services.appinfo.version};
 
       // Identifier of the partner repack, as stored in preference "distribution.id"
       // and included in Firefox and other update pings. Note this is not the same as
       // Services.appinfo.distributionID (value of MOZ_DISTRIBUTION_ID is set at build time).
       let distribution =
           Services.prefs.getDefaultBranch("distribution.").getCharPref("id", "default");
       appinfo.distribution = distribution;
 
+      // Update channel, in a way that preserves 'beta' for RC beta builds:
+      appinfo.defaultUpdateChannel = UpdateUtils.getUpdateChannel(false /* no partner ID */);
+
       let isDefaultBrowser = null;
       try {
         let shell = aWindow.getShellService();
         if (shell) {
           isDefaultBrowser = shell.isDefaultBrowser(false);
         }
       } catch (e) {}
       appinfo.defaultBrowser = isDefaultBrowser;
--- a/browser/components/uitour/test/browser_UITour.js
+++ b/browser/components/uitour/test/browser_UITour.js
@@ -4,16 +4,17 @@
 "use strict";
 
 var gTestTab;
 var gContentAPI;
 var gContentWindow;
 
 Components.utils.import("resource://testing-common/TelemetryArchiveTesting.jsm", this);
 Components.utils.import("resource://gre/modules/ProfileAge.jsm", this);
+Components.utils.import("resource://gre/modules/UpdateUtils.jsm", this);
 
 
 function test() {
   UITourTest();
 }
 
 var tests = [
   function test_untrusted_host(done) {
@@ -286,21 +287,19 @@ var tests = [
     is(popup.popupBoxObject.anchorNode, document.getElementById("searchbar"), "Popup should be anchored to the searchbar");
     is(title.textContent, "search title", "Popup should have correct title");
     is(desc.textContent, "search text", "Popup should have correct description text");
 
     await SpecialPowers.popPrefEnv();
   }),
   function test_getConfigurationVersion(done) {
     function callback(result) {
-      let props = ["defaultUpdateChannel", "version"];
-      for (let property of props) {
-        ok(typeof(result[property]) !== "undefined", "Check " + property + " isn't undefined.");
-        is(result[property], Services.appinfo[property], "Should have the same " + property + " property.");
-      }
+      ok(typeof result.version !== "undefined", "Check version isn't undefined.");
+      is(result.version, Services.appinfo.version, "Should have the same version property.");
+      is(result.defaultUpdateChannel, UpdateUtils.getUpdateChannel(false), "Should have the correct update channel.");
       done();
     }
 
     gContentAPI.getConfiguration("appinfo", callback);
   },
   function test_getConfigurationDistribution(done) {
     gContentAPI.getConfiguration("appinfo", (result) => {
       ok(typeof(result.distribution) !== "undefined", "Check distribution isn't undefined.");