[tbb-commits] [torbutton/master] Bug 24159: version check does not deal with platform specific checks

gk at torproject.org gk at torproject.org
Thu Jan 25 20:29:54 UTC 2018


commit f8604998e58fdece9c191661121ada6a3b911499
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Tue Jan 23 16:04:11 2018 -0500

    Bug 24159: version check does not deal with platform specific checks
    
    For known platforms, append "-Windows", "-Linux", "-MacOS", or "-Android"
    to torbrowser.version before checking against the recommended versions
    JSON file. This allows for platform differences in the supported version.
---
 src/chrome/content/torbutton.js | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 9abc1c5..7e78ff5 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -752,12 +752,27 @@ function torbutton_do_async_versioncheck() {
           try {
             var version_list = JSON.parse(req.responseText);
             var my_version = m_tb_prefs.getCharPref("torbrowser.version");
-            for (var v in version_list) {
-              if (version_list[v] == my_version) {
-                torbutton_log(3, "Version check passed.");
-                m_tb_prefs.setBoolPref(k_tb_browser_update_needed_pref, false);
-                return;
-              }
+            var platformSuffix;
+            var platform = Services.appinfo.OS;
+            switch (platform) {
+              case "WINNT":
+                platformSuffix = "Windows";
+                break;
+              case "Darwin":
+                platformSuffix = "MacOS";
+                break;
+              case "Linux":
+              case "Android":
+                platformSuffix = platform;
+                break;
+            }
+            if (platformSuffix)
+              my_version += "-" + platformSuffix;
+
+            if (version_list.indexOf(my_version) >= 0) {
+              torbutton_log(3, "Version check passed.");
+              m_tb_prefs.setBoolPref(k_tb_browser_update_needed_pref, false);
+              return;
             }
             torbutton_log(5, "Your Tor Browser is out of date.");
             m_tb_prefs.setBoolPref(k_tb_browser_update_needed_pref, true);



More information about the tbb-commits mailing list