[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-launcher/master] Improve error display when tor fails to start.



commit 5880ff99682b9b94c5a80d8932b8465c04127507
Author: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
Date:   Mon Jul 14 16:44:13 2014 -0400

    Improve error display when tor fails to start.
---
 src/chrome/content/network-settings-wizard.xul |   19 ++++++++++++++++---
 src/chrome/content/network-settings.js         |   23 +++++++++--------------
 src/chrome/skin/network-settings.css           |    1 +
 src/components/tl-process.js                   |    2 +-
 4 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/src/chrome/content/network-settings-wizard.xul b/src/chrome/content/network-settings-wizard.xul
index 07fcdcd..da1e275 100644
--- a/src/chrome/content/network-settings-wizard.xul
+++ b/src/chrome/content/network-settings-wizard.xul
@@ -26,8 +26,10 @@
   <script type="application/x-javascript"
           src="chrome://torlauncher/content/network-settings.js"/>
 
+  <!-- This page requires a setTimeout for onpageshow because it may be
+       shown first -->
   <wizardpage label=" " pageid="first" next="proxy" onextra2="onCopyLog();"
-              onpageshow="setTimeout(function() { showWizardNavButtons(); }, 0);">
+              onpageshow="setTimeout(function() { showWizardNavButtons(false); }, 0);">
     <hbox class="tbb-header">
       <vbox class="tbb-logo-box" align="start">
         <image class="tbb-logo" />
@@ -52,7 +54,7 @@
   </wizardpage>
 
   <wizardpage label=" " pageid="proxy" next="firewall" onextra2="onCopyLog();"
-              onpageshow="showWizardNavButtons();"
+              onpageshow="showWizardNavButtons(true);"
               onpageadvanced="return onWizardProxyNext(this);">
     <vbox class="tbb-logo-box" align="start">
       <image class="tbb-logo" />
@@ -146,7 +148,10 @@
     </vbox>
   </wizardpage>
 
-  <wizardpage label=" " pageid="startingTor" next="first">
+  <!-- This page requires a setTimeout for onpageshow because it may be
+       shown first -->
+  <wizardpage label=" " pageid="startingTor" next="notUsed"
+              onpageshow="setTimeout(function() { showWizardNavButtons(false); }, 0);">
     <spring flex="1" />
     <hbox>
       <spring flex="1" />
@@ -163,7 +168,15 @@
   </wizardpage>
 
   <wizardpage label=" " pageid="errorPanel" next="notUsed"
+              onpageshow="showWizardNavButtons(false);"
               onextra2="onCopyLog();">
+    <spring flex="1" />
+    <hbox>
+      <spring flex="1" />
+      <description id="errorPanelMessage" flex="1"/>
+      <spring flex="1" />
+    </hbox>
+    <spring flex="1" />
   </wizardpage>
 
   <wizardpage class="help"  label=" " pageid="bridgeHelp" next="notUsed"
diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js
index 2f1d619..4c922bb 100644
--- a/src/chrome/content/network-settings.js
+++ b/src/chrome/content/network-settings.js
@@ -305,13 +305,10 @@ function onBridgeTypeRadioChange()
 }
 
 
-function showWizardNavButtons()
+function showWizardNavButtons(aShowBtns)
 {
-  var curPage = getWizard().currentPage;
-  var isFirstPage = ("first" == curPage.pageid);
-
-  showOrHideButton("back", !isFirstPage, false);
-  showOrHideButton("next", !isFirstPage && curPage.next, false);
+  showOrHideButton("back", aShowBtns, false);
+  showOrHideButton("next", aShowBtns, false);
 }
 
 
@@ -340,7 +337,7 @@ var gObserver = {
     else if (kTorProcessDidNotStartTopic == aTopic)
     {
       gObsService.removeObserver(gObserver, kTorProcessDidNotStartTopic);
-      showErrorPanel();
+      showErrorPanel(aData);
     }
     else if (kTorProcessExitedTopic == aTopic)
     {
@@ -443,18 +440,16 @@ function showStartingTorPanel(aTorExited)
   }
 
   showPanel("startingTor");
-  var haveWizard = (getWizard() != null);
-  if (haveWizard)
-  {
-    showOrHideButton("back", false, false);
-    showOrHideButton("next", false, false);
-  }
 }
 
 
-function showErrorPanel()
+function showErrorPanel(aErrorMsg)
 {
   showPanel("errorPanel");
+  var elem = document.getElementById("errorPanelMessage");
+  if (elem)
+    elem.textContent = (aErrorMsg) ? aErrorMsg : "";
+
   var haveErrorOrWarning = (gTorProcessService.TorBootstrapErrorOccurred ||
                             gProtocolSvc.TorLogHasWarnOrErr)
   showCopyLogButton(haveErrorOrWarning);
diff --git a/src/chrome/skin/network-settings.css b/src/chrome/skin/network-settings.css
index c27878c..b35eb52 100644
--- a/src/chrome/skin/network-settings.css
+++ b/src/chrome/skin/network-settings.css
@@ -103,6 +103,7 @@ button.firstAnswer {
 }
 
 wizardpage[pageid="startingTor"] description,
+wizardpage[pageid="errorPanel"] description,
 #startingTor description {
   font-size: 120%;
   font-weight: bold;
diff --git a/src/components/tl-process.js b/src/components/tl-process.js
index fb795dd..2d3a3a3 100644
--- a/src/components/tl-process.js
+++ b/src/components/tl-process.js
@@ -176,8 +176,8 @@ TorProcessService.prototype =
         else if ((Date.now() - this.mTorProcessStartTime)
                  > this.kControlConnTimeoutMS)
         {
-          this.mObsSvc.notifyObservers(null, "TorProcessDidNotStart", null);
           var s = TorLauncherUtil.getLocalizedString("tor_controlconn_failed");
+          this.mObsSvc.notifyObservers(null, "TorProcessDidNotStart", s);
           TorLauncherUtil.showAlert(null, s);
           TorLauncherLogger.log(4, s);
         }

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits