[tor-commits] [tor-launcher/master] Move back to the correct wizard panel upon error.

brade at torproject.org brade at torproject.org
Fri May 3 03:08:07 UTC 2013


commit 54c15a465f67f47c4cd867986328342289c0cbef
Author: Kathy Brade <brade at torproject.org>
Date:   Thu May 2 23:06:40 2013 -0400

    Move back to the correct wizard panel upon error.
---
 src/chrome/content/network-settings.js |   31 ++++++++++++++++++++++++-------
 1 files changed, 24 insertions(+), 7 deletions(-)

diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js
index 839d3d2..b3f4fb0 100644
--- a/src/chrome/content/network-settings.js
+++ b/src/chrome/content/network-settings.js
@@ -389,8 +389,8 @@ function onProxyTypeChange()
 {
   var proxyType = getElemValue(kProxyTypeMenulist, null);
   var mayHaveCredentials = (proxyType != "SOCKS4");
-  enableTextBox(kProxyUsername, mayHaveCredentials); 
-  enableTextBox(kProxyPassword, mayHaveCredentials); 
+  enableTextBox(kProxyUsername, mayHaveCredentials);
+  enableTextBox(kProxyPassword, mayHaveCredentials);
 }
 
 
@@ -619,7 +619,7 @@ function applySettings()
   {
     var settings = {};
     settings[kTorConfKeyDisableNetwork] = "0";
-    this.setConfAndReportErrors(settings);
+    this.setConfAndReportErrors(settings, null);
 
     gProtocolSvc.TorSendCommand("SAVECONF");
     gTorProcessService.TorClearBootstrapError();
@@ -660,7 +660,7 @@ function applyProxySettings()
   if (!settings)
     return false;
 
-  return this.setConfAndReportErrors(settings);
+  return this.setConfAndReportErrors(settings, "proxyYES");
 }
 
 
@@ -739,7 +739,7 @@ function applyFirewallSettings()
   if (!settings)
     return false;
 
-  return this.setConfAndReportErrors(settings);
+  return this.setConfAndReportErrors(settings, "firewallYES");
 }
 
 
@@ -786,7 +786,7 @@ function applyBridgeSettings()
   if (!settings)
     return false;
 
-  return this.setConfAndReportErrors(settings);
+  return this.setConfAndReportErrors(settings, "bridges");
 }
 
 
@@ -856,7 +856,7 @@ function parseAndValidateBridges(aStr)
 
 
 // Returns true if successful.
-function setConfAndReportErrors(aSettingsObj)
+function setConfAndReportErrors(aSettingsObj, aShowOnErrorPanelID)
 {
   var reply = gProtocolSvc.TorSetConf(aSettingsObj);
   var didSucceed = gProtocolSvc.TorCommandSucceeded(reply);
@@ -873,6 +873,23 @@ function setConfAndReportErrors(aSettingsObj)
       }
     }
 
+    if (aShowOnErrorPanelID)
+    {
+      var wizardElem = getWizard();
+      if (wizardElem) try
+      {
+        const kMaxTries = 10;
+        for (var count = 0;
+             ((count < kMaxTries) &&
+              (wizardElem.currentPage.pageid != aShowOnErrorPanelID) &&
+              wizardElem.canRewind);
+             ++count)
+        {
+          wizardElem.rewind();
+        }
+      } catch (e) {}
+    }
+
     showSaveSettingsAlert(details);
   }
 



More information about the tor-commits mailing list