Bug 1602757: Telemetry checks overrideUpdateChannel only at process startup r=chutten
☠☠ backed out by 8912e3abc781 ☠ ☠
authorRandell Jesup <rjesup@wgate.com>
Sat, 23 May 2020 18:51:40 +0000
changeset 2913077 1c6a6bfaaeef3abb1ac12e4f181df837e130163f
parent 2913076 45e22f062bced99e58d597d058a277a9392198a6
child 2913078 32851bed192962f32e01f3ba9bd33bafdd7f9cbf
push id542231
push userbclary@mozilla.com
push dateSun, 24 May 2020 06:08:15 +0000
treeherdertry@5bd349510b42 [default view] [failures only]
reviewerschutten
bugs1602757
milestone78.0a1
Bug 1602757: Telemetry checks overrideUpdateChannel only at process startup r=chutten Since this is checked only at startup, to ensure it propagates to all content processes we have to ensure we shut down and restart all preallocated or cached processes (though the process running the current page won't restart) Differential Revision: https://phabricator.services.mozilla.com/D76188
toolkit/components/telemetry/tests/browser/browser_DynamicScalars.js
--- a/toolkit/components/telemetry/tests/browser/browser_DynamicScalars.js
+++ b/toolkit/components/telemetry/tests/browser/browser_DynamicScalars.js
@@ -25,19 +25,29 @@ async function waitForProcessesScalars(
       aProcesses.every(p => Object.keys(scalars).includes(p)) &&
       aAdditionalCondition(scalars)
     );
   });
 }
 
 add_task(async function test_setup() {
   // Make sure the newly spawned content processes will have extended Telemetry enabled.
+  // Since Telemetry reads the prefs only at process startup, flush all cached
+  // and preallocated processes so they pick up the setting.
   await SpecialPowers.pushPrefEnv({
-    set: [[TelemetryUtils.Preferences.OverridePreRelease, true]],
+    set: [
+      [TelemetryUtils.Preferences.OverridePreRelease, true],
+      ["dom.ipc.processPrelaunch.enabled", false],
+    ],
   });
+  Services.ppmm.releaseCachedProcesses();
+  await SpecialPowers.pushPrefEnv({
+    set: [["dom.ipc.processPrelaunch.enabled", true]],
+  });
+
   // And take care of the already initialized one as well.
   let canRecordExtended = Services.telemetry.canRecordExtended;
   Services.telemetry.canRecordExtended = true;
   registerCleanupFunction(
     () => (Services.telemetry.canRecordExtended = canRecordExtended)
   );
 });
 
@@ -116,19 +126,19 @@ add_task(async function test_recording()
           "testKey",
           3
         );
       });
     }
   );
 
   // Wait for the dynamic scalars to appear non-keyed snapshots.
-  await waitForProcessesScalars(["dynamic"], false, scalars => {
+  await waitForProcessesScalars(["dynamic"], true, scalars => {
     // Wait for the scalars set in the content process to be available.
-    return "telemetry.test.dynamic.pre_content_spawn" in scalars.dynamic;
+    return "telemetry.test.dynamic.post_content_spawn_keyed" in scalars.dynamic;
   });
 
   // Verify the content of the snapshots.
   const scalars = Services.telemetry.getSnapshotForScalars("main", false);
   ok(
     "dynamic" in scalars,
     "The scalars must contain the 'dynamic' process section"
   );