[tbb-commits] [torbutton/master] Bug 13406: Stop directing users to download-easy.html.en

mikeperry at torproject.org mikeperry at torproject.org
Tue Feb 10 22:03:26 UTC 2015


commit 2ccb9cb66415e4f5de5fc4b496272921cac6614f
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Mon Feb 9 11:19:33 2015 -0500

    Bug 13406: Stop directing users to download-easy.html.en
    
    Always display a "Check for Tor Browser Update..." menu item (to avoid
    localization issues, the menu item label entity was not renamed).  When the
    menu item is chosen, open the Update Service prompt window to perform the
    update check.
---
 src/chrome/content/popup.xul       |    7 +++----
 src/chrome/content/torbutton.js    |   30 +++++++++---------------------
 src/chrome/locale/en/aboutTor.dtd  |    4 ++--
 src/chrome/locale/en/torbutton.dtd |    2 +-
 src/chrome/skin/torbutton.css      |    4 ++--
 5 files changed, 17 insertions(+), 30 deletions(-)

diff --git a/src/chrome/content/popup.xul b/src/chrome/content/popup.xul
index 5f12f2b..e61dcfe 100644
--- a/src/chrome/content/popup.xul
+++ b/src/chrome/content/popup.xul
@@ -37,13 +37,12 @@
                   label="&torbutton.context_menu.networksettings;"
                   accesskey="&torbutton.context_menu.networksettings.key;"
                   oncommand="torbutton_open_network_settings()"/>
-        <menuseparator hidden="true"/>
-        <menuitem id="torbutton-downloadUpdate"
+        <menuseparator/>
+        <menuitem id="torbutton-checkForUpdate"
                   label="&torbutton.context_menu.downloadUpdate;"
                   accesskey="&torbutton.context_menu.downloadUpdate.key;"
                   insertafter="context-stop"
-                  oncommand="torbutton_download_update()"
-                  hidden="true"/>
+                  oncommand="torbutton_check_for_update()"/>
         </vbox>
         <vbox>
          <!-- The following SVG is used to display a Tor circuit diagram for the current tab.
diff --git a/src/chrome/content/torbutton.js b/src/chrome/content/torbutton.js
index 9cdb792..916b863 100644
--- a/src/chrome/content/torbutton.js
+++ b/src/chrome/content/torbutton.js
@@ -864,27 +864,15 @@ function torbutton_notify_if_update_needed() {
     // Update all open about:tor pages.
     torbutton_update_all_abouttor_pages(updateNeeded, undefined);
 
-    // Hide/show download menu item and preceding separator.
-    var item = document.getElementById("torbutton-downloadUpdate");
-    setOrClearAttribute(item, "hidden", !updateNeeded);
-    if (item)
-        setOrClearAttribute(item.previousSibling, "hidden", !updateNeeded);
-}
-
-function torbutton_download_update() {
-    var downloadURI = "https://www.torproject.org/download/download-easy.html";
-    var rtSvc = Components.classes["@mozilla.org/xre/app-info;1"]
-                          .getService(Components.interfaces.nsIXULRuntime);
-    downloadURI += "?os=" + rtSvc.OS + "&arch=" + rtSvc.XPCOMABI;
-    if (rtSvc.OS == "Darwin")
-      downloadURI += "#mac";
-    else if (rtSvc.OS == "WINNT")
-      downloadURI += "#win";
-    else if (rtSvc.OS == "Linux")
-      downloadURI += "#linux";
-
-    var newTab = gBrowser.addTab(downloadURI);
-    gBrowser.selectedTab = newTab;
+    // Make the "check for update" menu item bold if an update is needed.
+    var item = document.getElementById("torbutton-checkForUpdate");
+    setOrClearAttribute(item, "tbUpdateNeeded", updateNeeded);
+}
+
+function torbutton_check_for_update() {
+    let prompter = Cc["@mozilla.org/updates/update-prompt;1"]
+                     .createInstance(Ci.nsIUpdatePrompt);
+    prompter.checkForUpdates();
 }
 
 // Pass undefined for a parameter to have this function determine it.
diff --git a/src/chrome/locale/en/aboutTor.dtd b/src/chrome/locale/en/aboutTor.dtd
index 7128bb8..6f63ff7 100644
--- a/src/chrome/locale/en/aboutTor.dtd
+++ b/src/chrome/locale/en/aboutTor.dtd
@@ -1,5 +1,5 @@
 <!--
-   - Copyright (c) 2014, The Tor Project, Inc.
+   - Copyright (c) 2015, The Tor Project, Inc.
    - See LICENSE for licensing information.
    - vim: set sw=2 sts=2 ts=8 et syntax=xml:
   -->
@@ -8,7 +8,7 @@
 
 <!ENTITY aboutTor.outOfDateTorOn.label "HOWEVER, this browser is out of date.">
 <!ENTITY aboutTor.outOfDateTorOff.label "ALSO, this browser is out of date.">
-<!ENTITY aboutTor.outOfDate2.label "Click on the onion and then choose Download Tor Browser Bundle Update.">
+<!ENTITY aboutTor.outOfDate2.label "Click on the onion and then choose Check for Tor Browser Update.">
 
 <!ENTITY aboutTor.check.label "Test Tor Network Settings">
 
diff --git a/src/chrome/locale/en/torbutton.dtd b/src/chrome/locale/en/torbutton.dtd
index 72c7d41..9709670 100644
--- a/src/chrome/locale/en/torbutton.dtd
+++ b/src/chrome/locale/en/torbutton.dtd
@@ -32,7 +32,7 @@
 <!ENTITY torbutton.context_menu.about.key "A">
 <!ENTITY torbutton.context_menu.networksettings "Open Network Settings…">
 <!ENTITY torbutton.context_menu.networksettings.key "S">
-<!ENTITY torbutton.context_menu.downloadUpdate "Download Tor Browser Bundle Update...">
+<!ENTITY torbutton.context_menu.downloadUpdate "Check for Tor Browser Update...">
 <!ENTITY torbutton.context_menu.downloadUpdate.key "U">
 <!ENTITY torbutton.context_menu.cookieProtections "Cookie Protections">
 <!ENTITY torbutton.context_menu.cookieProtections.key "C">
diff --git a/src/chrome/skin/torbutton.css b/src/chrome/skin/torbutton.css
index f368c9c..2c6bbfb 100644
--- a/src/chrome/skin/torbutton.css
+++ b/src/chrome/skin/torbutton.css
@@ -101,7 +101,7 @@ statusbarpanel#plugins-status[status="0"] {
     list-style-image: url("chrome://torbutton/skin/poff.png");
 }
 
-#torbutton-downloadUpdate {
+#torbutton-checkForUpdate[tbUpdateNeeded] {
     font-weight: bold;
 }
 
@@ -118,4 +118,4 @@ svg#tor-circuit circle.node-circle {
     stroke: #195021;
     stroke-width: 2px;
     fill: white;
-}
\ No newline at end of file
+}





More information about the tbb-commits mailing list