Backed out changeset 3b9509ef04d0 (bug 1385177) on suspicion of causing exceptions in browser-chrome tests and connections in wpt tests. r=backout on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Fri, 28 Jul 2017 20:54:12 +0200
changeset 422803 50ce68c9412ce80cf4bf4f1dc4be9f3c7fcd0c6d
parent 422802 36611b4b489aff826d58b654f035c89bf73ec615
child 422804 3b56ac96c918e042194781d0021f5f243babc5e7
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1385177
milestone56.0a1
backs out3b9509ef04d0c8e87a59aa1b03e4a0beca12f1dc
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 3b9509ef04d0 (bug 1385177) on suspicion of causing exceptions in browser-chrome tests and connections in wpt tests. r=backout on a CLOSED TREE
browser/extensions/shield-recipe-client/lib/ShieldRecipeClient.jsm
browser/extensions/shield-recipe-client/test/browser/browser_ClientEnvironment.js
--- a/browser/extensions/shield-recipe-client/lib/ShieldRecipeClient.jsm
+++ b/browser/extensions/shield-recipe-client/lib/ShieldRecipeClient.jsm
@@ -37,16 +37,17 @@ const DEFAULT_PREFS = {
   enabled: true,
   startup_delay_seconds: 300,
   "logging.level": Log.Level.Warn,
   user_id: "",
   run_interval_seconds: 86400, // 24 hours
   first_run: true,
 };
 const PREF_DEV_MODE = "extensions.shield-recipe-client.dev_mode";
+const PREF_SELF_SUPPORT_ENABLED = "browser.selfsupport.enabled";
 const PREF_LOGGING_LEVEL = PREF_BRANCH + "logging.level";
 
 let log = null;
 
 /**
  * Handles startup and shutdown of the entire add-on. Bootsrap.js defers to this
  * module for most tasks so that we can more easily test startup and shutdown
  * (bootstrap.js is difficult to import in tests).
@@ -58,29 +59,44 @@ this.ShieldRecipeClient = {
     // Setup logging and listen for changes to logging prefs
     LogManager.configure(Services.prefs.getIntPref(PREF_LOGGING_LEVEL));
     Preferences.observe(PREF_LOGGING_LEVEL, LogManager.configure);
     CleanupManager.addCleanupHandler(
       () => Preferences.ignore(PREF_LOGGING_LEVEL, LogManager.configure),
     );
     log = LogManager.getLogger("bootstrap");
 
+    // Disable self-support, since we replace its behavior.
+    // Self-support only checks its pref on start, so if we disable it, wait
+    // until next startup to run, unless the dev_mode preference is set.
+    if (Preferences.get(PREF_SELF_SUPPORT_ENABLED, true)) {
+      Preferences.set(PREF_SELF_SUPPORT_ENABLED, false);
+      if (!Preferences.get(PREF_DEV_MODE, false)) {
+        return;
+      }
+    }
+
     // Initialize experiments first to avoid a race between initializing prefs
     // and recipes rolling back pref changes when experiments end.
     try {
       await PreferenceExperiments.init();
     } catch (err) {
       log.error("Failed to initialize preference experiments:", err);
     }
 
     await RecipeRunner.init();
   },
 
   shutdown(reason) {
     CleanupManager.cleanup();
+
+    // Re-enable self-support if we're being disabled.
+    if (reason === REASONS.ADDON_DISABLE || reason === REASONS.ADDON_UNINSTALL) {
+      Services.prefs.setBoolPref(PREF_SELF_SUPPORT_ENABLED, true);
+    }
   },
 
   setDefaultPrefs() {
     for (const [key, val] of Object.entries(DEFAULT_PREFS)) {
       const fullKey = PREF_BRANCH + key;
       // If someone beat us to setting a default, don't overwrite it.
       if (!Preferences.isSet(fullKey)) {
         Preferences.set(fullKey, val);
--- a/browser/extensions/shield-recipe-client/test/browser/browser_ClientEnvironment.js
+++ b/browser/extensions/shield-recipe-client/test/browser/browser_ClientEnvironment.js
@@ -111,17 +111,14 @@ add_task(async function testExperiments(
   );
 
   getAll.restore();
 });
 
 add_task(async function isFirstRun() {
   let environment = ClientEnvironment.getEnvironment();
 
-  // isFirstRun is set to false after the recipe client runs
-  ok(!environment.isFirstRun, "isFirstRun has a default value");
-
   // isFirstRun is read from a preference
   await SpecialPowers.pushPrefEnv({set: [["extensions.shield-recipe-client.first_run", true]]});
   environment = ClientEnvironment.getEnvironment();
   ok(environment.isFirstRun, "isFirstRun is read from preferences");
 });