Bug 1304164 - Allow the e10srollout system add-on to control temporary disqualifications. r=mconley a=lizzard
authorFelipe Gomes <felipc@gmail.com>
Thu, 06 Oct 2016 14:38:46 -0300
changeset 342660 4defd718466e59ad119815cf4ec6985f0aa8f7a4
parent 342642 0c6c6bbf5fbe667f3c49ab39180cbda156d56c60
child 342661 6b9d0bdf9d525fd632a8c41fe25e207aac2dfb45
push id1213
push userfelipc@gmail.com
push dateThu, 06 Oct 2016 17:41:11 +0000
treeherdermozilla-release@7ceaa3683e88 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley, lizzard
bugs1304164
milestone49.0.2
Bug 1304164 - Allow the e10srollout system add-on to control temporary disqualifications. r=mconley a=lizzard MozReview-Commit-ID: LhDvgpCyCCE
browser/extensions/e10srollout/bootstrap.js
--- a/browser/extensions/e10srollout/bootstrap.js
+++ b/browser/extensions/e10srollout/bootstrap.js
@@ -71,28 +71,40 @@ function defineCohort() {
     Preferences.reset(PREF_E10S_ADDON_POLICY);
   }
 
   let userOptedOut = optedOut();
   let userOptedIn = optedIn();
   let disqualified = (Services.appinfo.multiprocessBlockPolicy != 0);
   let testGroup = (getUserSample() < TEST_THRESHOLD[updateChannel]);
   let hasNonExemptAddon = Preferences.get(PREF_E10S_HAS_NONEXEMPT_ADDON, false);
+  let temporaryDisqualification = getTemporaryDisqualification();
 
   let cohortPrefix = "";
   if (disqualified) {
     cohortPrefix = "disqualified-";
   } else if (hasNonExemptAddon) {
     cohortPrefix = `addons-set${addonPolicy}-`;
   }
 
   if (userOptedOut) {
     setCohort("optedOut");
   } else if (userOptedIn) {
     setCohort("optedIn");
+  } else if (temporaryDisqualification != "") {
+    // Users who are disqualified by the backend (from multiprocessBlockPolicy)
+    // can be put into either the test or control groups, because e10s will
+    // still be denied by the backend, which is useful so that the E10S_STATUS
+    // telemetry probe can be correctly set.
+
+    // For these volatile disqualification reasons, however, we must not try
+    // to activate e10s because the backend doesn't know about it. E10S_STATUS
+    // here will be accumulated as "2 - Disabled", which is fine too.
+    setCohort(`temp-disqualified-${temporaryDisqualification}`);
+    Preferences.reset(PREF_TOGGLE_E10S);
   } else if (testGroup) {
     setCohort(`${cohortPrefix}test`);
     Preferences.set(PREF_TOGGLE_E10S, true);
   } else {
     setCohort(`${cohortPrefix}control`);
     Preferences.reset(PREF_TOGGLE_E10S);
   }
 }
@@ -140,8 +152,18 @@ function optedIn() {
 function optedOut() {
   // Users can also opt-out by toggling back the pref to false.
   // If they reset the pref instead they might be re-enabled if
   // they are still part of the threshold.
   return Preferences.get(PREF_E10S_FORCE_DISABLED, false) ||
          (Preferences.isSet(PREF_TOGGLE_E10S) &&
           Preferences.get(PREF_TOGGLE_E10S) == false);
 }
+
+/* If this function returns a non-empty string, it
+ * means that this particular user should be temporarily
+ * disqualified due to some particular reason.
+ * If a user shouldn't be disqualified, then an empty
+ * string must be returned.
+ */
+function getTemporaryDisqualification() {
+  return "";
+}