Bug 1385177 - Remove check for built-in self-support from shield recipe client r=mythmon
☠☠ backed out by 50ce68c9412c ☠ ☠
authorRobert Helmer <rhelmer@mozilla.com>
Thu, 27 Jul 2017 22:24:05 -0700
changeset 422767 3b9509ef04d0c8e87a59aa1b03e4a0beca12f1dc
parent 422766 2948f11c75c809caff4491384d68698608c4f59a
child 422768 8a21a385ae02d97800d17436cf0f79c6d8c94b24
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)
reviewersmythmon
bugs1385177
milestone56.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 1385177 - Remove check for built-in self-support from shield recipe client r=mythmon MozReview-Commit-ID: 3xxrSHFlV6i
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,17 +37,16 @@ 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).
@@ -59,44 +58,29 @@ 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,14 +111,17 @@ 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");
 });