Commit 8a64ec3b authored by Kathleen Brade's avatar Kathleen Brade
Browse files

Bug #9675: Provide feedback mechanism for clock-skew and other bad problems

If a tor error or warning message is received by Tor Launcher, add a
caution icon to the "Open Settings" and "Copy Tor Log to Clipboard" buttons.
parent b709f9ff
......@@ -22,7 +22,7 @@ const kTorProcessReadyTopic = "TorProcessIsReady";
const kTorProcessExitedTopic = "TorProcessExited";
const kTorProcessDidNotStartTopic = "TorProcessDidNotStart";
const kTorBootstrapErrorTopic = "TorBootstrapError";
const kTorLogHasWarnOrErr = "TorLogHasWarnOrErr";
const kTorLogHasWarnOrErrTopic = "TorLogHasWarnOrErr";
const kWizardProxyRadioGroup = "proxyRadioGroup";
const kWizardFirewallRadioGroup = "firewallRadioGroup";
......@@ -120,7 +120,7 @@ function initDialog()
if (gTorProcessService.TorBootstrapErrorOccurred ||
gProtocolSvc.TorLogHasWarnOrErr)
{
wizardShowCopyLogButton();
showCopyLogButton(true);
}
// Use "Connect" as the finish button label (on the last wizard page)..
......@@ -143,7 +143,7 @@ function initDialog()
}
gObsService.addObserver(gObserver, kTorBootstrapErrorTopic, false);
gObsService.addObserver(gObserver, kTorLogHasWarnOrErr, false);
gObsService.addObserver(gObserver, kTorLogHasWarnOrErrTopic, false);
if (TorLauncherUtil.shouldStartAndOwnTor &&
!gTorProcessService.TorIsProcessReady)
......@@ -216,9 +216,10 @@ function showWizardNavButtons(aShow)
var gObserver = {
observe: function(aSubject, aTopic, aData)
{
if ((kTorBootstrapErrorTopic == aTopic) || (kTorLogHasWarnOrErr == aTopic))
if ((kTorBootstrapErrorTopic == aTopic) ||
(kTorLogHasWarnOrErrTopic == aTopic))
{
wizardShowCopyLogButton();
showCopyLogButton(true);
return;
}
......@@ -296,20 +297,28 @@ function showPanel(aPanelID)
function showErrorPanel()
{
showPanel("errorPanel");
wizardShowCopyLogButton();
showPanel("errorPanel");
var haveErrorOrWarning = (gTorProcessService.TorBootstrapErrorOccurred ||
gProtocolSvc.TorLogHasWarnOrErr)
showCopyLogButton(haveErrorOrWarning);
}
function wizardShowCopyLogButton()
function showCopyLogButton(aHaveErrorOrWarning)
{
if (getWizard())
var copyLogBtn = document.documentElement.getButton("extra2");
if (copyLogBtn)
{
var copyLogBtn = document.documentElement.getButton("extra2");
if (copyLogBtn)
{
if (getWizard())
copyLogBtn.setAttribute("wizardCanCopyLog", true);
copyLogBtn.removeAttribute("hidden");
copyLogBtn.removeAttribute("hidden");
if (aHaveErrorOrWarning)
{
var clz = copyLogBtn.getAttribute("class");
copyLogBtn.setAttribute("class", clz ? clz + " torWarning"
: "torWarning");
}
}
}
......
......@@ -9,6 +9,7 @@ const Cu = Components.utils;
const kTorProcessExitedTopic = "TorProcessExited";
const kBootstrapStatusTopic = "TorBootstrapStatus";
const kTorLogHasWarnOrErrTopic = "TorLogHasWarnOrErr";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TorLauncherUtil",
......@@ -26,6 +27,7 @@ function initDialog()
.getService(Ci.nsIObserverService);
gObsSvc.addObserver(gObserver, kTorProcessExitedTopic, false);
gObsSvc.addObserver(gObserver, kBootstrapStatusTopic, false);
gObsSvc.addObserver(gObserver, kTorLogHasWarnOrErrTopic, false);
}
catch (e) {}
......@@ -68,6 +70,7 @@ function cleanup()
{
gObsSvc.removeObserver(gObserver, kTorProcessExitedTopic);
gObsSvc.removeObserver(gObserver, kBootstrapStatusTopic);
gObsSvc.removeObserver(gObserver, kTorLogHasWarnOrErrTopic);
}
}
......@@ -155,5 +158,13 @@ var gObserver = {
if (labelText && desc)
desc.textContent = labelText;
}
else if (kTorLogHasWarnOrErrTopic == aTopic)
{
var extra2Btn = document.documentElement.getButton("extra2");
var clz = extra2Btn.getAttribute("class");
extra2Btn.setAttribute("class", clz ? clz + " torWarning" : "torWarning");
// TODO: show error / warning message in this dialog?
}
},
};
......@@ -128,3 +128,12 @@ dialog .help {
{
font-size: 120%;
}
.torWarning {
list-style-image: url("chrome://torlauncher/skin/warning.png");
}
/* Ensure that our caution icon is always shown on GTK-based platforms. */
.torWarning .button-icon {
display: inline !important;
}
......@@ -33,3 +33,12 @@ dialog {
#progressMeter {
margin-bottom: 16px;
}
.torWarning {
list-style-image: url("chrome://torlauncher/skin/warning.png");
}
/* Ensure that our caution icon is always shown on GTK-based platforms. */
.torWarning .button-icon {
display: inline !important;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment