[tor-commits] [tor-browser] branch tor-browser-91.10.0esr-11.5-1 updated: fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection

gitolite role git at cupani.torproject.org
Thu Jun 16 14:01:04 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch tor-browser-91.10.0esr-11.5-1
in repository tor-browser.

The following commit(s) were added to refs/heads/tor-browser-91.10.0esr-11.5-1 by this push:
     new 9e479455512e4 fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
9e479455512e4 is described below

commit 9e479455512e432cbacbe9f722ebd58f72cc7484
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Thu Jun 16 15:04:37 2022 +0200

    fixup! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
    
    Fixed text wrapping in modals
---
 .../torpreferences/content/builtinBridgeDialog.jsm | 32 ++--------------------
 .../content/builtinBridgeDialog.xhtml              | 26 +++++-------------
 .../torpreferences/content/connectionPane.js       | 32 +++-------------------
 .../content/connectionSettingsDialog.xhtml         | 16 +++++------
 .../torpreferences/content/torPreferences.css      | 12 +++++---
 5 files changed, 29 insertions(+), 89 deletions(-)

diff --git a/browser/components/torpreferences/content/builtinBridgeDialog.jsm b/browser/components/torpreferences/content/builtinBridgeDialog.jsm
index 1d4dda8f5ca9c..c03e83178f26c 100644
--- a/browser/components/torpreferences/content/builtinBridgeDialog.jsm
+++ b/browser/components/torpreferences/content/builtinBridgeDialog.jsm
@@ -14,7 +14,6 @@ class BuiltinBridgeDialog {
   constructor() {
     this._dialog = null;
     this._bridgeType = "";
-    this._windowPadding = 0;
   }
 
   static get selectors() {
@@ -36,14 +35,7 @@ class BuiltinBridgeDialog {
 
     this._dialog = aDialog;
     const dialogWin = this._dialog.parentElement;
-    {
-      dialogWin.setAttribute("title", TorStrings.settings.builtinBridgeTitle);
-      let windowStyle = window.getComputedStyle(dialogWin);
-      this._windowPadding =
-        parseFloat(windowStyle.paddingLeft) +
-        parseFloat(windowStyle.paddingRight);
-    }
-    const initialWidth = dialogWin.clientWidth - this._windowPadding;
+    dialogWin.setAttribute("title", TorStrings.settings.builtinBridgeTitle);
 
     this._dialog.querySelector(selectors.header).textContent =
       TorStrings.settings.builtinBridgeHeader;
@@ -73,10 +65,10 @@ class BuiltinBridgeDialog {
     };
 
     TorBuiltinBridgeTypes.forEach(type => {
-      types[type].elemRadio.parentElement.setAttribute("hidden", "false");
-      types[type].elemDescr.parentElement.setAttribute("hidden", "false");
       types[type].elemRadio.setAttribute("label", types[type].label);
+      types[type].elemRadio.setAttribute("hidden", "false");
       types[type].elemDescr.textContent = types[type].descr;
+      types[type].elemDescr.removeAttribute("hidden");
     });
 
     if (
@@ -91,9 +83,6 @@ class BuiltinBridgeDialog {
       this._bridgeType = "";
     }
 
-    // Use the initial width, because the window is expanded when we add texts
-    this.resized(initialWidth);
-
     this._dialog.addEventListener("dialogaccept", e => {
       this._bridgeType = radioGroup.value;
     });
@@ -105,21 +94,6 @@ class BuiltinBridgeDialog {
     });
   }
 
-  resized(width) {
-    if (this._dialog === null) {
-      return;
-    }
-    const dialogWin = this._dialog.parentElement;
-    if (width === undefined) {
-      width = dialogWin.clientWidth - this._windowPadding;
-    }
-    let windowPos = dialogWin.getBoundingClientRect();
-    dialogWin.querySelectorAll("div").forEach(div => {
-      let divPos = div.getBoundingClientRect();
-      div.style.width = width - (divPos.left - windowPos.left) + "px";
-    });
-  }
-
   init(window, aDialog) {
     // defer to later until firefox has populated the dialog with all our elements
     window.setTimeout(() => {
diff --git a/browser/components/torpreferences/content/builtinBridgeDialog.xhtml b/browser/components/torpreferences/content/builtinBridgeDialog.xhtml
index c1bf202ca1be5..61c6110f327a7 100644
--- a/browser/components/torpreferences/content/builtinBridgeDialog.xhtml
+++ b/browser/components/torpreferences/content/builtinBridgeDialog.xhtml
@@ -13,25 +13,13 @@
     <html:div id="torPreferences-builtinBridge-description">​<br/>​</html:div>
   </description>
   <radiogroup id="torPreferences-builtinBridge-typeSelection">
-    <hbox hidden="true">
-      <radio id="torPreferences-builtinBridges-radioObfs" value="obfs4"/>
-    </hbox>
-    <hbox hidden="true" class="indent">
-      <html:div id="torPreferences-builtinBridges-descrObfs"></html:div>
-    </hbox>
-    <hbox hidden="true">
-      <radio id="torPreferences-builtinBridges-radioSnowflake" value="snowflake"/>
-    </hbox>
-    <hbox hidden="true" class="indent">
-      <html:div id="torPreferences-builtinBridges-descrSnowflake"></html:div>
-    </hbox>
-    <hbox hidden="true">
-      <radio id="torPreferences-builtinBridges-radioMeekAzure" value="meek-azure"/>
-    </hbox>
-    <hbox hidden="true" class="indent">
-      <html:div id="torPreferences-builtinBridges-descrMeekAzure"></html:div>
-    </hbox>
-    </radiogroup>
+    <radio id="torPreferences-builtinBridges-radioObfs" value="obfs4" hidden="true"/>
+    <html:div id="torPreferences-builtinBridges-descrObfs" class="indent" hidden="true">​</html:div>
+    <radio id="torPreferences-builtinBridges-radioSnowflake" value="snowflake" hidden="true"/>
+    <html:div id="torPreferences-builtinBridges-descrSnowflake" class="indent" hidden="true">​</html:div>
+    <radio id="torPreferences-builtinBridges-radioMeekAzure" value="meek-azure" hidden="true"/>
+    <html:div id="torPreferences-builtinBridges-descrMeekAzure" class="indent" hidden="true">​</html:div>
+  </radiogroup>
   <script type="application/javascript"><![CDATA[
     "use strict";
 
diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js
index 46fbbfecf832f..292123b0712c4 100644
--- a/browser/components/torpreferences/content/connectionPane.js
+++ b/browser/components/torpreferences/content/connectionPane.js
@@ -983,33 +983,8 @@ const gConnectionPane = (function() {
     },
 
     onAddBuiltinBridge() {
-      let builtinBridgeDialog = new BuiltinBridgeDialog();
-
-      let sizeObserver = null;
-      {
-        let ds = document.querySelector("#dialogStack");
-        let boxObserver;
-        boxObserver = new MutationObserver(() => {
-          let dialogBox = document.querySelector(".dialogBox");
-          if (dialogBox) {
-            sizeObserver = new MutationObserver(mutations => {
-              for (const m of mutations) {
-                if (m.attributeName === "style") {
-                  builtinBridgeDialog.resized();
-                  break;
-                }
-              }
-            });
-            sizeObserver.observe(dialogBox, { attributes: true });
-            boxObserver.disconnect();
-          }
-        });
-        boxObserver.observe(ds, { childList: true, subtree: true });
-      }
-
+      const builtinBridgeDialog = new BuiltinBridgeDialog();
       builtinBridgeDialog.openDialog(gSubDialog, aBridgeType => {
-        sizeObserver.disconnect();
-
         if (!aBridgeType) {
           TorSettings.bridges.enabled = false;
           TorSettings.bridges.builtin_type = "";
@@ -1079,7 +1054,8 @@ function makeBridgeId(bridgeString) {
   // JS uses UTF-16. While most of these emojis are surrogate pairs, a few
   // ones fit one UTF-16 character. So we could not use neither indices,
   // nor substr, nor some function to split the string.
-const emojis = [
+  /* eslint-disable */
+  const emojis = [
     "👽","🤖","🧚","🧜","🏄","🐵","🦍","🐶","🐺","🦊","🐈","🦁","🐯","🐴","🦄","🦓",
     "🦌","🐮","🐷","🐗","🐑","🦙","🦒","🐘","🐭","🐹","🐇","🐿","🦔","🐨","🐼","🦥",
     "🦨","🦘","🐓","🐥","🐦","🐧","🕊","🦆","🦢","🦉","🦤","🦩","🦚","🦜","🐊","🐢",
@@ -1097,7 +1073,7 @@ const emojis = [
     "🎸","🎺","🎻","🪕","🥁","☎️","💿","🎥","🎬","📺","📷","🔍","💡","🔦","📖","📚",
     "🏷","✏️","🖌","🖍","📎","📌","🔑","🪃","🏹","⚙️","🧲","🧪","🧬","🔭","📡","🗿",
   ];
-
+  /* eslint-enable */
 
   // FNV-1a implementation that is compatible with other languages
   const prime = 0x01000193;
diff --git a/browser/components/torpreferences/content/connectionSettingsDialog.xhtml b/browser/components/torpreferences/content/connectionSettingsDialog.xhtml
index 88aa979256f02..8265cdd71c2f8 100644
--- a/browser/components/torpreferences/content/connectionSettingsDialog.xhtml
+++ b/browser/components/torpreferences/content/connectionSettingsDialog.xhtml
@@ -9,11 +9,9 @@
 <dialog id="torPreferences-connection-dialog"
         buttons="accept,cancel">
   <html:h3 id="torPreferences-connection-header">​</html:h3>
+  <!-- Local Proxy -->
+  <checkbox id="torPreferences-connection-toggleProxy" label="​"/>
   <box id="torPreferences-connection-grid">
-    <!-- Local Proxy -->
-    <hbox class="torPreferences-connection-checkbox-container">
-      <checkbox id="torPreferences-connection-toggleProxy" label="​"/>
-    </hbox>
     <hbox class="indent" align="center">
       <label id="torPreferences-localProxy-type"/>
     </hbox>
@@ -40,14 +38,14 @@
       <label id="torPreferences-localProxy-password"/>
       <html:input id="torPreferences-localProxy-textboxPassword" class="torMarginFix" type="password"/>
     </hbox>
-    <!-- Firewall -->
-    <hbox class="torPreferences-connection-checkbox-container">
-      <checkbox id="torPreferences-connection-toggleFirewall" label="​"/>
-    </hbox>
+  </box>
+  <!-- Firewall -->
+  <checkbox id="torPreferences-connection-toggleFirewall" label="​"/>
+  <box id="torPreferences-connection-firewall">
     <hbox class="indent" align="center">
       <label id="torPreferences-connection-allowedPorts"/>
     </hbox>
-    <hbox align="center">
+    <hbox id="torPreferences-connection-hboxAllowedPorts" align="center">
       <html:input id="torPreferences-connection-textboxAllowedPorts" type="text" class="torMarginFix" value="80,443"/>
     </hbox>
   </box>
diff --git a/browser/components/torpreferences/content/torPreferences.css b/browser/components/torpreferences/content/torPreferences.css
index 2ab29bcd60faa..aaedc260bd9f1 100644
--- a/browser/components/torpreferences/content/torPreferences.css
+++ b/browser/components/torpreferences/content/torPreferences.css
@@ -541,10 +541,6 @@ groupbox#torPreferences-bridges-group textarea {
   grid-template-columns: auto 1fr;
 }
 
-.torPreferences-connection-checkbox-container {
-  grid-column: 1 / 3;
-}
-
 #torPreferences-localProxy-textboxAddress,
 #torPreferences-localProxy-textboxUsername,
 #torPreferences-localProxy-textboxPassword,
@@ -552,6 +548,14 @@ groupbox#torPreferences-bridges-group textarea {
   -moz-box-flex: 1;
 }
 
+#torPreferences-connection-firewall {
+  display: flex;
+}
+
+#torPreferences-connection-hboxAllowedPorts {
+  flex: 1;
+}
+
 /* Tor logs dialog */
 textarea#torPreferences-torDialog-textarea {
   -moz-box-flex: 1;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tor-commits mailing list