Skip to content
Snippets Groups Projects
Verified Commit e491f15d authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in...

fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection

Linted
parent b84dcbed
Branches
No related tags found
1 merge request!694Bug 41796: Rebased on top of FIREFOX_ESR_115_BASE
Showing
with 473 additions and 348 deletions
......@@ -3,9 +3,11 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://browser/content/torpreferences/torPreferences.css"?>
<window type="child"
<window
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
xmlns:html="http://www.w3.org/1999/xhtml"
>
<dialog id="bridgeQr-dialog" buttons="accept">
<html:div>
<html:div id="bridgeQr">
......@@ -14,12 +16,14 @@
<html:div id="bridgeQr-onion" />
</html:div>
</html:div>
<script type="application/javascript"><![CDATA[
<script type="application/javascript">
<![CDATA[
"use strict";
let dialogObject = window.arguments[0];
let dialogElement = document.getElementById("bridgeQr-dialog");
dialogObject.init(window, dialogElement);
]]></script>
]]>
</script>
</dialog>
</window>
......@@ -6,11 +6,8 @@ const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { TorStrings } = ChromeUtils.import("resource:///modules/TorStrings.jsm");
const {
TorSettings,
TorBridgeSource,
TorBuiltinBridgeTypes,
} = ChromeUtils.import("resource:///modules/TorSettings.jsm");
const { TorSettings, TorBridgeSource, TorBuiltinBridgeTypes } =
ChromeUtils.import("resource:///modules/TorSettings.jsm");
const { TorConnect, TorConnectTopics } = ChromeUtils.import(
"resource:///modules/TorConnect.jsm"
......
......@@ -3,28 +3,60 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://browser/content/torpreferences/torPreferences.css"?>
<window type="child"
<window
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<dialog id="torPreferences-builtinBridge-dialog"
buttons="help,accept,cancel">
xmlns:html="http://www.w3.org/1999/xhtml"
>
<dialog id="torPreferences-builtinBridge-dialog" buttons="help,accept,cancel">
<description>
<html:div id="torPreferences-builtinBridge-description">&#8203;<br/>&#8203;</html:div>
<html:div id="torPreferences-builtinBridge-description"
>&#8203;<br />&#8203;</html:div
>
</description>
<radiogroup id="torPreferences-builtinBridge-typeSelection">
<radio id="torPreferences-builtinBridges-radioObfs" value="obfs4" hidden="true"/>
<html:div id="torPreferences-builtinBridges-descrObfs" class="indent" hidden="true">&#8203;</html:div>
<radio id="torPreferences-builtinBridges-radioSnowflake" value="snowflake" hidden="true"/>
<html:div id="torPreferences-builtinBridges-descrSnowflake" class="indent" hidden="true">&#8203;</html:div>
<radio id="torPreferences-builtinBridges-radioMeekAzure" value="meek-azure" hidden="true"/>
<html:div id="torPreferences-builtinBridges-descrMeekAzure" class="indent" hidden="true">&#8203;</html:div>
<radio
id="torPreferences-builtinBridges-radioObfs"
value="obfs4"
hidden="true"
/>
<html:div
id="torPreferences-builtinBridges-descrObfs"
class="indent"
hidden="true"
>&#8203;</html:div
>
<radio
id="torPreferences-builtinBridges-radioSnowflake"
value="snowflake"
hidden="true"
/>
<html:div
id="torPreferences-builtinBridges-descrSnowflake"
class="indent"
hidden="true"
>&#8203;</html:div
>
<radio
id="torPreferences-builtinBridges-radioMeekAzure"
value="meek-azure"
hidden="true"
/>
<html:div
id="torPreferences-builtinBridges-descrMeekAzure"
class="indent"
hidden="true"
>&#8203;</html:div
>
</radiogroup>
<script type="application/javascript"><![CDATA[
<script type="application/javascript">
<![CDATA[
"use strict";
let builtinBridgeDialog = window.arguments[0];
let dialog = document.getElementById("torPreferences-builtinBridge-dialog");
builtinBridgeDialog.init(window, dialog);
]]></script>
]]>
</script>
</dialog>
</window>
......@@ -11,23 +11,15 @@ const { setTimeout, clearTimeout } = ChromeUtils.import(
"resource://gre/modules/Timer.jsm"
);
const {
TorSettings,
TorSettingsTopics,
TorSettingsData,
TorBridgeSource,
} = ChromeUtils.import("resource:///modules/TorSettings.jsm");
const { TorSettings, TorSettingsTopics, TorSettingsData, TorBridgeSource } =
ChromeUtils.import("resource:///modules/TorSettings.jsm");
const { TorProtocolService } = ChromeUtils.import(
"resource://gre/modules/TorProtocolService.jsm"
);
const {
TorConnect,
TorConnectTopics,
TorConnectState,
TorCensorshipLevel,
} = ChromeUtils.import("resource:///modules/TorConnect.jsm");
const { TorConnect, TorConnectTopics, TorConnectState, TorCensorshipLevel } =
ChromeUtils.import("resource:///modules/TorConnect.jsm");
const { TorLogDialog } = ChromeUtils.import(
"chrome://browser/content/torpreferences/torLogDialog.jsm"
......@@ -548,9 +540,8 @@ const gConnectionPane = (function() {
id.append(piece);
}
}
card.querySelector(
selectors.bridges.cardHeadingAddr
).textContent = bridgeString;
card.querySelector(selectors.bridges.cardHeadingAddr).textContent =
bridgeString;
const optionsButton = card.querySelector(selectors.bridges.cardOptions);
if (TorSettings.bridges.source === TorBridgeSource.BuiltIn) {
optionsButton.setAttribute("hidden", "true");
......@@ -889,9 +880,8 @@ const gConnectionPane = (function() {
}
this._confirmBridgeRemoval = () => {
const aParentWindow = Services.wm.getMostRecentWindow(
"navigator:browser"
);
const aParentWindow =
Services.wm.getMostRecentWindow("navigator:browser");
const ps = Services.prompt;
const btnFlags =
......@@ -1176,7 +1166,8 @@ function makeBridgeId(bridgeString) {
}
function parseBridgeLine(line) {
const re = /^([^\s]+\s+)?([0-9a-fA-F\.\[\]\:]+:[0-9]{1,5})\s*([0-9a-fA-F]{40})(\s+.+)?/;
const re =
/^([^\s]+\s+)?([0-9a-fA-F\.\[\]\:]+:[0-9]{1,5})\s*([0-9a-fA-F]{40})(\s+.+)?/;
const matches = line.match(re);
if (!matches) {
return null;
......
<!-- Tor panel -->
<script type="application/javascript"
src="chrome://browser/content/torpreferences/connectionPane.js"/>
<script
type="application/javascript"
src="chrome://browser/content/torpreferences/connectionPane.js"
/>
<html:template id="template-paneConnection">
<!-- Tor Connect Message Box -->
<groupbox data-category="paneConnection" hidden="true">
<html:div id="torPreferences-connectMessageBox"
<html:div
id="torPreferences-connectMessageBox"
class="subcategory"
data-category="paneConnection"
hidden="true">
hidden="true"
>
<html:table>
<html:tr>
<html:td>
<html:div id="torPreferences-connectMessageBox-icon" />
</html:td>
<html:td id="torPreferences-connectMessageBox-message">
</html:td>
<html:td id="torPreferences-connectMessageBox-message"> </html:td>
<html:td>
<html:button id="torPreferences-connectMessageBox-button">
</html:button>
......@@ -26,24 +28,31 @@
</html:div>
</groupbox>
<hbox id="torPreferencesCategory"
<hbox
id="torPreferencesCategory"
class="subcategory"
data-category="paneConnection"
hidden="true">
hidden="true"
>
<html:h1 id="torPreferences-header" />
</hbox>
<groupbox data-category="paneConnection"
hidden="true">
<groupbox data-category="paneConnection" hidden="true">
<description flex="1">
<html:span id="torPreferences-description" class="tail-with-learn-more" />
<label id="torPreferences-learnMore" class="learnMore text-link" is="text-link"/>
<label
id="torPreferences-learnMore"
class="learnMore text-link"
is="text-link"
/>
</description>
</groupbox>
<groupbox id="torPreferences-status-group"
<groupbox
id="torPreferences-status-group"
data-category="paneConnection"
hidden="true">
hidden="true"
>
<hbox id="torPreferences-status-box">
<image id="torPreferences-status-internet-icon" />
<html:span id="torPreferences-status-internet-label" />
......@@ -58,9 +67,11 @@
</groupbox>
<!-- Quickstart -->
<groupbox id="torPreferences-quickstart-group"
<groupbox
id="torPreferences-quickstart-group"
data-category="paneConnection"
hidden="true">
hidden="true"
>
<html:h2 id="torPreferences-quickstart-header" />
<description flex="1">
<html:span id="torPreferences-quickstart-description" />
......@@ -69,44 +80,72 @@
</groupbox>
<!-- Bridges -->
<hbox class="subcategory"
data-category="paneConnection"
hidden="true">
<hbox class="subcategory" data-category="paneConnection" hidden="true">
<html:h1 id="torPreferences-bridges-header" />
</hbox>
<groupbox id="torPreferences-bridges-group"
<groupbox
id="torPreferences-bridges-group"
data-category="paneConnection"
hidden="true">
hidden="true"
>
<description flex="1">
<html:span id="torPreferences-bridges-description" class="tail-with-learn-more"/>
<label id="torPreferences-bridges-learnMore" class="learnMore text-link" is="text-link"/>
<html:span
id="torPreferences-bridges-description"
class="tail-with-learn-more"
/>
<label
id="torPreferences-bridges-learnMore"
class="learnMore text-link"
is="text-link"
/>
</description>
<hbox align="center" id="torPreferences-bridges-locationGroup" hidden="true">
<label id="torPreferences-bridges-locationLabel"
control="torPreferences-bridges-location"/>
<hbox
align="center"
id="torPreferences-bridges-locationGroup"
hidden="true"
>
<label
id="torPreferences-bridges-locationLabel"
control="torPreferences-bridges-location"
/>
<spacer flex="1" />
<menulist id="torPreferences-bridges-location">
<menupopup id="torPreferences-bridges-locationEntries" />
</menulist>
<button id="torPreferences-bridges-buttonChooseBridgeForMe" class="primary"/>
<button
id="torPreferences-bridges-buttonChooseBridgeForMe"
class="primary"
/>
</hbox>
<html:h2 id="torPreferences-currentBridges-header">
</html:h2>
<html:h2 id="torPreferences-currentBridges-header"> </html:h2>
<description flex="1" id="torPreferences-currentBridges-description">
<html:span id="torPreferences-currentBridges-descriptionText" />
</description>
<hbox align="center">
<html:input type="checkbox" id="torPreferences-currentBridges-switch" class="toggle-button"/>
<html:label id="torPreferences-currentBridges-enableAll-label" for="torPreferences-currentBridges-switch">
<html:input
type="checkbox"
id="torPreferences-currentBridges-switch"
class="toggle-button"
/>
<html:label
id="torPreferences-currentBridges-enableAll-label"
for="torPreferences-currentBridges-switch"
>
</html:label>
<spacer flex="1" />
<button id="torPreferences-currentBridges-removeAll" />
</hbox>
<menupopup id="torPreferences-bridgeCard-menu" />
<vbox id="torPreferences-bridgeCard-template" class="torPreferences-bridgeCard">
<vbox
id="torPreferences-bridgeCard-template"
class="torPreferences-bridgeCard"
>
<hbox class="torPreferences-bridgeCard-heading">
<html:div class="torPreferences-bridgeCard-id" />
<label class="torPreferences-bridgeCard-manualLink learnMore text-link stop-click" is="text-link"/>
<label
class="torPreferences-bridgeCard-manualLink learnMore text-link stop-click"
is="text-link"
/>
<html:div class="torPreferences-bridgeCard-headingAddr" />
<html:div class="torPreferences-bridgeCard-buttons">
<html:span class="torPreferences-bridgeCard-connectedBadge">
......@@ -126,10 +165,17 @@
</box>
<description class="torPreferences-bridgeCard-share"></description>
<hbox class="torPreferences-bridgeCard-addrBox">
<html:input class="torPreferences-bridgeCard-addr stop-click" type="text" readonly="readonly"/>
<html:input
class="torPreferences-bridgeCard-addr stop-click"
type="text"
readonly="readonly"
/>
</hbox>
<hbox class="torPreferences-bridgeCard-learnMoreBox" align="center">
<label class="torPreferences-bridgeCard-learnMore learnMore text-link stop-click" is="text-link"/>
<label
class="torPreferences-bridgeCard-learnMore learnMore text-link stop-click"
is="text-link"
/>
</hbox>
<hbox class="torPreferences-bridgeCard-copy" align="center">
<button class="torPreferences-bridgeCard-copyButton stop-click" />
......@@ -138,48 +184,53 @@
</vbox>
<vbox id="torPreferences-currentBridges-cards"></vbox>
<vbox align="center">
<button id="torPreferences-currentBridges-showAll"
aria-controls="torPreferences-currentBridges-cards"/>
<button
id="torPreferences-currentBridges-showAll"
aria-controls="torPreferences-currentBridges-cards"
/>
</vbox>
<html:h2 id="torPreferences-addBridge-header"></html:h2>
<hbox align="center">
<label id="torPreferences-addBridge-labelBuiltinBridge" flex="1" />
<button id="torPreferences-addBridge-buttonBuiltinBridge"
class="accessory-button"/>
<button
id="torPreferences-addBridge-buttonBuiltinBridge"
class="accessory-button"
/>
</hbox>
<hbox align="center">
<label id="torPreferences-addBridge-labelRequestBridge" flex="1" />
<button id="torPreferences-addBridge-buttonRequestBridge"
class="accessory-button"/>
<button
id="torPreferences-addBridge-buttonRequestBridge"
class="accessory-button"
/>
</hbox>
<hbox align="center">
<label id="torPreferences-addBridge-labelEnterBridge" flex="1" />
<button id="torPreferences-addBridge-buttonEnterBridge"
class="accessory-button"/>
<button
id="torPreferences-addBridge-buttonEnterBridge"
class="accessory-button"
/>
</hbox>
</groupbox>
<!-- Advanced -->
<hbox class="subcategory"
data-category="paneConnection"
hidden="true">
<hbox class="subcategory" data-category="paneConnection" hidden="true">
<html:h1 id="torPreferences-advanced-header" />
</hbox>
<groupbox id="torPreferences-advanced-group"
<groupbox
id="torPreferences-advanced-group"
data-category="paneConnection"
hidden="true">
hidden="true"
>
<hbox align="center">
<label id="torPreferences-advanced-label" flex="1" />
<button id="torPreferences-advanced-button"
class="accessory-button"/>
<button id="torPreferences-advanced-button" class="accessory-button" />
</hbox>
<hbox align="center" data-subcategory="viewlogs">
<label id="torPreferences-torLogs" flex="1" />
<vbox>
<button id="torPreferences-buttonTorLogs"
class="accessory-button"/>
<button id="torPreferences-buttonTorLogs" class="accessory-button" />
</vbox>
</hbox>
</groupbox>
</html:template>
......@@ -206,9 +206,8 @@ class ConnectionSettingsDialog {
this.onToggleFirewall(false);
if (TorSettings.firewall.enabled) {
this.onToggleFirewall(true);
this._allowedPortsTextbox.value = TorSettings.firewall.allowed_ports.join(
", "
);
this._allowedPortsTextbox.value =
TorSettings.firewall.allowed_ports.join(", ");
}
this._dialog.addEventListener("dialogaccept", e => {
......
......@@ -3,11 +3,12 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://browser/content/torpreferences/torPreferences.css"?>
<window type="child"
<window
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<dialog id="torPreferences-connection-dialog"
buttons="accept,cancel">
xmlns:html="http://www.w3.org/1999/xhtml"
>
<dialog id="torPreferences-connection-dialog" buttons="accept,cancel">
<html:h3 id="torPreferences-connection-header">&#8203;</html:h3>
<!-- Local Proxy -->
<checkbox id="torPreferences-connection-toggleProxy" label="&#8203;" />
......@@ -17,7 +18,10 @@
</hbox>
<hbox align="center">
<spacer flex="1" />
<menulist id="torPreferences-localProxy-builtinList" class="torMarginFix">
<menulist
id="torPreferences-localProxy-builtinList"
class="torMarginFix"
>
<menupopup />
</menulist>
</hbox>
......@@ -25,18 +29,38 @@
<label id="torPreferences-localProxy-address" />
</hbox>
<hbox align="center">
<html:input id="torPreferences-localProxy-textboxAddress" type="text" class="torMarginFix"/>
<html:input
id="torPreferences-localProxy-textboxAddress"
type="text"
class="torMarginFix"
/>
<label id="torPreferences-localProxy-port" />
<!-- proxy-port-input class style pulled from preferences.css and used in the vanilla proxy setup menu -->
<html:input id="torPreferences-localProxy-textboxPort" class="proxy-port-input torMarginFix" hidespinbuttons="true" type="number" min="0" max="65535" maxlength="5"/>
<html:input
id="torPreferences-localProxy-textboxPort"
class="proxy-port-input torMarginFix"
hidespinbuttons="true"
type="number"
min="0"
max="65535"
maxlength="5"
/>
</hbox>
<hbox class="indent" align="center">
<label id="torPreferences-localProxy-username" />
</hbox>
<hbox align="center">
<html:input id="torPreferences-localProxy-textboxUsername" type="text" class="torMarginFix"/>
<html:input
id="torPreferences-localProxy-textboxUsername"
type="text"
class="torMarginFix"
/>
<label id="torPreferences-localProxy-password" />
<html:input id="torPreferences-localProxy-textboxPassword" class="torMarginFix" type="password"/>
<html:input
id="torPreferences-localProxy-textboxPassword"
class="torMarginFix"
type="password"
/>
</hbox>
</box>
<!-- Firewall -->
......@@ -46,15 +70,22 @@
<label id="torPreferences-connection-allowedPorts" />
</hbox>
<hbox id="torPreferences-connection-hboxAllowedPorts" align="center">
<html:input id="torPreferences-connection-textboxAllowedPorts" type="text" class="torMarginFix" value="80,443"/>
<html:input
id="torPreferences-connection-textboxAllowedPorts"
type="text"
class="torMarginFix"
value="80,443"
/>
</hbox>
</box>
<script type="application/javascript"><![CDATA[
<script type="application/javascript">
<![CDATA[
"use strict";
let connectionSettingsDialog = window.arguments[0];
let dialog = document.getElementById("torPreferences-connection-dialog");
connectionSettingsDialog.init(window, dialog);
]]></script>
]]>
</script>
</dialog>
</window>
......@@ -3,19 +3,26 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://browser/content/torpreferences/torPreferences.css"?>
<window type="child"
<window
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<dialog id="torPreferences-provideBridge-dialog"
buttons="help,accept,cancel">
xmlns:html="http://www.w3.org/1999/xhtml"
>
<dialog id="torPreferences-provideBridge-dialog" buttons="help,accept,cancel">
<html:h3 id="torPreferences-provideBridge-header">&#8203;</html:h3>
<html:textarea id="torPreferences-provideBridge-textarea" multiline="true" rows="3"/>
<script type="application/javascript"><![CDATA[
<html:textarea
id="torPreferences-provideBridge-textarea"
multiline="true"
rows="3"
/>
<script type="application/javascript">
<![CDATA[
"use strict";
let provideBridgeDialog = window.arguments[0];
let dialog = document.getElementById("torPreferences-provideBridge-dialog");
provideBridgeDialog.init(window, dialog);
]]></script>
]]>
</script>
</dialog>
</window>
......@@ -3,11 +3,12 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://browser/content/torpreferences/torPreferences.css"?>
<window type="child"
<window
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<dialog id="torPreferences-requestBridge-dialog"
buttons="help,accept,cancel">
xmlns:html="http://www.w3.org/1999/xhtml"
>
<dialog id="torPreferences-requestBridge-dialog" buttons="help,accept,cancel">
<!-- ok, so &#8203; is a zero-width space. We need to have *something* in the innerText so that XUL knows how tall the
title node is so that it can determine how large to make the dialog element's inner draw area. If we have nothing
in the innerText, then it collapse to 0 height, and the contents of the dialog ends up partially hidden >:( -->
......@@ -15,21 +16,29 @@
<!-- init to transparent 400x125 png -->
<image id="torPreferences-requestBridge-captchaImage" flex="1" />
<hbox id="torPreferences-requestBridge-inputHbox">
<html:input id="torPreferences-requestBridge-captchaTextbox" type="text" style="-moz-box-flex: 1;"/>
<button id="torPreferences-requestBridge-refreshCaptchaButton"
<html:input
id="torPreferences-requestBridge-captchaTextbox"
type="text"
style="-moz-box-flex: 1"
/>
<button
id="torPreferences-requestBridge-refreshCaptchaButton"
image="chrome://global/skin/icons/reload.svg"
oncommand="requestBridgeDialog.onRefreshCaptcha();"/>
oncommand="requestBridgeDialog.onRefreshCaptcha();"
/>
</hbox>
<hbox id="torPreferences-requestBridge-incorrectCaptchaHbox" align="center">
<image id="torPreferences-requestBridge-errorIcon" />
<label id="torPreferences-requestBridge-incorrectCaptchaError" flex="1" />
</hbox>
<script type="application/javascript"><![CDATA[
<script type="application/javascript">
<![CDATA[
"use strict";
let requestBridgeDialog = window.arguments[0];
let dialog = document.getElementById("torPreferences-requestBridge-dialog");
requestBridgeDialog.init(window, dialog);
]]></script>
]]>
</script>
</dialog>
</window>
......@@ -3,21 +3,25 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css"?>
<?xml-stylesheet href="chrome://browser/content/torpreferences/torPreferences.css"?>
<window type="child"
<window
type="child"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<dialog id="torPreferences-torLog-dialog"
buttons="accept,extra1">
xmlns:html="http://www.w3.org/1999/xhtml"
>
<dialog id="torPreferences-torLog-dialog" buttons="accept,extra1">
<html:textarea
id="torPreferences-torDialog-textarea"
multiline="true"
readonly="true"/>
<script type="application/javascript"><![CDATA[
readonly="true"
/>
<script type="application/javascript">
<![CDATA[
"use strict";
let torLogDialog = window.arguments[0];
let dialog = document.getElementById("torPreferences-torLog-dialog");
torLogDialog.init(window, dialog);
]]></script>
]]>
</script>
</dialog>
</window>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment