[tor-commits] [tor-launcher/master] Bug 11199 fixup: Improve behavior if tor exits.

brade at torproject.org brade at torproject.org
Thu Aug 14 20:41:18 UTC 2014


commit 3aa4860244adf99ba09911708ba8faa05a6cfa14
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Thu Aug 14 16:37:53 2014 -0400

    Bug 11199 fixup: Improve behavior if tor exits.
    
    Improved alert/error messages and button labels.
---
 src/chrome/content/network-settings-wizard.xul |    2 +-
 src/chrome/content/network-settings.js         |    7 ++++++-
 src/chrome/content/network-settings.xul        |    2 +-
 src/chrome/locale/en/torlauncher.properties    |    6 +++---
 src/chrome/skin/network-settings.css           |    1 +
 src/components/tl-process.js                   |   18 ++++++++++++++----
 src/modules/tl-util.jsm                        |    8 +++++---
 7 files changed, 31 insertions(+), 13 deletions(-)

diff --git a/src/chrome/content/network-settings-wizard.xul b/src/chrome/content/network-settings-wizard.xul
index 6a3b8fc..70d1bcf 100644
--- a/src/chrome/content/network-settings-wizard.xul
+++ b/src/chrome/content/network-settings-wizard.xul
@@ -168,7 +168,7 @@
     <spring flex="1" />
     <hbox>
       <spring flex="1" />
-      <description id="errorPanelMessage" />
+      <description id="errorPanelMessage" flex="1" />
       <spring flex="1" />
     </hbox>
     <separator/>
diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js
index fdd565e..0e84f92 100644
--- a/src/chrome/content/network-settings.js
+++ b/src/chrome/content/network-settings.js
@@ -491,15 +491,20 @@ function showErrorMessage(aTorExited, aErrorMsg)
   if (aTorExited)
   {
     // Show "Tor exited" message and "Restart Tor" button.
-    aErrorMsg = TorLauncherUtil.getLocalizedString("tor_exited");
+    aErrorMsg = TorLauncherUtil.getLocalizedString("tor_exited")
+                + "\n\n" + TorLauncherUtil.getLocalizedString("tor_exited2");
 
     if (btn)
       btn.removeAttribute("hidden");
+    if (elem)
+      elem.style.textAlign = "start";
   }
   else
   {
     if (btn)
       btn.setAttribute("hidden", true);
+    if (elem)
+      elem.style.textAlign = "center";
   }
 
   if (elem)
diff --git a/src/chrome/content/network-settings.xul b/src/chrome/content/network-settings.xul
index 937db71..a81a5f0 100644
--- a/src/chrome/content/network-settings.xul
+++ b/src/chrome/content/network-settings.xul
@@ -67,7 +67,7 @@
       <spring flex="1" />
       <hbox>
         <spring flex="1" />
-        <description id="errorPanelMessage" />
+        <description id="errorPanelMessage" flex="1" />
         <spring flex="1" />
       </hbox>
       <separator/>
diff --git a/src/chrome/locale/en/torlauncher.properties b/src/chrome/locale/en/torlauncher.properties
index bf2426a..816d831 100644
--- a/src/chrome/locale/en/torlauncher.properties
+++ b/src/chrome/locale/en/torlauncher.properties
@@ -3,8 +3,8 @@
 
 torlauncher.error_title=Tor Launcher
 
-torlauncher.tor_exited=Tor unexpectedly exited.
-torlauncher.tor_connection_lost=Your connection to the Tor Network has been lost.
+torlauncher.tor_exited=Tor unexpectedly exited. This might be due to a bug in Tor itself, another program on your system, or faulty hardware. Until you restart Tor, the Tor Browser will not able to reach any websites. If the problem persists, please send a copy of your Tor Log to the support team.
+torlauncher.tor_exited2=Restarting Tor will not close your browser tabs.
 torlauncher.tor_controlconn_failed=Could not connect to Tor control port.
 torlauncher.tor_failed_to_start=Tor failed to start.
 torlauncher.tor_control_failed=Failed to take control of Tor.
@@ -30,7 +30,7 @@ torlauncher.error_bridge_bad_default_type=No provided bridges that have the tran
 torlauncher.recommended_bridge=(recommended)
 
 torlauncher.connect=Connect
-torlauncher.reconnect=Reconnect
+torlauncher.restart_tor=Restart Tor
 torlauncher.quit=Quit
 torlauncher.quit_win=Exit
 torlauncher.done=Done
diff --git a/src/chrome/skin/network-settings.css b/src/chrome/skin/network-settings.css
index a823914..03f84d7 100644
--- a/src/chrome/skin/network-settings.css
+++ b/src/chrome/skin/network-settings.css
@@ -105,6 +105,7 @@ wizardpage[pageid="errorPanel"] description,
   font-size: 120%;
   font-weight: bold;
   white-space: pre-wrap;
+  text-align: center;
 }
 
 #restartButton {
diff --git a/src/components/tl-process.js b/src/components/tl-process.js
index 619a32c..cc5d654 100644
--- a/src/components/tl-process.js
+++ b/src/components/tl-process.js
@@ -148,11 +148,21 @@ TorProcessService.prototype =
       {
         this.mProtocolSvc.TorCleanupConnection();
 
-        var s = TorLauncherUtil.getLocalizedString("tor_exited");
+        var s = TorLauncherUtil.getLocalizedString("tor_exited") + "\n\n"
+                + TorLauncherUtil.getLocalizedString("tor_exited2");
         TorLauncherLogger.log(4, s);
-        s += "\n" + TorLauncherUtil.getLocalizedString("tor_connection_lost");
-        var btnLabel = TorLauncherUtil.getLocalizedString("reconnect");
-        if (TorLauncherUtil.showConfirm(null, s, btnLabel) && !this.mIsQuitting)
+        var defaultBtnLabel = TorLauncherUtil.getLocalizedString("restart_tor");
+        var cancelBtnLabel = "OK";
+        try
+        {
+          const kSysBundleURI = "chrome://global/locale/commonDialogs.properties";
+          var sysBundle = Cc["@mozilla.org/intl/stringbundle;1"]
+             .getService(Ci.nsIStringBundleService).createBundle(kSysBundleURI);
+          cancelBtnLabel = sysBundle.GetStringFromName(cancelBtnLabel);
+        } catch(e) {}
+
+        if (TorLauncherUtil.showConfirm(null, s, defaultBtnLabel, cancelBtnLabel)
+            && !this.mIsQuitting)
         {
           this._startTor();
           this._controlTor();
diff --git a/src/modules/tl-util.jsm b/src/modules/tl-util.jsm
index 1b8c809..834d260 100644
--- a/src/modules/tl-util.jsm
+++ b/src/modules/tl-util.jsm
@@ -64,7 +64,8 @@ let TorLauncherUtil =  // Public
   // Returns true if user confirms; false if not.
   // Note that no prompt is shown (and false is returned) if the Network Settings
   // window is open.
-  showConfirm: function(aParentWindow, aMsg, aOKButtonLabel)
+  showConfirm: function(aParentWindow, aMsg, aDefaultButtonLabel,
+                        aCancelButtonLabel)
   {
     try
     {
@@ -84,11 +85,12 @@ let TorLauncherUtil =  // Public
       var title = this.getLocalizedString("error_title");
       var btnFlags = (ps.BUTTON_POS_0 * ps.BUTTON_TITLE_IS_STRING)
                      + ps.BUTTON_POS_0_DEFAULT
-                     + (ps.BUTTON_POS_1 * ps.BUTTON_TITLE_CANCEL);
+                     + (ps.BUTTON_POS_1 * ps.BUTTON_TITLE_IS_STRING);
 
       var notUsed = { value: false };
       var btnIndex =  ps.confirmEx(aParentWindow, title, aMsg, btnFlags,
-                                   aOKButtonLabel, null, null, null, notUsed);
+                                   aDefaultButtonLabel, aCancelButtonLabel,
+                                   null, null, notUsed);
       return (0 == btnIndex);
     }
     catch (e)



More information about the tor-commits mailing list