Backed out 3 changesets (bug 1748798) for causing bc test failures on browser_navigator.js. a=backout
authorMarian-Vasile Laza <mlaza@mozilla.com>
Thu, 27 Jan 2022 15:09:03 +0200
changeset 605660 4dfa6c06a93661b281ca62ae833b4439f1609154
parent 605659 7dff1a12e1a4fd90cd5bf56e334120b08b64066b
child 605661 df2541140009700ca2bd1d0cb3cd4f67e5be50d2
child 605682 b76bb78e74005db113d0227428f55a271e2f7256
push id39201
push usermlaza@mozilla.com
push dateThu, 27 Jan 2022 13:09:41 +0000
treeherdermozilla-central@4dfa6c06a936 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1748798
milestone98.0a1
backs out98b4a50ae8a2b6779e72d30c5027f8742b173865
509c128c5d15d37a9753917a7d8cc610a1f07b35
b95bd8f3f5d4c68a74e75469de8d0e9d0b84361b
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
Backed out 3 changesets (bug 1748798) for causing bc test failures on browser_navigator.js. a=backout Backed out changeset 98b4a50ae8a2 (bug 1748798) Backed out changeset 509c128c5d15 (bug 1748798) Backed out changeset b95bd8f3f5d4 (bug 1748798)
browser/components/resistfingerprinting/test/browser/browser_navigator.js
modules/libpref/init/StaticPrefList.yaml
netwerk/protocol/http/nsHttpHandler.cpp
toolkit/components/featuregates/Features.toml
toolkit/locales/en-US/toolkit/featuregates/features.ftl
--- a/browser/components/resistfingerprinting/test/browser/browser_navigator.js
+++ b/browser/components/resistfingerprinting/test/browser/browser_navigator.js
@@ -401,52 +401,16 @@ add_task(async function runOverrideTest(
 
   // Pop general.appname.override etc
   await SpecialPowers.popPrefEnv();
 
   // Pop privacy.resistFingerprinting
   await SpecialPowers.popPrefEnv();
 });
 
-add_task(async function testForceVersion100() {
-  await SpecialPowers.pushPrefEnv({
-    set: [["general.useragent.forceVersion100", true]],
-  });
-
-  const VERSION_100_OSCPU = {
-    linux: "Linux x86_64",
-    win:
-      cpuArch == "x86_64" ? "Windows NT 10.0; Win64; x64" : "Windows NT 10.0",
-    macosx: "Intel Mac OS X 10.15",
-  };
-
-  let version100UserAgent = `Mozilla/5.0 (${
-    DEFAULT_UA_OS[AppConstants.platform]
-  }; rv:100.0) Gecko/20100101 Firefox/100.0`;
-
-  expectedResults = {
-    testDesc: "forceVersion100",
-    appVersion: DEFAULT_APPVERSION[AppConstants.platform],
-    hardwareConcurrency: navigator.hardwareConcurrency,
-    oscpu: VERSION_100_OSCPU[AppConstants.platform],
-    platform: DEFAULT_PLATFORM[AppConstants.platform],
-    userAgentNavigator: version100UserAgent,
-    userAgentHeader: version100UserAgent,
-  };
-
-  await testNavigator();
-
-  await testUserAgentHeader();
-
-  await testWorkerNavigator();
-
-  // Pop general.useragent.override etc
-  await SpecialPowers.popPrefEnv();
-});
-
 // Only test the Firefox and Gecko experiment prefs on desktop.
 if (AppConstants.platform != "android") {
   add_task(async function setupFirefoxVersionExperiment() {
     // Mock Nimbus experiment settings
     const { ExperimentFakes } = ChromeUtils.import(
       "resource://testing-common/NimbusTestUtils.jsm"
     );
     let doExperimentCleanup = await ExperimentFakes.enrollWithFeatureConfig({
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -4972,31 +4972,16 @@
   value: 1000
   mirror: always
 
 - name: general.utility-process.startup_timeout_ms
   type: RelaxedAtomicInt32
   value: 5000
   mirror: always
 
-# Temporary pref to test website compatibility with Firefox 100 UA string. This
-# pref will be removed in Firefox 100 because it will no longer needed.
-- name: general.useragent.forceVersion100
-  type: bool
-  value: false
-  mirror: always
-
-# Temporary pref to remember whether we have handled the Nimbus enrollment
-# event for the Firefox 100 UA experiment. This pref will be removed in Firefox
-# 100 because the experiment will have ended.
-- name: general.useragent.handledVersionExperimentEnrollment
-  type: bool
-  value: false
-  mirror: always
-
 #---------------------------------------------------------------------------
 # Prefs starting with "geo."
 #---------------------------------------------------------------------------
 
 # Is support for Navigator.geolocation enabled?
 - name: geo.enabled
   type: bool
   value: true
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -24,17 +24,16 @@
 #include "nsSocketProviderService.h"
 #include "nsISocketProvider.h"
 #include "nsPrintfCString.h"
 #include "nsCOMPtr.h"
 #include "nsNetCID.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Printf.h"
 #include "mozilla/Sprintf.h"
-#include "mozilla/StaticPrefs_general.h"
 #include "mozilla/StaticPrefs_network.h"
 #include "mozilla/StaticPrefs_privacy.h"
 #include "mozilla/StoragePrincipalHelper.h"
 #include "nsAsyncRedirectVerifyHelper.h"
 #include "nsSocketTransportService2.h"
 #include "nsAlgorithm.h"
 #include "ASpdySession.h"
 #include "EventTokenBucket.h"
@@ -134,66 +133,48 @@
 //-----------------------------------------------------------------------------
 
 using mozilla::dom::Promise;
 
 namespace mozilla::net {
 
 LazyLogModule gHttpLog("nsHttp");
 
-static void HandleVersionExperimentEnrollment(const char* /* aNimbusPref */,
-                                              void* /* aUserData */) {
-  MOZ_ASSERT(XRE_IsParentProcess());
-
-  int experimentBranch =
-      NimbusFeatures::GetInt(UA_EXPERIMENT_NAME, UA_EXPERIMENT_VAR, -1);
-
-  // Only set the forceVersion100 pref if the user was enrolled in the
-  // treatment (100) branch and the pref is not already set. If the user
-  // already set the forceVersion100 pref manually (by checking the
-  // "Firefox 100 User-Agent String" option in about:preferences), we don't
-  // want subsequent enrollment in the control branch to clear the pref and
-  // surprise the user by resetting their UA from version 100 UA to the
-  // default version.
-
-  if (experimentBranch == 100 &&
-      !mozilla::StaticPrefs::general_useragent_forceVersion100()) {
-    Preferences::SetBool("general.useragent.forceVersion100", true);
-  }
-
-  Preferences::SetBool("general.useragent.handledVersionExperimentEnrollment",
-                       true);
-}
-
-static void GetExperimentUserAgent(nsACString* aExperimentUserAgent) {
-  if (!mozilla::StaticPrefs::general_useragent_forceVersion100()) {
+static void ExperimentUserAgentUpdated(const char* /* aNimbusPref */,
+                                       void* aUserData) {
+  MOZ_ASSERT(aUserData != nullptr);
+  nsACString* aExperimentUserAgent = static_cast<nsACString*>(aUserData);
+
+  // Is this user enrolled in the Firefox 100 experiment?
+  int firefoxVersion =
+      NimbusFeatures::GetInt(UA_EXPERIMENT_NAME, UA_EXPERIMENT_VAR, 0);
+  if (firefoxVersion <= 0) {
     aExperimentUserAgent->SetIsVoid(true);
     return;
   }
 
   const char uaFormat[] =
 #ifdef XP_WIN
 #  ifdef HAVE_64BIT_BUILD
-      "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 "
-      "Firefox/100.0"
+      "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:%d.0) Gecko/20100101 "
+      "Firefox/%d.0"
 #  else
-      "Mozilla/5.0 (Windows NT 10.0; rv:100.0) Gecko/20100101 Firefox/100.0"
+      "Mozilla/5.0 (Windows NT 10.0; rv:%d.0) Gecko/20100101 Firefox/%d.0"
 #  endif
 #elif defined(XP_MACOSX)
-      "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 "
-      "Firefox/100.0"
-#elif defined(ANDROID)
-      "Mozilla/5.0 (Android 10; Mobile; rv:100.0) Gecko/100.0 Firefox/100.0"
+      "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:%d.0) Gecko/20100101 "
+      "Firefox/%d.0"
 #else
-      // Linux, FreeBSD, etc
-      "Mozilla/5.0 (X11; Linux x86_64; rv:100.0) Gecko/20100101 Firefox/100.0"
+      // Linux, Android, FreeBSD, etc
+      "Mozilla/5.0 (X11; Linux x86_64; rv:%d.0) Gecko/20100101 Firefox/%d.0"
 #endif
       ;
 
-  aExperimentUserAgent->Assign(uaFormat);
+  aExperimentUserAgent->Truncate();
+  aExperimentUserAgent->AppendPrintf(uaFormat, firefoxVersion, firefoxVersion);
 }
 
 #ifdef ANDROID
 static nsCString GetDeviceModelId() {
   // Assumed to be running on the main thread
   // We need the device property in either case
   nsAutoCString deviceModelId;
   nsCOMPtr<nsIPropertyBag2> infoService =
@@ -390,41 +371,28 @@ nsresult nsHttpHandler::Init() {
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return EmptyCString();
     }
 
     return qlogDir->HumanReadablePath();
   };
   mHttp3QlogDir = initQLogDir();
 
-  // monitor Firefox Version Experiment enrollment
-  if (XRE_IsParentProcess()) {
-    int experimentBranch =
-        NimbusFeatures::GetInt(UA_EXPERIMENT_NAME, UA_EXPERIMENT_VAR, -1);
-
-    if (experimentBranch == -1) {
-      // The user has not been enrolled in the experiment yet, so listen for
-      // a Nimbus enrollment event.
-      NimbusFeatures::OnUpdate(UA_EXPERIMENT_NAME, UA_EXPERIMENT_VAR,
-                               HandleVersionExperimentEnrollment, nullptr);
-    } else if (!mozilla::StaticPrefs::
-                   general_useragent_handledVersionExperimentEnrollment()) {
-      // The user was enrolled in the experiment before the forceVersion100
-      // pref was created, so call the Nimbus enrollment callback now to
-      // update the forceVersion100 and handledVersionExperimentEnrollment
-      // prefs.
-      HandleVersionExperimentEnrollment(nullptr, nullptr);
-    }
-  }
-
   // monitor some preference changes
   Preferences::RegisterPrefixCallbacks(nsHttpHandler::PrefsChanged,
                                        gCallbackPrefs, this);
   PrefsChanged(nullptr);
 
+  // monitor Firefox Version Experiment enrollment
+  NimbusFeatures::OnUpdate(UA_EXPERIMENT_NAME, UA_EXPERIMENT_VAR,
+                           ExperimentUserAgentUpdated, &mExperimentUserAgent);
+
+  // Load the experiment state once for startup
+  ExperimentUserAgentUpdated("", &mExperimentUserAgent);
+
   Telemetry::ScalarSet(Telemetry::ScalarID::NETWORKING_HTTP3_ENABLED,
                        mHttp3Enabled);
 
   mMisc.AssignLiteral("rv:" MOZILLA_UAVERSION);
 
   mCompatFirefox.AssignLiteral("Firefox/" MOZILLA_UAVERSION);
 
   nsCOMPtr<nsIXULAppInfo> appInfo =
@@ -1062,24 +1030,16 @@ void nsHttpHandler::PrefsChanged(const c
   bool cVar = false;
 
   if (PREF_CHANGED(UA_PREF("compatMode.firefox"))) {
     rv = Preferences::GetBool(UA_PREF("compatMode.firefox"), &cVar);
     mCompatFirefoxEnabled = (NS_SUCCEEDED(rv) && cVar);
     mUserAgentIsDirty = true;
   }
 
-  // general.useragent.forceVersion100
-  if (PREF_CHANGED(UA_PREF("forceVersion100"))) {
-    // mExperimentUserAgent (if it's not void) will override the constructed
-    // UA. We don't need to set mUserAgentIsDirty because we don't need to
-    // reconstruct the UA.
-    GetExperimentUserAgent(&mExperimentUserAgent);
-  }
-
   // general.useragent.override
   if (PREF_CHANGED(UA_PREF("override"))) {
     Preferences::GetCString(UA_PREF("override"), mUserAgentOverride);
     mUserAgentIsDirty = true;
   }
 
 #ifdef ANDROID
   // general.useragent.use_device
--- a/toolkit/components/featuregates/Features.toml
+++ b/toolkit/components/featuregates/Features.toml
@@ -127,18 +127,8 @@ default-value = false
 title = "experimental-features-ime-search"
 description = "experimental-features-ime-search-description"
 restart-required = false
 preference = "browser.urlbar.keepPanelOpenDuringImeComposition"
 type = "boolean"
 bug-numbers = [1673971]
 is-public = true
 default-value = false
-
-[firefox-100]
-title = "experimental-features-firefox-100"
-description = "experimental-features-firefox-100-description"
-restart-required = false
-preference = "general.useragent.forceVersion100"
-type = "boolean"
-bug-numbers = [1748798]
-is-public = true
-default-value = false
--- a/toolkit/locales/en-US/toolkit/featuregates/features.ftl
+++ b/toolkit/locales/en-US/toolkit/featuregates/features.ftl
@@ -72,13 +72,8 @@ experimental-features-win32k-lockdown-de
 experimental-features-js-warp =
     .label = JavaScript JIT: Warp
 experimental-features-js-warp-description = Enable Warp, a project to improve JavaScript performance and memory usage.
 
 # Search during IME
 experimental-features-ime-search =
     .label = Address Bar: show results during IME composition
 experimental-features-ime-search-description = An IME (Input Method Editor) is a tool that allows you to enter complex symbols, such as those used in East Asian or Indic written languages, using a standard keyboard. Enabling this experiment will keep the address bar panel open, showing search results and suggestions, while using IME to input text. Note that the IME might display a panel that covers the address bar results, therefore this preference is only suggested for IME not using this type of panel.
-
-# Firefox 100
-experimental-features-firefox-100 =
-    .label = { -brand-product-name } 100 User-Agent String
-experimental-features-firefox-100-description = Make { -brand-short-name } send websites a User-Agent string that pretends to be { -brand-product-name } version 100. Use this setting to test whether websites will break when { -brand-short-name } hits a three-digit version number. The real { -brand-product-name } 100 is scheduled to be released in May 2022, so start testing your websites now!