[tor-commits] [tor-browser] 11/33: fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection

gitolite role git at cupani.torproject.org
Tue May 3 22:40:19 UTC 2022


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

richard pushed a commit to branch tor-browser-91.9.0esr-11.5-1
in repository tor-browser.

commit b59c7d7f2d00df4363f0c4f49e354bbe2bfbc4ff
Author: Pier Angelo Vendrame <pierov at torproject.org>
AuthorDate: Fri Apr 8 11:20:37 2022 +0200

    fixup! squash! Bug 31286: Implementation of bridge, proxy, and firewall settings in about:preferences#connection
    
    Bug 40876: add all countries to about:preferences#connection
---
 .../torpreferences/content/connectionPane.js       | 64 +++++++++++++---------
 .../torpreferences/content/torPreferences.css      |  5 ++
 2 files changed, 43 insertions(+), 26 deletions(-)

diff --git a/browser/components/torpreferences/content/connectionPane.js b/browser/components/torpreferences/content/connectionPane.js
index 309d6498a0c80..1562e9c780747 100644
--- a/browser/components/torpreferences/content/connectionPane.js
+++ b/browser/components/torpreferences/content/connectionPane.js
@@ -346,36 +346,48 @@ const gConnectionPane = (function() {
           TorConnect.beginAutoBootstrap(location.value);
         });
         this._populateLocations = () => {
-          let value = location.value;
+          const currentValue = location.value;
           locationEntries.textContent = "";
-
-          {
+          const createItem = (value, label, disabled) => {
             const item = document.createXULElement("menuitem");
-            item.setAttribute("value", "");
-            item.setAttribute(
-              "label",
-              TorStrings.settings.bridgeLocationAutomatic
-            );
-            locationEntries.appendChild(item);
-          }
-
-          const codes = TorConnect.countryCodes;
-          const items = codes.map(code => {
-            const item = document.createXULElement("menuitem");
-            item.setAttribute("value", code);
-            item.setAttribute(
-              "label",
-              TorConnect.countryNames[code]
-                ? TorConnect.countryNames[code]
-                : code
-            );
+            item.setAttribute("value", value);
+            item.setAttribute("label", label);
+            if (disabled) {
+              item.setAttribute("disabled", "true");
+            }
             return item;
-          });
-          items.sort((left, right) =>
-            left.textContent.localeCompare(right.textContent)
+          };
+          const addLocations = codes => {
+            const items = [];
+            for (const code of codes) {
+              items.push(
+                createItem(
+                  code,
+                  TorConnect.countryNames[code]
+                    ? TorConnect.countryNames[code]
+                    : code
+                )
+              );
+            }
+            items.sort((left, right) =>
+              left.label.localeCompare(right.label)
+            );
+            locationEntries.append(...items);
+          };
+          locationEntries.append(
+            createItem("", TorStrings.settings.bridgeLocationAutomatic)
           );
-          locationEntries.append(...items);
-          location.value = value;
+          if (TorConnect.countryCodes.length) {
+            locationEntries.append(
+              createItem("", TorStrings.settings.bridgeLocationFrequent, true)
+            );
+            addLocations(TorConnect.countryCodes);
+            locationEntries.append(
+              createItem("", TorStrings.settings.bridgeLocationOther, true)
+            );
+          }
+          addLocations(Object.keys(TorConnect.countryNames));
+          location.value = currentValue;
         };
         this._showAutoconfiguration = () => {
           if (
diff --git a/browser/components/torpreferences/content/torPreferences.css b/browser/components/torpreferences/content/torPreferences.css
index 31b6e29d679f3..535baefbcbabb 100644
--- a/browser/components/torpreferences/content/torPreferences.css
+++ b/browser/components/torpreferences/content/torPreferences.css
@@ -176,6 +176,11 @@ html:dir(rtl) input[type="checkbox"].toggle-button::before {
   width: 280px;
 }
 
+#torPreferences-bridges-location menuitem[disabled="true"] {
+  color: var(--in-content-button-text-color, inherit);
+  font-weight: 700;
+}
+
 /* Bridge cards */
 :root {
   --bridgeCard-animation-time: 0.25s;

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


More information about the tor-commits mailing list