Bug 1576507 - skip ClientEnvironment entries unavailable on first run r=mythmon
☠☠ backed out by 2da8982d97aa ☠ ☠
authorRobert Helmer <rhelmer@mozilla.com>
Fri, 30 Aug 2019 23:20:24 +0000
changeset 554732 f16714d49101f2e80daeacbe4f38d74fa0a5cf7d
parent 554731 2d621070f778e4998b7efab944e4e9fb45e84862
child 554733 2238ba5cec98f76011ba7b53a019124b7d048e70
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmythmon
bugs1576507
milestone70.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 1576507 - skip ClientEnvironment entries unavailable on first run r=mythmon Differential Revision: https://phabricator.services.mozilla.com/D43570
toolkit/components/utils/ClientEnvironment.jsm
--- a/toolkit/components/utils/ClientEnvironment.jsm
+++ b/toolkit/components/utils/ClientEnvironment.jsm
@@ -31,16 +31,21 @@ ChromeUtils.defineModuleGetter(
   "UpdateUtils",
   "resource://gre/modules/UpdateUtils.jsm"
 );
 ChromeUtils.defineModuleGetter(
   this,
   "AppConstants",
   "resource://gre/modules/AppConstants.jsm"
 );
+ChromeUtils.defineModuleGetter(
+  this,
+  "FirstStartup",
+  "resource://gre/modules/FirstStartup.jsm"
+);
 
 var EXPORTED_SYMBOLS = ["ClientEnvironmentBase"];
 
 /**
  * Create an object that provides general information about the client application.
  *
  * Components like Normandy RecipeRunner use this as part of the context for filter expressions,
  * so avoid adding non-getter functions as attributes, as filter expressions
@@ -91,16 +96,21 @@ class ClientEnvironmentBase {
     return UpdateUtils.getUpdateChannel(false);
   }
 
   static get isDefaultBrowser() {
     return ShellService.isDefaultBrowser();
   }
 
   static get searchEngine() {
+    // Telemetry Environment is not available in early first-startup.
+    if (FirstStartup.state === FirstStartup.IN_PROGRESS) {
+      return undefined;
+    }
+
     return (async () => {
       await TelemetryEnvironment.onInitialized();
       return TelemetryEnvironment.currentEnvironment.settings
         .defaultSearchEngine;
     })();
   }
 
   static get syncSetup() {
@@ -159,16 +169,21 @@ class ClientEnvironmentBase {
   static get doNotTrack() {
     return Services.prefs.getBoolPref(
       "privacy.donottrackheader.enabled",
       false
     );
   }
 
   static get os() {
+    // Telemetry Environment is not available in early first-startup.
+    if (FirstStartup.state === FirstStartup.IN_PROGRESS) {
+      return undefined;
+    }
+
     function coerceToNumber(version) {
       const parts = version.split(".");
       return parseFloat(parts.slice(0, 2).join("."));
     }
 
     return (async () => {
       await TelemetryEnvironment.onInitialized();