Bug 1385177 - Remove check for built-in self-support from shield recipe client r=mythmon
authorRobert Helmer <rhelmer@mozilla.com>
Fri, 28 Jul 2017 13:58:35 -0700
changeset 420546 a15f665d03f4d868cadd28d52bb64713e1d583fb
parent 420545 33a4c8cd16c566c2b6347f293e5984954abfa007
child 420547 6a990e8c471a5ce396806aa9e00023d784a7b4aa
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [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: 52e6FrUdJF4
browser/extensions/shield-recipe-client/lib/ShieldRecipeClient.jsm
browser/extensions/shield-recipe-client/test/browser/browser_ClientEnvironment.js
testing/profiles/prefs_general.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 initially set to true
+  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");
 });
 
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -316,17 +316,17 @@ user_pref("browser.uitour.url", "http://
 // Tell the search service we are running in the US.  This also has the desired
 // side-effect of preventing our geoip lookup.
 user_pref("browser.search.isUS", true);
 user_pref("browser.search.countryCode", "US");
 // This will prevent HTTP requests for region defaults.
 user_pref("browser.search.geoSpecificDefaults", false);
 
 // Make sure Shield doesn't hit the network.
-user_pref("extensions.shield-recipe-client.api_url", "https://example.com/selfsupport-dummy/");
+user_pref("extensions.shield-recipe-client.api_url", "");
 
 user_pref("media.eme.enabled", true);
 
 // Set the number of shmems the PChromiumCDM protocol pre-allocates to 0,
 // so that we test the case where we under-estimate how many shmems we need
 // to send decoded video frames from the CDM to Gecko.
 user_pref("media.eme.chromium-api.video-shmems", 0);