[tor-launcher/master] Suppress repeated bootstrap error alerts.

commit 69c469efe1abc033224ea8219555e3aab9416a58 Author: Kathy Brade <brade@torproject.org> Date: Wed Apr 17 14:39:26 2013 -0400 Suppress repeated bootstrap error alerts. --- src/chrome/content/network-settings.js | 1 + src/components/tl-process.js | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/chrome/content/network-settings.js b/src/chrome/content/network-settings.js index 97dcf82..97e26d6 100644 --- a/src/chrome/content/network-settings.js +++ b/src/chrome/content/network-settings.js @@ -358,6 +358,7 @@ function applySettings() this.setConfAndReportErrors(settings); gProtocolSvc.TorSendCommand("SAVECONF"); + gTorProcessService.TorClearBootstrapError(); gIsBootstrapComplete = gTorProcessService.TorIsBootstrapDone; if (!gIsBootstrapComplete) diff --git a/src/components/tl-process.js b/src/components/tl-process.js index 4e73536..7781caf 100644 --- a/src/components/tl-process.js +++ b/src/components/tl-process.js @@ -210,6 +210,12 @@ TorProcessService.prototype = return this.mIsBootstrapDone; }, + TorClearBootstrapError: function() + { + this.mLastTorWarningPhase = null; + this.mLastTorWarningText = null; + }, + // Private Member Variables //////////////////////////////////////////////// mIsTorProcessReady: false, @@ -223,6 +229,8 @@ TorProcessService.prototype = mControlConnTimer: null, mControlConnDelayMS: 0, mQuitSoon: false, // Quit was requested by the user; do so soon. + mLastTorWarningPhase: null, + mLastTorWarningText: null, // Private Methods ///////////////////////////////////////////////////////// @@ -363,9 +371,16 @@ TorProcessService.prototype = TorLauncherUtil.setBoolPref(this.kPrefPromptAtStartup, true); TorLauncherLogger.log(5, "Tor bootstrap error: " + aStatusObj.WARNING); - var s = TorLauncherUtil.getFormattedLocalizedString( + if ((aStatusObj.TAG != this.mLastTorWarningPhase) || + (aStatusObj.WARNING != this.mLastTorWarningText)) + { + var s = TorLauncherUtil.getFormattedLocalizedString( "tor_bootstrap_failed", [aStatusObj.WARNING], 1); - TorLauncherUtil.showAlert(null, s); + TorLauncherUtil.showAlert(null, s); + + this.mLastTorWarningPhase = aStatusObj.TAG; + this.mLastTorWarningText = aStatusObj.WARNING; + } } } }, // _processBootstrapStatus()
participants (1)
-
brade@torproject.org