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 1807842b authored by Georg Koppen's avatar Georg Koppen

Merge remote-tracking branch 'pc/bug34164-01'

parents b4838d33 98f3df12
<?xml version="1.0"?>
<!--
- Copyright (c) 2019, The Tor Project, Inc.
- Copyright (c) 2020, The Tor Project, Inc.
- See LICENSE for licensing information.
- vim: set sw=2 sts=2 ts=8 et syntax=xml:
-->
......@@ -9,15 +9,22 @@
<?xml-stylesheet href="chrome://torlauncher/skin/network-settings.css"
type="text/css"?>
<!DOCTYPE wizard SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
<!DOCTYPE window SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
<wizard id="TorLauncherLocalePicker"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
torwizard="true"
title="&torlauncher.localePicker.title;"
windowtype="TorLauncher:LocalePicker"
persist="screenX screenY"
onload="initLocaleDialog();">
<!-- Work around a fluent bug in the wizard code (see Mozilla bug 1625938) -->
<linkset>
<html:link rel="localization" href="toolkit/global/wizard.ftl"/>
</linkset>
<wizard id="TorLauncherLocalePicker">
<script type="application/x-javascript"
src="chrome://torlauncher/content/network-settings.js"/>
......@@ -37,3 +44,4 @@
<label id="forAssistance"/>
</hbox>
</wizard>
</window>
......@@ -40,11 +40,11 @@ var proxySettings = `
<label value="&torsettings.useProxy.address;" control="proxyAddr"
class="rightAlign"/>
<hbox align="center">
<textbox id="proxyAddr" size="20" flex="1"
<html:input id="proxyAddr" size="20" style="-moz-box-flex: 1;"
placeholder="&torsettings.useProxy.address.placeholder;"/>
<separator orient="vertical"/>
<label value="&torsettings.useProxy.port;" control="proxyPort"/>
<textbox id="proxyPort" size="4"/>
<html:input id="proxyPort" size="4"/>
</hbox>
</row>
<row align="center">
......@@ -52,13 +52,13 @@ var proxySettings = `
value="&torsettings.useProxy.username;"
control="proxyUsername" class="rightAlign"/>
<hbox align="center">
<textbox id="proxyUsername" size="14" flex="1"
<html:input id="proxyUsername" size="14" style="-moz-box-flex: 1;"
placeholder="&torsettings.optional;"/>
<separator orient="vertical"/>
<label id="proxyPasswordLabel"
value="&torsettings.useProxy.password;"
control="proxyPassword"/>
<textbox id="proxyPassword" size="14" type="password"
<html:input id="proxyPassword" size="14" type="password"
placeholder="&torsettings.optional;"/>
</hbox>
</row>
......@@ -175,7 +175,7 @@ var bridgeDBRequestOverlayContent = `
<hbox>
<spacer id="bridgeDBReloadSpacer"/>
<spacer flex="1"/>
<textbox id="bridgeDBCaptchaSolution" size="35"
<html:input id="bridgeDBCaptchaSolution" size="35"
placeholder="&torsettings.useBridges.captchaSolution.placeholder;"
oninput="onCaptchaSolutionChange()"/>
<spacer flex="1"/>
......
<!--
- Copyright (c) 2019, The Tor Project, Inc.
- Copyright (c) 2020, The Tor Project, Inc.
- See LICENSE for licensing information.
- vim: set sw=2 sts=2 ts=8 et syntax=xml:
-->
......@@ -8,18 +8,24 @@
<?xml-stylesheet href="chrome://torlauncher/skin/network-settings.css"
type="text/css"?>
<!DOCTYPE wizard SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
<!DOCTYPE window SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
<wizard id="TorNetworkSettings"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
defaulttitle="&torsettings.wizard.title.default;"
torwizard="true"
windowtype="TorLauncher:NetworkSettings"
persist="screenX screenY"
buttonlabelextra2="&torsettings.copyLog;"
onload="initDialog();"
onunload="deinitDialog();">
<!-- Work around a fluent bug in the wizard code (see Mozilla bug 1625938) -->
<linkset>
<html:link rel="localization" href="toolkit/global/wizard.ftl"/>
</linkset>
<wizard id="TorNetworkSettings"
defaulttitle="&torsettings.wizard.title.default;"
buttonlabelextra2="&torsettings.copyLog;">
<script type="application/x-javascript"
src="chrome://torlauncher/content/network-settings.js"/>
......@@ -129,3 +135,4 @@
</hbox>
<panel id="copyLogFeedbackPanel"/>
</wizard>
</window>
// Copyright (c) 2019, The Tor Project, Inc.
// Copyright (c) 2020, The Tor Project, Inc.
// See LICENSE for licensing information.
//
// vim: set sw=2 sts=2 ts=8 et syntax=javascript:
......@@ -20,7 +20,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "TorLauncherBridgeDB",
"resource://torlauncher/modules/tl-bridgedb.jsm");
const kPrefPromptForLocale = "extensions.torlauncher.prompt_for_locale";
const kPrefLocale = "general.useragent.locale";
const kPrefLocale = "intl.locale.requested";
const kPrefMatchOSLocale = "intl.locale.matchOS";
// The recommended type is listed first in the dropdown menu.
......@@ -138,7 +138,7 @@ function initDialogCommon()
let wizardElem = getWizard();
let haveWizard = (wizardElem != null);
let cancelBtn = document.documentElement.getButton("cancel");
let cancelBtn = getButton("cancel");
if (cancelBtn)
{
gCancelLabelStr = cancelBtn.label;
......@@ -151,6 +151,18 @@ function initDialogCommon()
if (haveWizard)
{
// Apply styles to elements within the wizard element's shadow DOM.
let wizardPageBox = wizardElem.shadowRoot.querySelector(".wizard-page-box");
if (wizardPageBox)
{
wizardPageBox.style.padding = "0px";
wizardPageBox.style.margin = "14px 20px 18px 20px";
}
let wizardHeader = wizardElem.shadowRoot.querySelector(".wizard-header");
if (wizardHeader)
wizardHeader.style.display = "none";
// Hide the Tor Browser logo and associated separator element if the
// TOR_HIDE_BROWSER_LOGO environment variable is set.
let env = Cc["@mozilla.org/process/environment;1"]
......@@ -291,16 +303,16 @@ function initDialog()
});
// Relabel the accept button to be "Connect"
let okBtn = document.documentElement.getButton("accept");
let okBtn = getButton("accept");
if (okBtn)
okBtn.label = TorLauncherUtil.getLocalizedString("connect");
// Set "Copy Tor Log" label and move it after the Quit (cancel) button.
let copyLogBtn = document.documentElement.getButton("extra2");
let copyLogBtn = getButton("extra2");
if (copyLogBtn)
{
copyLogBtn.label = wizardElem.getAttribute("buttonlabelextra2");
let cancelBtn = document.documentElement.getButton("cancel");
let cancelBtn = getButton("cancel");
if (cancelBtn && TorLauncherUtil.isMac)
cancelBtn.parentNode.insertBefore(copyLogBtn, cancelBtn.nextSibling);
}
......@@ -312,7 +324,7 @@ function initDialog()
}
// Use "Connect" as the finish button label (on the last wizard page).
let finishBtn = document.documentElement.getButton("finish");
let finishBtn = getButton("finish");
if (finishBtn)
{
finishBtn.label = TorLauncherUtil.getLocalizedString("connect");
......@@ -320,7 +332,7 @@ function initDialog()
}
// Set Discard Settings back button label to match the wizard Back button.
let wizardBackBtn = document.documentElement.getButton("back");
let wizardBackBtn = getButton("back");
let backBtn = document.getElementById("discardSettingsGoBack");
if (wizardBackBtn && backBtn)
backBtn.label = wizardBackBtn.label;
......@@ -374,11 +386,18 @@ function initLocaleDialog()
// Replace the finish button's label ("Done") with the next button's
// label ("Next" or "Continue").
let nextBtn = document.documentElement.getButton("next");
let doneBtn = document.documentElement.getButton("finish");
let nextBtn = getButton("next");
let doneBtn = getButton("finish");
if (nextBtn && doneBtn)
doneBtn.label = nextBtn.label;
// The locale picker does not use the "Back" and "Next" buttons; hide them.
let backBtn = getButton("back");
if (backBtn)
backBtn.style.display = "none";
if (nextBtn)
nextBtn.style.display = "none";
let { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm");
let addonsPromise = AddonManager.getAddonsByTypes(["locale"]);
addonsPromise.then(aLangPackAddons =>
......@@ -432,13 +451,9 @@ function populateLocaleList(aLangPackAddons)
};
// Retrieve the current locale so we can select it within the list by default.
let curLocale;
try
{
let chromeRegSvc = Cc["@mozilla.org/chrome/chrome-registry;1"]
.getService(Ci.nsIXULChromeRegistry);
curLocale = chromeRegSvc.getSelectedLocale("global").toLowerCase();
} catch (e) {}
let curLocale = Services.locale.requestedLocale;
if (curLocale)
curLocale = curLocale.toLowerCase();
// Build a list of language info objects (language code plus friendly name).
let foundCurLocale = false;
......@@ -485,9 +500,9 @@ function populateLocaleList(aLangPackAddons)
let localeList = document.getElementById(kLocaleList);
for (let infoObj of langInfo)
{
let listItem = document.createElement("richlistitem");
let listItem = document.createXULElement("richlistitem");
listItem.setAttribute("value", infoObj.langCode);
let label = document.createElement("label");
let label = document.createXULElement("label");
label.value = infoObj.langName;
listItem.appendChild(label);
localeList.appendChild(listItem);
......@@ -517,7 +532,7 @@ function maxWidthOfContent()
for (let i = 0; i < buttons.length; ++i)
showOrHideButton(buttons[i], true, false);
let btn = document.documentElement.getButton("cancel");
let btn = getButton("cancel");
let btnContainer = btn.parentElement;
const kWarningIconWidth = 20; // skin/warning.png is 16 plus some margin
......@@ -991,7 +1006,7 @@ function updateBootstrapProgress(aStatusObj)
// visibility=hidden instead of XUL hidden=true so that the "For
// Assistance" text does not move.
let btnID = getWizard() ? "finish" : "cancel";
let btn = document.documentElement.getButton(btnID);
let btn = getButton(btnID);
if (btn)
btn.style.visibility = "hidden";
window.setTimeout(function() { close(); }, 250);
......@@ -1248,7 +1263,7 @@ function isShowingErrorOverlay()
function showCopyLogButton(aHaveErrorOrWarning)
{
let copyLogBtn = document.documentElement.getButton("extra2");
let copyLogBtn = getButton("extra2");
if (copyLogBtn)
{
let haveWizard = (getWizard() != null);
......@@ -1272,7 +1287,7 @@ function showCopyLogButton(aHaveErrorOrWarning)
function restoreCopyLogVisibility()
{
let copyLogBtn = document.documentElement.getButton("extra2");
let copyLogBtn = getButton("extra2");
if (!copyLogBtn)
return;
......@@ -1288,14 +1303,10 @@ function restoreCopyLogVisibility()
// Network Settings window.
function showOrHideDialogButtons(aShow)
{
let buttonContainer = document.getAnonymousElementByAttribute(
document.documentElement, "anonid", "buttons");
if (!buttonContainer)
{
// The wizard uses "Buttons" (capital 'B').
buttonContainer = document.getAnonymousElementByAttribute(
document.documentElement, "anonid", "Buttons");
}
let wizard = getWizard();
let buttonContainer = wizard
? wizard.shadowRoot.querySelector(".wizard-buttons")
: document.querySelector(".dialog-button-box");
if (buttonContainer)
{
......@@ -1328,7 +1339,7 @@ function setButtonAttr(aID, aAttr, aValue)
if (!aID || !aAttr)
return null;
let btn = document.documentElement.getButton(aID); // dialog buttons
let btn = getButton(aID); // dialog buttons
if (!btn)
btn = document.getElementById(aID); // other buttons
if (btn)
......@@ -1428,7 +1439,7 @@ function showMenuListPlaceholderText(aElemID)
function overrideButtonLabel(aID, aLabel)
{
let btn = document.documentElement.getButton(aID);
let btn = getButton(aID);
if (btn)
{
btn.setAttribute("origLabel", btn.label);
......@@ -1446,7 +1457,7 @@ function overrideButtonLabelWithKey(aID, aLabelKey)
function restoreButtonLabel(aID)
{
var btn = document.documentElement.getButton(aID);
var btn = getButton(aID);
if (btn)
{
var oldLabel = btn.getAttribute("origLabel");
......@@ -1641,7 +1652,7 @@ function onCopyLog()
chSvc.copyString(gProtocolSvc.TorGetLog(countObj));
// Display a feedback popup that fades away after a few seconds.
let copyLogBtn = document.documentElement.getButton("extra2");
let copyLogBtn = getButton("extra2");
let panel = document.getElementById(kCopyLogFeedbackPanel);
if (copyLogBtn && panel)
{
......@@ -2489,7 +2500,7 @@ function setElemValue(aID, aValue)
toggleElemUI(elem);
break;
case "html:textarea":
case "textbox":
case "html:input":
if (Array.isArray(aValue))
{
val = "";
......@@ -2555,7 +2566,7 @@ function getElemValue(aID, aDefaultValue)
rv = elem.selected;
break;
case "html:textarea":
case "textbox":
case "html:input":
case "menulist":
case "richlistbox":
rv = elem.value;
......@@ -2570,6 +2581,13 @@ function getElemValue(aID, aDefaultValue)
}
function getButton(aButtonName)
{
let dialogOrWizard = document.querySelector("wizard");
return dialogOrWizard.getButton(aButtonName);
}
// Hide and show groupbox based on aElem's checked state. aElem may be a
// checkbox or radio element.
function toggleElemUI(aElem)
......
<?xml version="1.0"?>
<!--
- Copyright (c) 2019, The Tor Project, Inc.
- Copyright (c) 2020, The Tor Project, Inc.
- See LICENSE for licensing information.
- vim: set sw=2 sts=2 ts=8 et syntax=xml:
-->
......@@ -9,19 +9,19 @@
<?xml-stylesheet href="chrome://torlauncher/skin/network-settings.css"
type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
<!DOCTYPE window SYSTEM "chrome://torlauncher/locale/network-settings.dtd">
<dialog id="TorNetworkSettings"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
title="&torsettings.dialog.title;"
windowtype="TorLauncher:NetworkSettings"
persist="screenX screenY"
buttons="accept,cancel,extra2"
buttonlabelextra2="&torsettings.copyLog;"
onload="initDialog();"
onunload="deinitDialog();">
<dialog id="TorNetworkSettings"
buttons="accept,cancel,extra2"
buttonlabelextra2="&torsettings.copyLog;">
<script type="application/x-javascript"
src="chrome://torlauncher/content/network-settings.js"/>
......@@ -41,7 +41,7 @@
<hbox align="center">
<label value="&torsettings.firewall.allowedPorts;"
control="firewallAllowedPorts"/>
<textbox id="firewallAllowedPorts" value="80,443"/>
<html:input id="firewallAllowedPorts" value="80,443"/>
</hbox>
</groupbox>
</vbox>
......@@ -86,3 +86,4 @@
</vbox>
</stack>
</dialog>
</window>
/*
* Copyright (c) 2019, The Tor Project, Inc.
* Copyright (c) 2020, The Tor Project, Inc.
* See LICENSE for licensing information.
*
* vim: set sw=2 sts=2 ts=8 et syntax=css:
......@@ -7,36 +7,29 @@
@namespace html "http://www.w3.org/1999/xhtml";
dialog {
window {
width: 45em;
height: 41em;
font: -moz-dialog;
}
dialog.os-windows {
window.os-windows {
width: 49em;
height: 42em;
}
wizard {
window[torwizard="true"] {
width: 45em;
height: 38em;
font: -moz-dialog;
padding-top: 0px;
}
wizard.os-windows {
window[torwizard="true"].os-windows {
width: 49em;
height: 44em;
}
.wizard-page-box {
padding: 0px;
margin: 14px 20px 18px 20px;
}
wizard .wizard-header { display: none; }
#forAssistance {
margin-left: 12px;
margin-bottom: 6px;
......@@ -104,11 +97,6 @@ wizard[tor_hide_browser_logo="true"] .tbb-logo {
display: none;
}
wizard#TorLauncherLocalePicker button[dlgtype="back"],
wizard#TorLauncherLocalePicker button[dlgtype="next"] {
display: none;
}
/* Show menulist placeholder text in gray. */
#defaultBridgeType:not([value]) .menulist-label,
#defaultBridgeType[value=""] .menulist-label,
......@@ -124,8 +112,7 @@ wizard#TorLauncherLocalePicker button[dlgtype="next"] {
margin-left: 1.8em;
}
dialog.os-mac #bridgeList,
wizard.os-mac #bridgeList {
window.os-mac #bridgeList {
font-size: 90%;
}
......@@ -307,7 +294,7 @@ html|textarea {
.os-windows label,
.os-windows description,
.os-windows html|textarea,
.os-windows textbox
.os-windows html|input
{
font-size: 120% !important;
}
......
......@@ -100,6 +100,22 @@ TorProcessService.prototype =
if ("profile-after-change" == aTopic)
{
// Initialize the DNS service here (as early as possible). This
// avoids a deadlock that can occur inside TorProtocolService's
// _openAuthenticatedConnection() function. What happens in the
// deadlock case is that a Necko socket thread tries to dispatch
// initialization of the DNS service to the main thread while the
// main thread is blocked in a writeBytes() call inside the
// _sendCommand() function. The ultimate solution is to change
// our control port socket to use asynchronous I/O.
// References:
// netwerk/dns/nsDNSService2.cpp nsDNSService::GetSingleton()
// https://bugzilla.mozilla.org/show_bug.cgi?id=1625151 (the
// fix for this bug introduced the deadlock because it changed
// DNS service initialization to occur on the main thread).
const dns = Cc["@mozilla.org/network/dns-service;1"]
.getService(Ci.nsIDNSService);
this.mObsSvc.addObserver(this, "quit-application-granted", false);
this.mObsSvc.addObserver(this, kOpenNetworkSettingsTopic, false);
this.mObsSvc.addObserver(this, kUserQuitTopic, false);
......@@ -722,7 +738,7 @@ TorProcessService.prototype =
_openLocalePicker: function()
{
const kLocalePickerURL = "chrome://torlauncher/content/localePicker.xul";
const kLocalePickerURL = "chrome://torlauncher/content/localePicker.xhtml";
var wwSvc = Cc["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Ci.nsIWindowWatcher);
......@@ -743,8 +759,8 @@ TorProcessService.prototype =
return;
}
const kSettingsURL = "chrome://torlauncher/content/network-settings.xul";
const kWizardURL = "chrome://torlauncher/content/network-settings-wizard.xul";
const kSettingsURL = "chrome://torlauncher/content/network-settings.xhtml";
const kWizardURL = "chrome://torlauncher/content/network-settings-wizard.xhtml";
var wwSvc = Cc["@mozilla.org/embedcomp/window-watcher;1"]
.getService(Ci.nsIWindowWatcher);
......
......@@ -765,7 +765,7 @@ TorProtocolService.prototype =
{
TorLauncherLogger.log(2, "Opening control connection to " +
this.mControlHost + ":" + this.mControlPort);
socket = sts.createTransport(null, 0, this.mControlHost,
socket = sts.createTransport([], this.mControlHost,
this.mControlPort, null);
}
......
......@@ -12,9 +12,6 @@
<em:homepageURL>https://www.torproject.org/projects/torbrowser.html</em:homepageURL>
<em:updateURL>data:text/plain,</em:updateURL>
<em:updateKey>-</em:updateKey>
<!--
<em:optionsURL>chrome://torlauncher/content/preferences.xul</em:optionsURL>
-->
<!-- firefox -->
<em:targetApplication>
<Description>
......
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