[tbb-commits] [tor-browser/tor-browser-24.8.0esr-4.x-1] Bug 13047: Updater should not send Kernel/GTK version

mikeperry at torproject.org mikeperry at torproject.org
Tue Sep 23 03:23:11 UTC 2014


commit e4eca4759ead07562e4f6526b1ce79fe056fd03a
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Thu Sep 18 13:51:43 2014 -0400

    Bug 13047: Updater should not send Kernel/GTK version
    
    Removed the %OS_VERSION% component from the update URL and replaced the
      /update/ component of the URL with /update_2/.
    Added support for minSupportedOSVersion, an attribute of the <update> element
      that may be used to trigger Firefox's "unsupported platform" behavior.
      Older versions of TB will ignore this (unknown to them) attribiute.
---
 browser/app/profile/firefox.js            |    2 +-
 toolkit/mozapps/update/nsUpdateService.js |   16 ++++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index 3e3a77c..620a7a9 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -152,7 +152,7 @@ pref("app.update.silent", false);
 pref("app.update.staging.enabled", true);
 
 // Update service URL:
-pref("app.update.url", "https://www.torproject.org/dist/torbrowser/update/%CHANNEL%/%BUILD_TARGET%/%OS_VERSION%/%VERSION%/%LOCALE%");
+pref("app.update.url", "https://www.torproject.org/dist/torbrowser/update_2/%CHANNEL%/%BUILD_TARGET%/%VERSION%/%LOCALE%");
 // app.update.url.manual is in branding section
 // app.update.url.details is in branding section
 
diff --git a/toolkit/mozapps/update/nsUpdateService.js b/toolkit/mozapps/update/nsUpdateService.js
index eb4a74a..fbf99a7 100644
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -1598,7 +1598,17 @@ function Update(update) {
     this._patches.push(patch);
   }
 
-  if (this._patches.length == 0 && !update.hasAttribute("unsupported"))
+  if (update.hasAttribute("unsupported"))
+    this.unsupported = ("true" == update.getAttribute("unsupported"));
+  else if (update.hasAttribute("minSupportedOSVersion")) {
+    let minOSVersion = update.getAttribute("minSupportedOSVersion");
+    try {
+      let osVersion = Services.sysinfo.getProperty("version");
+      this.unsupported = (Services.vc.compare(osVersion, minOSVersion) < 0);
+    } catch (e) {}
+  }
+
+  if (this._patches.length == 0 && !this.unsupported)
     throw Cr.NS_ERROR_ILLEGAL_VALUE;
 
   // Fallback to the behavior prior to bug 530872 if the update does not have an
@@ -1643,15 +1653,13 @@ function Update(update) {
       if(!isNaN(attr.value))
         this.promptWaitTime = parseInt(attr.value);
     }
-    else if (attr.name == "unsupported")
-      this.unsupported = attr.value == "true";
     else if (attr.name == "version") {
       // Prevent version from replacing displayVersion if displayVersion is
       // present in the update xml.
       if (!this.displayVersion)
         this.displayVersion = attr.value;
     }
-    else {
+    else if (attr.name != "unsupported") {
       this[attr.name] = attr.value;
 
       switch (attr.name) {





More information about the tbb-commits mailing list