Backed out changeset 5ce62f7e6633 (bug 1343510) for eslint and browser_UITour_defaultBrowser.js failures
authorPhil Ringnalda <philringnalda@gmail.com>
Mon, 26 Jun 2017 18:53:09 -0700
changeset 366098 55f9e6931cbbc39bf3b66a69ab7b58d18369cc84
parent 366097 4961b6529b1a7e30daba766b3dc96614322fedfe
child 366099 8cfe015562d688e076b0688c830028a7cbb9c538
push id45495
push userphilringnalda@gmail.com
push dateTue, 27 Jun 2017 01:53:17 +0000
treeherderautoland@55f9e6931cbb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1343510
milestone56.0a1
backs out5ce62f7e6633a7ac2fbff0c103d3b58b5ccb5b27
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
Backed out changeset 5ce62f7e6633 (bug 1343510) for eslint and browser_UITour_defaultBrowser.js failures MozReview-Commit-ID: GWQWnQ1ztKM
browser/components/uitour/UITour-lib.js
browser/components/uitour/UITour.jsm
browser/components/uitour/test/browser_UITour.js
--- a/browser/components/uitour/UITour-lib.js
+++ b/browser/components/uitour/UITour-lib.js
@@ -476,23 +476,16 @@ if (typeof Mozilla == "undefined") {
    *                                                        without user interaction.
    * @property {Boolean} defaultBrowser - Whether the application is the default browser. Since Fx40.
    * @property {String} defaultUpdateChannel - Update channel e.g. 'release', 'beta', 'aurora',
    *                                           'nightly', 'default'
    *                                           (self-built or automated testing builds)
    * @property {String} distribution - Contains the distributionId property. This value will be
    *                                   "default" in most cases but can differ for repack or
    *                                   funnelcake builds. Since Fx48
-   * @property {Number} profileCreatedWeeksAgo - The number of weeks since the profile was created,
-   *                                             starting from 0 for profiles dating less than
-   *                                             seven days old. Since Fx56.
-   * @property {Number} profileResetWeeksAgo - The number of weeks since the profile was last reset,
-   *                                           starting from 0 for profiles reset less than seven
-   *                                           days ago. If the profile has never been reset it
-   *                                           returns null. Since Fx56.
    * @property {String} version - Version string e.g. "48.0a2"
    * @since 35
    */
 
   /**
    * @summary Search service configuration.
    *
    * @description From version 34 through 42 inclusive, a string was returned for the 'selectedSearchEngine'
--- a/browser/components/uitour/UITour.jsm
+++ b/browser/components/uitour/UITour.jsm
@@ -24,18 +24,16 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 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, "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ProfileAge",
-  "resource://gre/modules/ProfileAge.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "ReaderParent",
   "resource:///modules/ReaderParent.jsm");
 
 XPCOMUtils.defineLazyPreferenceGetter(this, "gPhotonStructure", "browser.photon.structure.enabled");
 
 // 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";
@@ -1480,17 +1478,53 @@ this.UITour = {
     aPanel.hidden = true;
     aPanel.clientWidth; // flush
     aPanel.hidden = false;
   },
 
   getConfiguration(aMessageManager, aWindow, aConfiguration, aCallbackID) {
     switch (aConfiguration) {
       case "appinfo":
-        this.getAppInfo(aMessageManager, aWindow, aCallbackID);
+        let props = ["defaultUpdateChannel", "version"];
+        let appinfo = {};
+        props.forEach(property => appinfo[property] = Services.appinfo[property]);
+
+        // 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;
+
+        let isDefaultBrowser = null;
+        try {
+          let shell = aWindow.getShellService();
+          if (shell) {
+            isDefaultBrowser = shell.isDefaultBrowser(false);
+          }
+        } catch (e) {}
+        appinfo["defaultBrowser"] = isDefaultBrowser;
+
+        let canSetDefaultBrowserInBackground = true;
+        if (AppConstants.isPlatformAndVersionAtLeast("win", "6.2") ||
+            AppConstants.isPlatformAndVersionAtLeast("macosx", "10.10")) {
+          canSetDefaultBrowserInBackground = false;
+        } else if (AppConstants.platform == "linux") {
+          // The ShellService may not exist on some versions of Linux.
+          try {
+            aWindow.getShellService();
+          } catch (e) {
+            canSetDefaultBrowserInBackground = null;
+          }
+        }
+
+        appinfo["canSetDefaultBrowserInBackground"] =
+          canSetDefaultBrowserInBackground;
+
+        this.sendPageCallback(aMessageManager, aCallbackID, appinfo);
         break;
       case "availableTargets":
         this.getAvailableTargets(aMessageManager, aWindow, aCallbackID);
         break;
       case "search":
       case "selectedSearchEngine":
         Services.search.init(rv => {
           let data;
@@ -1537,74 +1571,16 @@ this.UITour = {
         } catch (e) {}
         break;
       default:
         log.error("setConfiguration: Unknown configuration requested: " + aConfiguration);
         break;
     }
   },
 
-  getAppInfo(aMessageManager, aChromeWindow, aCallbackID) {
-    (async() => {
-      let props = ["defaultUpdateChannel", "version"];
-      let appinfo = {};
-      props.forEach(property => appinfo[property] = Services.appinfo[property]);
-
-      // 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;
-
-      let isDefaultBrowser = null;
-      try {
-        let shell = aWindow.getShellService();
-        if (shell) {
-          isDefaultBrowser = shell.isDefaultBrowser(false);
-        }
-      } catch (e) {}
-      appinfo["defaultBrowser"] = isDefaultBrowser;
-
-      let canSetDefaultBrowserInBackground = true;
-      if (AppConstants.isPlatformAndVersionAtLeast("win", "6.2") ||
-          AppConstants.isPlatformAndVersionAtLeast("macosx", "10.10")) {
-        canSetDefaultBrowserInBackground = false;
-      } else if (AppConstants.platform == "linux") {
-        // The ShellService may not exist on some versions of Linux.
-        try {
-          aWindow.getShellService();
-        } catch (e) {
-          canSetDefaultBrowserInBackground = null;
-        }
-      }
-
-      appinfo["canSetDefaultBrowserInBackground"] =
-        canSetDefaultBrowserInBackground;
-
-      // Expose Profile creation and last reset dates in weeks.
-      const ONE_WEEK = 7 * 24 * 60 * 60 * 1000;
-      let profileAge = new ProfileAge(null, null);
-      let createdDate = await profileAge.created;
-      let resetDate = await profileAge.reset;
-      let createdWeeksAgo = Math.floor((Date.now() - createdDate) / ONE_WEEK);
-      let resetWeeksAgo = null;
-      if (resetDate) {
-        resetWeeksAgo = Math.floor((Date.now() - resetDate) / ONE_WEEK);
-      }
-      appinfo["profileCreatedWeeksAgo"] = createdWeeksAgo;
-      appinfo["profileResetWeeksAgo"] = resetWeeksAgo;
-
-      this.sendPageCallback(aMessageManager, aCallbackID, appinfo);
-    })().catch(err => {
-      log.error(err);
-      this.sendPageCallback(aMessageManager, aCallbackID, {});
-    })
-  },
-
   getAvailableTargets(aMessageManager, aChromeWindow, aCallbackID) {
     (async () => {
       let window = aChromeWindow;
       let data = this.availableTargetsCache.get(window);
       if (data) {
         log.debug("getAvailableTargets: Using cached targets list", data.targets.join(","));
         this.sendPageCallback(aMessageManager, aCallbackID, data);
         return;
--- a/browser/components/uitour/test/browser_UITour.js
+++ b/browser/components/uitour/test/browser_UITour.js
@@ -3,18 +3,16 @@
 
 "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);
-
 
 function test() {
   UITourTest();
 }
 
 var tests = [
   function test_untrusted_host(done) {
     loadUITourTestPage(function() {
@@ -300,31 +298,16 @@ var tests = [
       gContentAPI.getConfiguration("appinfo", (result2) => {
         ok(typeof(result2.distribution) !== "undefined", "Check distribution isn't undefined.");
         is(result2.distribution, testDistributionID, "Should have the distribution as set in preference.");
 
         done();
       });
     });
   },
-  function test_getConfigurationProfileAge(done) {
-    gContentAPI.getConfiguration("appinfo", (result) => {
-      ok(typeof(result.profileCreatedWeeksAgo) === "number", "profileCreatedWeeksAgo should be number.");
-      ok(result.profileResetWeeksAgo === null, "profileResetWeeksAgo should be null.");
-
-      // Set profile reset date to 15 days ago.
-      let profileAccessor = new ProfileAge();
-      profileAccessor.recordProfileReset(Date.now() - (15 * 24 * 60 * 60 * 1000));
-      gContentAPI.getConfiguration("appinfo", (result2) => {
-        ok(typeof(result2.profileResetWeeksAgo) === "number", "profileResetWeeksAgo should be number.");
-        is(result2.profileResetWeeksAgo, 2, "profileResetWeeksAgo should be 2.");
-        done();
-      });
-    });
-  },
   function test_addToolbarButton(done) {
     let placement = CustomizableUI.getPlacementOfWidget("panic-button");
     is(placement, null, "default UI has panic button in the palette");
 
     gContentAPI.getConfiguration("availableTargets", (data) => {
       let available = (data.targets.indexOf("forget") != -1);
       ok(!available, "Forget button should not be available by default");