GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit 1af54380 authored by Kathleen Brade's avatar Kathleen Brade

Bug 31300: Modify Tor Launcher so it is compatible with ESR68

Replace some wizard and dialog "on" attributes with event handlers.
Replace the XUL listbox element (which was removed by Mozilla) with
  richlistbox.
Replace the XUL progressmeter element (which was removed by Mozilla) with
  an HTML progress element.
Define our own CSS rules for groupbox elements (Mozilla removed the
  built-in styles).
Fix some minor CSS incompatibilities.
parent 8bc4a886
<?xml version="1.0"?>
<!--
- Copyright (c) 2017, The Tor Project, Inc.
- Copyright (c) 2019, The Tor Project, Inc.
- See LICENSE for licensing information.
- vim: set sw=2 sts=2 ts=8 et syntax=xml:
-->
......@@ -16,8 +16,6 @@
title="&torlauncher.localePicker.title;"
windowtype="TorLauncher:LocalePicker"
persist="screenX screenY"
onwizardfinish="return setLocale();"
onwizardcancel="return onCancel();"
onload="initLocaleDialog();">
<script type="application/x-javascript"
......@@ -31,7 +29,7 @@
<vbox>
<label class="question">&torlauncher.localePicker.prompt;</label>
<separator/>
<listbox id="localeList" ondblclick="onLocaleListDoubleClick()"/>
<richlistbox id="localeList" ondblclick="onLocaleListDoubleClick()"/>
</vbox>
</wizardpage>
......
......@@ -20,7 +20,7 @@ var proxySettings = `
<rows>
<row align="center">
<label value="&torsettings.useProxy.type;" control="proxyType"
style="text-align:right"/>
class="rightAlign"/>
<hbox align="center">
<menulist id="proxyType" sizetopopup="always"
placeholder="&torsettings.useProxy.type.placeholder;"
......@@ -38,7 +38,7 @@ var proxySettings = `
</row>
<row align="center">
<label value="&torsettings.useProxy.address;" control="proxyAddr"
style="text-align:right"/>
class="rightAlign"/>
<hbox align="center">
<textbox id="proxyAddr" size="20" flex="1"
placeholder="&torsettings.useProxy.address.placeholder;"/>
......@@ -50,7 +50,7 @@ var proxySettings = `
<row align="center">
<label id="proxyUsernameLabel"
value="&torsettings.useProxy.username;"
control="proxyUsername" style="text-align:right"/>
control="proxyUsername" class="rightAlign"/>
<hbox align="center">
<textbox id="proxyUsername" size="14" flex="1"
placeholder="&torsettings.optional;"/>
......@@ -146,7 +146,7 @@ var progressContent = `
<vbox flex="1">
<description id="progressPleaseWait"
hidden="true">&torprogress.pleaseWait;</description>
<progressmeter id="progressMeter" mode="determined" value="0"/>
<html:progress id="progressMeter" value="0" max="100"/>
<description id="progressDesc" errorElemId="message"/>
<label id="progressReconfigureLabel" hidden="true"
value="&torsettings.reconfigTor;"/>
......
<?xml version="1.0"?>
<!--
- Copyright (c) 2019, The Tor Project, Inc.
- See LICENSE for licensing information.
......@@ -17,15 +16,13 @@
windowtype="TorLauncher:NetworkSettings"
persist="screenX screenY"
buttonlabelextra2="&torsettings.copyLog;"
onwizardfinish="return onWizardFinish();"
onwizardcancel="return onCancel();"
onload="initDialog();"
onunload="deinitDialog();">
<script type="application/x-javascript"
src="chrome://torlauncher/content/network-settings.js"/>
<wizardpage pageid="first" next="configureSettings" onextra2="onCopyLog();"
<wizardpage pageid="first" next="configureSettings"
torShowNavButtons="false">
<hbox class="tbb-header" pack="center">
<image class="tbb-logo"/>
......@@ -44,7 +41,7 @@
</vbox>
</wizardpage>
<wizardpage pageid="configureSettings" onextra2="onCopyLog();"
<wizardpage pageid="configureSettings"
windowtitle="&torsettings.wizard.title.configure;"
torShowNavButtons="true">
<stack flex="1">
......@@ -63,11 +60,9 @@
</stack>
</wizardpage>
<wizardpage pageid="progress" onextra2="onCopyLog();"
<wizardpage pageid="progress"
windowtitle="&torsettings.wizard.title.connecting;"
torShowNavButtons="false"
onpageshow="onShowProgressPanel();"
onpagehide="return resetProgressNavButtons();">
torShowNavButtons="false">
<vbox id="progressContent"/>
</wizardpage>
......@@ -86,12 +81,12 @@
</wizardpage>
<wizardpage pageid="restartPanel" class="messagePanel" next="notUsed"
pack="center" torShowNavButtons="false" onextra2="onCopyLog();">
pack="center" torShowNavButtons="false">
<vbox id="restartContent"/>
</wizardpage>
<wizardpage pageid="errorPanel" class="messagePanel" next="notUsed"
torShowNavButtons="false" onextra2="onCopyLog();">
torShowNavButtons="false">
<spring flex="1"/>
<hbox pack="center">
<description errorElemId="message" flex="1"/>
......@@ -104,8 +99,8 @@
<spring flex="1"/>
</wizardpage>
<wizardpage pageid="discardSettings" next="notUsed" torShowNavButtons="false"
onextra2="onCopyLog();">
<wizardpage pageid="discardSettings" next="notUsed"
torShowNavButtons="false">
<hbox class="tbb-header" pack="center">
<image class="tbb-logo"/>
</hbox>
......@@ -123,8 +118,7 @@
<spring flex="1"/>
</wizardpage>
<wizardpage class="help" pageid="helpPanel" next="notUsed"
onpageadvanced="closeHelp(); return false;">
<wizardpage class="help" pageid="helpPanel" next="notUsed">
<vbox id="bridgeHelpContent"/>
<vbox id="proxyHelpContent"/>
</wizardpage>
......
......@@ -157,6 +157,51 @@ function initDialogCommon()
.getService(Ci.nsIEnvironment);
if (env.exists("TOR_HIDE_BROWSER_LOGO"))
wizardElem.setAttribute("tor_hide_browser_logo", true);
// Add wizard event listeners.
document.addEventListener("wizardcancel", (aEvent) => {
if (!onCancel())
aEvent.preventDefault();
});
document.addEventListener("pageadvanced", (aEvent) => {
if ("helpPanel" == wizardElem.currentPage.pageid)
{
closeHelp();
aEvent.preventDefault();
}
});
document.addEventListener("pageshow", (aEvent) => {
if (kWizardProgressPageID == wizardElem.currentPage.pageid)
onShowProgressPanel();
});
document.addEventListener("pagehide", (aEvent) => {
if (kWizardProgressPageID == wizardElem.currentPage.pageid)
resetProgressNavButtons();
});
document.addEventListener("extra2", (aEvent) => {
onCopyLog();
});
}
else
{
// Add network settings dialog event listeners.
document.addEventListener("dialogaccept", (aEvent) => {
if (!onNetworkSettingsFinish())
aEvent.preventDefault();
});
document.addEventListener("dialogcancel", (aEvent) => {
if (!onCancel())
aEvent.preventDefault();
});
document.addEventListener("dialogextra2", (aEvent) => {
onCopyLog();
});
}
}
......@@ -239,6 +284,12 @@ function initDialog()
let haveWizard = (wizardElem != null);
if (haveWizard)
{
// Add wizardfinish event handler.
document.addEventListener("wizardfinish", (aEvent) => {
if (!onWizardFinish())
aEvent.preventDefault();
});
// Relabel the accept button to be "Connect"
let okBtn = document.documentElement.getButton("accept");
if (okBtn)
......@@ -316,6 +367,11 @@ function initLocaleDialog()
{
initDialogCommon();
// Add wizardfinish event handler.
document.addEventListener("wizardfinish", (aEvent) => {
setLocale();
});
// Replace the finish button's label ("Done") with the next button's
// label ("Next" or "Continue").
let nextBtn = document.documentElement.getButton("next");
......@@ -324,7 +380,8 @@ function initLocaleDialog()
doneBtn.label = nextBtn.label;
let { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm");
AddonManager.getAddonsByTypes(["locale"], function(aLangPackAddons)
let addonsPromise = AddonManager.getAddonsByTypes(["locale"]);
addonsPromise.then(aLangPackAddons =>
{
populateLocaleList(aLangPackAddons);
resizeDialogToFitContent();
......@@ -421,13 +478,15 @@ function populateLocaleList(aLangPackAddons)
langInfo.splice(0, 0,
{ langCode: code, langName: name, isSelected: isSelected });
// Populate the XUL listbox.
// Populate the XUL richlistbox.
let localeList = document.getElementById(kLocaleList);
for (let infoObj of langInfo)
{
let listItem = document.createElement("listitem");
let listItem = document.createElement("richlistitem");
listItem.setAttribute("value", infoObj.langCode);
listItem.setAttribute("label", infoObj.langName);
let label = document.createElement("label");
label.value = infoObj.langName;
listItem.appendChild(label);
localeList.appendChild(listItem);
if (infoObj.isSelected)
localeList.selectedItem = listItem;
......@@ -807,7 +866,6 @@ function resetProgressNavButtons()
restoreButtonLabel("finish");
showOrHideButton("cancel", true, false);
return true;
}
......@@ -905,7 +963,7 @@ function updateBootstrapProgress(aStatusObj)
let meter = document.getElementById("progressMeter");
if (meter)
{
meter.value = percentComplete;
meter.setAttribute("value", percentComplete);
showProgressMeterIfNoError();
}
......@@ -1968,7 +2026,7 @@ function showProgressPanel()
let meter = document.getElementById("progressMeter");
if (meter)
{
meter.value = 0;
meter.setAttribute("value", 0);
meter.style.visibility = "hidden";
}
......@@ -2428,7 +2486,7 @@ function setElemValue(aID, aValue)
}
// fallthru
case "menulist":
case "listbox":
case "richlistbox":
case "label":
elem.value = (val) ? val : "";
break;
......@@ -2482,7 +2540,7 @@ function getElemValue(aID, aDefaultValue)
break;
case "textbox":
case "menulist":
case "listbox":
case "richlistbox":
rv = elem.value;
break;
}
......
......@@ -18,9 +18,6 @@
persist="screenX screenY"
buttons="accept,cancel,extra2"
buttonlabelextra2="&torsettings.copyLog;"
ondialogaccept="return onNetworkSettingsFinish();"
ondialogcancel="return onCancel();"
ondialogextra2="onCopyLog();"
onload="initDialog();"
onunload="deinitDialog();">
......
/*
* Copyright (c) 2018, The Tor Project, Inc.
* Copyright (c) 2019, The Tor Project, Inc.
* See LICENSE for licensing information.
*
* vim: set sw=2 sts=2 ts=8 et syntax=css:
......@@ -47,8 +47,14 @@ wizard label {
margin: 0px;
}
wizard radiogroup {
margin: 5px 0px 8px 25px;
.rightAlign {
text-align: right;
}
groupbox {
margin-left: 16px;
padding: 8px;
border: 1px solid GrayText;
}
.tbb-header groupbox {
......@@ -57,7 +63,7 @@ wizard radiogroup {
margin-bottom: 0px;
}
.firstResponses label {
.firstResponses > label {
text-align: center;
margin-top: 1.2em;
}
......
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