Backed out changeset eb276ce17c77 (bug 1733357) for causing bustages in nsHttpHandler.cpp
authorAlexandru Michis <malexandru@mozilla.com>
Wed, 20 Oct 2021 19:01:36 +0300
changeset 596484 0c6448eff829b21254e3df3c56194501396c27cf
parent 596483 feea84165bf0c8622c415064d405d8fd5f7a1a7d
child 596485 bde13f051e7398e5581c2f8d082757133a35059f
push id151854
push usermalexandru@mozilla.com
push dateWed, 20 Oct 2021 16:08:38 +0000
treeherderautoland@0c6448eff829 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1733357
milestone95.0a1
backs outeb276ce17c77136a09bfeb5bf34b06c0338776d1
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 changeset eb276ce17c77 (bug 1733357) for causing bustages in nsHttpHandler.cpp CLOSED TREE
netwerk/protocol/http/nsHttpHandler.cpp
toolkit/components/moz.build
toolkit/components/nimbus/ExperimentAPI.jsm
toolkit/components/nimbus/test/browser/browser.ini
toolkit/components/nimbus/test/unit/xpcshell.ini
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -94,17 +94,19 @@
 #  include "mozilla/WindowsVersion.h"
 #endif
 
 #if defined(XP_MACOSX)
 #  include <CoreServices/CoreServices.h>
 #  include "nsCocoaFeatures.h"
 #endif
 
-#include "mozilla/browser/NimbusFeatures.h"
+#if defined(MOZ_BUILD_APP_IS_BROWSER) && !defined(ANDROID)
+#  include "mozilla/browser/NimbusFeatures.h"
+#endif  // MOZ_BUILD_APP_IS_BROWSER && !ANDROID
 
 //-----------------------------------------------------------------------------
 #include "mozilla/net/HttpChannelChild.h"
 
 #define UA_PREF_PREFIX "general.useragent."
 #ifdef XP_WIN
 #  define UA_SPARE_PLATFORM
 #endif
@@ -122,27 +124,30 @@
 
 #define UA_PREF(_pref) UA_PREF_PREFIX _pref
 #define HTTP_PREF(_pref) HTTP_PREF_PREFIX _pref
 #define BROWSER_PREF(_pref) BROWSER_PREF_PREFIX _pref
 
 #define NS_HTTP_PROTOCOL_FLAGS \
   (URI_STD | ALLOWS_PROXY | ALLOWS_PROXY_HTTP | URI_LOADABLE_BY_ANYONE)
 
-#define UA_EXPERIMENT_NAME "firefox100"_ns
-#define UA_EXPERIMENT_VAR "firefoxVersion"_ns
+#if defined(MOZ_BUILD_APP_IS_BROWSER) && !defined(ANDROID)
+#  define UA_EXPERIMENT_NAME "firefox100"_ns
+#  define UA_EXPERIMENT_VAR "firefoxVersion"_ns
+#endif  // MOZ_BUILD_APP_IS_BROWSER && !ANDROID
 
 //-----------------------------------------------------------------------------
 
 using mozilla::dom::Promise;
 
 namespace mozilla::net {
 
 LazyLogModule gHttpLog("nsHttp");
 
+#if defined(MOZ_BUILD_APP_IS_BROWSER) && !defined(ANDROID)
 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);
@@ -166,16 +171,17 @@ static void ExperimentUserAgentUpdated(c
       // Linux, Android, FreeBSD, etc
       "Mozilla/5.0 (X11; Linux x86_64; rv:%d.0) Gecko/20100101 Firefox/%d.0"
 #  endif
       ;
 
   aExperimentUserAgent->Truncate();
   aExperimentUserAgent->AppendPrintf(uaFormat, firefoxVersion, firefoxVersion);
 }
+#endif  // MOZ_BUILD_APP_IS_BROWSER && !ANDROID
 
 #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 =
       do_GetService("@mozilla.org/system-info;1");
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -124,16 +124,17 @@ if CONFIG["MOZ_WIDGET_TOOLKIT"] != "andr
 
     XPCOM_MANIFESTS += [
         "components.conf",
     ]
 
 if CONFIG["MOZ_BUILD_APP"] == "browser":
     DIRS += ["normandy", "messaging-system"]
 
-DIRS += ["nimbus"]
+if CONFIG["MOZ_BUILD_APP"] in ["browser", "comm/mail"]:
+    DIRS += ["nimbus"]
 
 if CONFIG["MOZ_BACKGROUNDTASKS"]:
     DIRS += ["backgroundtasks"]
 
 # This is only packaged for browser since corrupt JAR and XPI files tend to be a desktop-OS problem.
 if CONFIG["MOZ_BUILD_APP"] == "browser":
     DIRS += ["corroborator"]
--- a/toolkit/components/nimbus/ExperimentAPI.jsm
+++ b/toolkit/components/nimbus/ExperimentAPI.jsm
@@ -286,24 +286,21 @@ const ExperimentAPI = {
 };
 
 /**
  * Singleton that holds lazy references to _ExperimentFeature instances
  * defined by the FeatureManifest
  */
 const NimbusFeatures = {};
 for (let feature in FeatureManifest) {
-  XPCOMUtils.defineLazyGetter(NimbusFeatures, feature, () => {
-    if (AppConstants.MOZ_BUILD_APP !== "browser") {
-      throw new Error(
-        `NimbusFeatures.${feature} APIs are only available for browser builds.`
-      );
-    }
-    return new _ExperimentFeature(feature);
-  });
+  XPCOMUtils.defineLazyGetter(
+    NimbusFeatures,
+    feature,
+    () => new _ExperimentFeature(feature)
+  );
 }
 
 class _ExperimentFeature {
   constructor(featureId, manifest) {
     this.featureId = featureId;
     this.prefGetters = {};
     this.manifest = manifest || FeatureManifest[featureId];
     if (!this.manifest) {
--- a/toolkit/components/nimbus/test/browser/browser.ini
+++ b/toolkit/components/nimbus/test/browser/browser.ini
@@ -1,17 +1,14 @@
 [DEFAULT]
 support-files =
   head.js
 prefs =
   # This turns off the update interval for fetching recipes from Remote Settings
   app.normandy.run_interval_seconds=0
-skip-if =
-  toolkit == "android"
-  appname == "thunderbird"
 
 [browser_experiment_single_feature_enrollment.js]
 [browser_remotesettingsexperimentloader_remote_defaults.js]
 [browser_remotesettingsexperimentloader_force_enrollment.js]
 [browser_experimentstore_load.js]
 [browser_experimentstore_load_single_feature.js]
 [browser_remotesettings_experiment_enroll.js]
 [browser_experiment_evaluate_jexl.js]
--- a/toolkit/components/nimbus/test/unit/xpcshell.ini
+++ b/toolkit/components/nimbus/test/unit/xpcshell.ini
@@ -1,17 +1,14 @@
 [DEFAULT]
 head = head.js
-tags = nimbus
+tags = messaging-system
 firefox-appdir = browser
 support-files =
   reference_aboutwelcome_experiment_content.json
-skip-if =
-  toolkit == "android"
-  appname == "thunderbird"
 
 [test_ExperimentManager_context.js]
 [test_ExperimentManager_enroll.js]
 [test_ExperimentManager_lifecycle.js]
 [test_ExperimentManager_unenroll.js]
 [test_ExperimentManager_generateTestIds.js]
 [test_ExperimentStore.js]
 [test_NimbusTestUtils.js]