Bug 1385491 - Call setCohort after setting e10s prefs. r=Felipe draft
authorBlake Kaplan <mrbkap@gmail.com>
Fri, 28 Jul 2017 16:28:39 -0700
changeset 618719 b3bc0bc963b4ffb9120fc55b6409cb7c52caf04a
parent 618576 87824406b9feb420a3150720707b424d7cee5915
child 640158 a568b5705f016e315f99ca8c9c1ba41da916051f
push id71429
push userbmo:mrbkap@mozilla.com
push dateMon, 31 Jul 2017 23:26:46 +0000
reviewersFelipe
bugs1385491, 1385396
milestone56.0a1
Bug 1385491 - Call setCohort after setting e10s prefs. r=Felipe Due to bug 1385396, setCohort initializes graphics and indirectly checks for whether e10s is enabled. By setting the pref before calling setCohort, we ensure that this call receives (and caches) the right value. MozReview-Commit-ID: 1lF1Up4Xvct
browser/extensions/e10srollout/bootstrap.js
browser/extensions/e10srollout/install.rdf.in
--- a/browser/extensions/e10srollout/bootstrap.js
+++ b/browser/extensions/e10srollout/bootstrap.js
@@ -137,46 +137,46 @@ function defineCohort() {
   }
 
   let eligibleForMulti = false;
   if (userOptedOut.e10s || userOptedOut.multi) {
     // If we detected that the user opted out either for multi or e10s, then
     // the proper prefs must already be set.
     setCohort("optedOut");
   } else if (userOptedIn.e10s) {
+    eligibleForMulti = true;
     setCohort("optedIn");
-    eligibleForMulti = true;
   } 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);
     Preferences.reset(PREF_E10S_PROCESSCOUNT + ".web");
+    setCohort(`temp-disqualified-${temporaryDisqualification}`);
   } else if (!disqualified && testThreshold < 1.0 &&
              temporaryQualification != "") {
     // Users who are qualified for e10s and on channels where some population
     // would not receive e10s can be pushed into e10s anyway via a temporary
     // qualification which overrides the user sample value when non-empty.
+    Preferences.set(PREF_TOGGLE_E10S, true);
+    eligibleForMulti = true;
     setCohort(`temp-qualified-${temporaryQualification}`);
+  } else if (testGroup) {
     Preferences.set(PREF_TOGGLE_E10S, true);
     eligibleForMulti = true;
-  } else if (testGroup) {
     setCohort(`${cohortPrefix}test`);
-    Preferences.set(PREF_TOGGLE_E10S, true);
-    eligibleForMulti = true;
   } else {
-    setCohort(`${cohortPrefix}control`);
     Preferences.reset(PREF_TOGGLE_E10S);
     Preferences.reset(PREF_E10S_PROCESSCOUNT + ".web");
+    setCohort(`${cohortPrefix}control`);
   }
 
   // Now determine if this user should be in the e10s-multi experiment.
   // - We only run the experiment on channels defined in MULTI_EXPERIMENT.
   // - If this experiment doesn't allow addons and we have a cohort prefix
   //   (i.e. there's at least one addon installed) we stop here.
   // - We decided above whether this user qualifies for the experiment.
   // - If the user already opted into multi, then their prefs are already set
@@ -203,20 +203,19 @@ function defineCohort() {
 
   // The user is in the multi experiment!
   // Decide how many content processes to use for this user.
   let buckets = MULTI_EXPERIMENT[updateChannel].buckets;
 
   let multiUserSample = getUserSample(true);
   for (let sampleName of Object.getOwnPropertyNames(buckets)) {
     if (multiUserSample < buckets[sampleName]) {
-      setCohort(`${cohortPrefix}multiBucket${sampleName}`);
-
       // NB: Coerce sampleName to an integer because this is an integer pref.
       Preferences.set(PREF_E10S_PROCESSCOUNT + ".web", +sampleName);
+      setCohort(`${cohortPrefix}multiBucket${sampleName}`);
       break;
     }
   }
 }
 
 function shutdown(data, reason) {
 }
 
--- a/browser/extensions/e10srollout/install.rdf.in
+++ b/browser/extensions/e10srollout/install.rdf.in
@@ -5,17 +5,17 @@
 
 #filter substitution
 
 <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:em="http://www.mozilla.org/2004/em-rdf#">
 
   <Description about="urn:mozilla:install-manifest">
     <em:id>e10srollout@mozilla.org</em:id>
-    <em:version>2.0</em:version>
+    <em:version>2.1</em:version>
     <em:type>2</em:type>
     <em:bootstrap>true</em:bootstrap>
     <em:multiprocessCompatible>true</em:multiprocessCompatible>
 
     <!-- Target Application this theme can install into,
         with minimum and maximum supported versions. -->
     <em:targetApplication>
       <Description>