[X2Go-Commits] [pale-moon] 21/294: Restore app.update.url.override preference.

git-admin at x2go.org git-admin at x2go.org
Sat Apr 27 08:57:41 CEST 2019


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

x2go pushed a commit to branch upstream/28.5.0
in repository pale-moon.

commit 71c81eb900ac3b8a770a4b844771faf335999861
Author: wolfbeast <mcwerewolf at wolfbeast.com>
Date:   Tue Feb 12 16:33:11 2019 +0100

    Restore app.update.url.override preference.
---
 application/basilisk/app/profile/basilisk.js |  3 +++
 toolkit/mozapps/update/nsUpdateService.js    | 38 +++++++++++++++++++++++-----
 2 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/application/basilisk/app/profile/basilisk.js b/application/basilisk/app/profile/basilisk.js
index 4a8880f..b6789e3 100644
--- a/application/basilisk/app/profile/basilisk.js
+++ b/application/basilisk/app/profile/basilisk.js
@@ -141,6 +141,9 @@ pref("app.update.url", "https://aus5.mozilla.org/update/6/%PRODUCT%/%VERSION%/%B
 // app.update.url.manual is in branding section
 // app.update.url.details is in branding section
 
+// User-settable override to app.update.url for testing purposes.
+//pref("app.update.url.override", "");
+
 // app.update.interval is in branding section
 // app.update.promptWaitTime is in branding section
 
diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js
index 0cf7b89..e5c81aa 100644
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -44,6 +44,7 @@ const PREF_APP_UPDATE_SOCKET_RETRYTIMEOUT  = "app.update.socket.retryTimeout";
 const PREF_APP_UPDATE_STAGING_ENABLED      = "app.update.staging.enabled";
 const PREF_APP_UPDATE_URL                  = "app.update.url";
 const PREF_APP_UPDATE_URL_DETAILS          = "app.update.url.details";
+const PREF_APP_UPDATE_URL_OVERRIDE         = "app.update.url.override";
 
 const PREFBRANCH_APP_UPDATE_NEVER = "app.update.never.";
 
@@ -2143,6 +2144,14 @@ UpdateService.prototype = {
       }
     }
 
+    let prefType = Services.prefs.getPrefType(PREF_APP_UPDATE_URL_OVERRIDE);
+    let overridePrefHasValue = prefType != Ci.nsIPrefBranch.PREF_INVALID;
+    // Histogram IDs:
+    // UPDATE_HAS_PREF_URL_OVERRIDE_EXTERNAL
+    // UPDATE_HAS_PREF_URL_OVERRIDE_NOTIFY
+    AUSTLMY.pingGeneric("UPDATE_HAS_PREF_URL_OVERRIDE_" + this._pingSuffix,
+                        overridePrefHasValue, false);
+
     // If a download is in progress or the patch has been staged do nothing.
     if (this.isDownloading) {
       AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_IS_DOWNLOADING);
@@ -2173,8 +2182,18 @@ UpdateService.prototype = {
     } else if (!UpdateUtils.ABI) {
       AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_NO_OS_ABI);
     } else if (!validUpdateURL) {
-      AUSTLMY.pingCheckCode(this._pingSuffix,
-                            AUSTLMY.CHK_INVALID_DEFAULT_URL);
+      if (overridePrefHasValue) {
+        if (Services.prefs.prefHasUserValue(PREF_APP_UPDATE_URL_OVERRIDE)) {
+          AUSTLMY.pingCheckCode(this._pingSuffix,
+                                AUSTLMY.CHK_INVALID_USER_OVERRIDE_URL);
+        } else {
+          AUSTLMY.pingCheckCode(this._pingSuffix,
+                                AUSTLMY.CHK_INVALID_DEFAULT_OVERRIDE_URL);
+        }
+      } else {
+        AUSTLMY.pingCheckCode(this._pingSuffix,
+                              AUSTLMY.CHK_INVALID_DEFAULT_URL);
+      }
     } else if (!getPref("getBoolPref", PREF_APP_UPDATE_ENABLED, true)) {
       AUSTLMY.pingCheckCode(this._pingSuffix, AUSTLMY.CHK_PREF_DISABLED);
     } else if (!hasUpdateMutex()) {
@@ -3023,11 +3042,16 @@ Checker.prototype = {
   getUpdateURL: function UC_getUpdateURL(force) {
     this._forced = force;
 
-    let url;
-    try {
-      url = Services.prefs.getDefaultBranch(null).
-            getCharPref(PREF_APP_UPDATE_URL);
-    } catch (e) {
+    // Use the override URL if specified.
+    let url = getPref("getCharPref", PREF_APP_UPDATE_URL_OVERRIDE, null);
+
+    // Otherwise, construct the update URL from component parts.
+    if (!url) {
+      try {
+        url = Services.prefs.getDefaultBranch(null).
+              getCharPref(PREF_APP_UPDATE_URL);
+      } catch (e) {
+      }
     }
 
     if (!url || url == "") {

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pale-moon.git


More information about the x2go-commits mailing list