[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser] 148/311: Bug 1758645 - Check new env variable MOZ_REMOTE_SETTINGS_DEVTOOLS to allow overriding the remote settings server URL r=Gijs, leplatrem, a=dmeehan



This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.

commit 0b0bddb85f248ec6ee92ee494983e6fd0622c3fc
Author: Julian Descottes <jdescottes@xxxxxxxxxxx>
AuthorDate: Wed Mar 9 15:14:15 2022 +0000

    Bug 1758645 - Check new env variable MOZ_REMOTE_SETTINGS_DEVTOOLS to allow overriding the remote settings server URL r=Gijs,leplatrem, a=dmeehan
    
    Differential Revision: https://phabricator.services.mozilla.com/D140635
---
 services/settings/Utils.jsm | 39 ++++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 11 deletions(-)

diff --git a/services/settings/Utils.jsm b/services/settings/Utils.jsm
index 2c483b0001c4e..f91e5dcb678b4 100644
--- a/services/settings/Utils.jsm
+++ b/services/settings/Utils.jsm
@@ -46,14 +46,34 @@ XPCOMUtils.defineLazyGetter(this, "log", () => {
   });
 });
 
-// Various tests harness disable non local connections and will crash if any is
-// performed. Note this cannot be replaced by Cu.isInAutomation as some tests
-// are unable to satisfy the other requirements for this flag.
-XPCOMUtils.defineLazyGetter(this, "localConnectionsOnly", () => {
+// Overriding the server URL is normally disabled on Beta and Release channels,
+// except under some conditions.
+XPCOMUtils.defineLazyGetter(this, "allowServerURLOverride", () => {
+  if (!AppConstants.RELEASE_OR_BETA) {
+    // Always allow to override the server URL on Nightly/DevEdition.
+    return true;
+  }
+
+  if (AppConstants.MOZ_APP_NAME === "thunderbird") {
+    // Always allow to override the server URL for Thunderbird.
+    return true;
+  }
+
   const env = Cc["@mozilla.org/process/environment;1"].getService(
     Ci.nsIEnvironment
   );
-  return env.get("MOZ_DISABLE_NONLOCAL_CONNECTIONS") === "1";
+  if (env.get("MOZ_DISABLE_NONLOCAL_CONNECTIONS") === "1") {
+    // Allow to override the server URL if non-local connections are disabled,
+    // usually true when running tests.
+    return true;
+  }
+
+  if (env.get("MOZ_REMOTE_SETTINGS_DEVTOOLS") === "1") {
+    // Allow to override the server URL when using remote settings devtools.
+    return true;
+  }
+
+  return false;
 });
 
 XPCOMUtils.defineLazyPreferenceGetter(
@@ -68,12 +88,9 @@ function _isUndefined(value) {
 
 var Utils = {
   get SERVER_URL() {
-    const isNotThunderbird = AppConstants.MOZ_APP_NAME != "thunderbird";
-    return AppConstants.RELEASE_OR_BETA &&
-      !localConnectionsOnly &&
-      isNotThunderbird
-      ? "https://firefox.settings.services.mozilla.com/v1";
-      : gServerURL;
+    return allowServerURLOverride
+      ? gServerURL
+      : "https://firefox.settings.services.mozilla.com/v1";;
   },
 
   CHANGES_PATH: "/buckets/monitor/collections/changes/changeset",

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits