Bug 1342490 - Allow e10srollout to control temporary qualifications. r=felipe draft
authorJ. Ryan Stinnett <jryans@gmail.com>
Fri, 24 Feb 2017 14:22:09 -0600
changeset 492226 3a7d1e7f93bd3bf845fe24666fb12c1d98ac774d
parent 492225 eb7ca2f437e73be7d41a84c2cc322b29261cd4a8
child 492227 4112ba261d417087979012c984d53327e4396a08
push id47559
push userbmo:jryans@gmail.com
push dateThu, 02 Mar 2017 22:39:35 +0000
reviewersfelipe
bugs1342490
milestone54.0a1
Bug 1342490 - Allow e10srollout to control temporary qualifications. r=felipe MozReview-Commit-ID: 61C9jvnNvNu
browser/extensions/e10srollout/bootstrap.js
--- a/browser/extensions/e10srollout/bootstrap.js
+++ b/browser/extensions/e10srollout/bootstrap.js
@@ -79,16 +79,17 @@ function defineCohort() {
   }
 
   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 temporaryQualification = getTemporaryQualification();
 
   let cohortPrefix = "";
   if (disqualified) {
     cohortPrefix = "disqualified-";
   } else if (hasNonExemptAddon) {
     cohortPrefix = `addons-set${addonPolicy}-`;
   }
 
@@ -102,16 +103,19 @@ function defineCohort() {
     // 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 (!disqualified && temporaryQualification != "") {
+    setCohort(`temp-qualified-${temporaryQualification}`);
+    Preferences.set(PREF_TOGGLE_E10S, true);
   } else if (testGroup) {
     setCohort(`${cohortPrefix}test`);
     Preferences.set(PREF_TOGGLE_E10S, true);
   } else {
     setCohort(`${cohortPrefix}control`);
     Preferences.reset(PREF_TOGGLE_E10S);
   }
 }
@@ -169,8 +173,18 @@ function optedOut() {
  * 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 "";
 }
+
+/* If this function returns a non-empty string, it
+ * means that this particular user should be temporarily
+ * qualified due to some particular reason.
+ * If a user shouldn't be qualified, then an empty
+ * string must be returned.
+ */
+function getTemporaryQualification() {
+  return "";
+}