Backed out changeset 74a98c04cd54 (bug 1495583) for browser chrome failures on browser_connection_dnsoverhttps.
authorCosmin Sabou <csabou@mozilla.com>
Sat, 13 Oct 2018 02:03:42 +0300
changeset 489424 4e77c1c74676244514aff0fd213fb77ad18f371d
parent 489423 4c60ba7cca763f05586963d470a1d07c15ddac11
child 489425 a06d50af52573db2ac6265ee169fc8039fbf8b04
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
bugs1495583
milestone64.0a1
backs out74a98c04cd54385d99b2a49842df0a9f14846bf4
Backed out changeset 74a98c04cd54 (bug 1495583) for browser chrome failures on browser_connection_dnsoverhttps.
browser/components/preferences/connection.js
browser/components/preferences/connection.xul
browser/components/preferences/in-content/main.xul
browser/locales/en-US/browser/preferences/connection.ftl
modules/libpref/init/all.js
--- a/browser/components/preferences/connection.js
+++ b/browser/components/preferences/connection.js
@@ -30,41 +30,35 @@ Preferences.addAll([
   { id: "network.proxy.backup.ftp", type: "string" },
   { id: "network.proxy.backup.ftp_port", type: "int" },
   { id: "network.proxy.backup.ssl", type: "string" },
   { id: "network.proxy.backup.ssl_port", type: "int" },
   { id: "network.proxy.backup.socks", type: "string" },
   { id: "network.proxy.backup.socks_port", type: "int" },
   { id: "network.trr.mode", type: "int" },
   { id: "network.trr.uri", type: "string" },
-  { id: "network.trr.custom_uri", "type": "string" },
 ]);
 
 window.addEventListener("DOMContentLoaded", () => {
   Preferences.get("network.proxy.type").on("change",
     gConnectionsDialog.proxyTypeChanged.bind(gConnectionsDialog));
   Preferences.get("network.proxy.socks_version").on("change",
     gConnectionsDialog.updateDNSPref.bind(gConnectionsDialog));
-  gConnectionsDialog.initDnsOverHttpsUI();
 
   document
     .getElementById("disableProxyExtension")
     .addEventListener(
       "command", makeDisableControllingExtension(
         PREF_SETTING_TYPE, PROXY_KEY).bind(gConnectionsDialog));
   gConnectionsDialog.updateProxySettingsUI();
   initializeProxyUI(gConnectionsDialog);
 }, { once: true, capture: true });
 
 var gConnectionsDialog = {
   beforeAccept() {
-    if (document.getElementById("customDnsOverHttpsUrlRadio").selected) {
-      Services.prefs.setStringPref("network.trr.uri", document.getElementById("customDnsOverHttpsInput").value);
-    }
-
     var proxyTypePref = Preferences.get("network.proxy.type");
     if (proxyTypePref.value == 2) {
       this.doAutoconfigURLFixup();
       return true;
     }
 
     if (proxyTypePref.value != 1)
       return true;
@@ -304,30 +298,16 @@ var gConnectionsDialog = {
 
   writeDnsOverHttpsMode() {
     // called to update pref with user change
     let trrModeCheckbox = document.getElementById("networkDnsOverHttps");
     // we treat checked/enabled as mode 2
     return trrModeCheckbox.checked ? 2 : 0;
   },
 
-  updateDnsOverHttpsUI() {
-    // Disable the custom url input box if the parent checkbox and custom radio button attached to it is not selected.
-    // Disable the custom radio button if the parent checkbox is not selected.
-    let parentCheckbox = document.getElementById("networkDnsOverHttps");
-    let customDnsOverHttpsUrlRadio = document.getElementById("customDnsOverHttpsUrlRadio");
-    let customDnsOverHttpsInput = document.getElementById("customDnsOverHttpsInput");
-    customDnsOverHttpsInput.disabled = !parentCheckbox.checked || !customDnsOverHttpsUrlRadio.selected;
-    customDnsOverHttpsUrlRadio.disabled = !parentCheckbox.checked;
-  },
-
-  initDnsOverHttpsUI() {
-    let defaultDnsOverHttpsUrlRadio = document.getElementById("defaultDnsOverHttpsUrlRadio");
-    let defaultPrefUrl = Preferences.get("network.trr.uri").defaultValue;
-    document.l10n.setAttributes(defaultDnsOverHttpsUrlRadio, "connection-dns-over-https-url-default", {
-      url: defaultPrefUrl,
-    });
-    defaultDnsOverHttpsUrlRadio.value = defaultPrefUrl;
-    let radioGroup = document.getElementById("DnsOverHttpsUrlRadioGroup");
-    radioGroup.selectedIndex = Preferences.get("network.trr.uri").hasUserValue ? 1 : 0;
-    this.updateDnsOverHttpsUI();
+  writeDnsOverHttpsUri() {
+    // called to update pref with user input
+    let input = document.getElementById("networkDnsOverHttpsUrl");
+    let uriString = input.value.trim();
+    // turn an empty string into `undefined` to clear the pref back to the default
+    return uriString.length ? uriString : undefined;
   },
 };
--- a/browser/components/preferences/connection.xul
+++ b/browser/components/preferences/connection.xul
@@ -149,28 +149,19 @@
               preference="signon.autologin.proxy" />
     <checkbox id="networkProxySOCKSRemoteDNS"
               preference="network.proxy.socks_remote_dns"
               data-l10n-id="connection-proxy-socks-remote-dns" />
     <checkbox id="networkDnsOverHttps"
               data-l10n-id="connection-dns-over-https"
               preference="network.trr.mode"
               onsyncfrompreference="return gConnectionsDialog.readDnsOverHttpsMode();"
-              onsynctopreference="return gConnectionsDialog.writeDnsOverHttpsMode();"
-              oncommand="gConnectionsDialog.updateDnsOverHttpsUI();"/>
-
-    <vbox class="indent" flex="1">
-      <radiogroup id="DnsOverHttpsUrlRadioGroup" orient="vertical">
-          <radio id="defaultDnsOverHttpsUrlRadio"
-                 data-l10n-id="connection-dns-over-https-url-default"
-                 preference="network.trr.uri"
-                 oncommand="gConnectionsDialog.updateDnsOverHttpsUI();"/>
-        <hbox>
-          <radio id="customDnsOverHttpsUrlRadio"
-                 data-l10n-id="connection-dns-over-https-url-custom"
-                 oncommand="gConnectionsDialog.updateDnsOverHttpsUI();"/>
-          <textbox id="customDnsOverHttpsInput" flex="1" preference="network.trr.custom_uri"/>
-        </hbox>
-      </radiogroup>
-    </vbox>
+              onsynctopreference="return gConnectionsDialog.writeDnsOverHttpsMode()" />
+    <hbox class="indent" flex="1" align="center">
+      <label control="networkDnsOverHttpsUrl" data-l10n-id="connection-dns-over-https-url"
+             data-l10n-attrs="tooltiptext"/>
+      <textbox id="networkDnsOverHttpsUrl" flex="1" preference="network.trr.uri"
+               placeholder="https://doh.example.com/dns-query"
+               onsynctopreference="return gConnectionsDialog.writeDnsOverHttpsUri()" />
+    </hbox>
     <separator/>
   </vbox>
 </dialog>
--- a/browser/components/preferences/in-content/main.xul
+++ b/browser/components/preferences/in-content/main.xul
@@ -700,14 +700,13 @@
                 connection-proxy-noproxy,
                 connection-proxy-noproxy-desc,
                 connection-proxy-http-share.label,
                 connection-proxy-autotype.label,
                 connection-proxy-reload.label,
                 connection-proxy-autologin.label,
                 connection-proxy-socks-remote-dns.label,
                 connection-dns-over-https,
-                connection-dns-over-https-url-custom,
-                connection-dns-over-https-url-default,
+                connection-dns-over-https-url
             " />
     </hbox>
   </hbox>
 </groupbox>
--- a/browser/locales/en-US/browser/preferences/connection.ftl
+++ b/browser/locales/en-US/browser/preferences/connection.ftl
@@ -81,19 +81,11 @@ connection-proxy-autologin =
 connection-proxy-socks-remote-dns =
     .label = Proxy DNS when using SOCKS v5
     .accesskey = D
 
 connection-dns-over-https =
     .label = Enable DNS over HTTPS
     .accesskey = b
 
-# Variables:
-#   $url (String) - URL for the DNS over HTTPS provider
-connection-dns-over-https-url-default =
-    .label = Use default ({ $url })
+connection-dns-over-https-url = URL
     .accesskey = U
-    .tooltiptext = Use the default URL for resolving DNS over HTTPS
-
-connection-dns-over-https-url-custom =
-    .label = Custom
-    .accesskey = C
-    .tooltiptext = Enter your preferred URL for resolving DNS over HTTPS
+    .tooltiptext = URL for resolving DNS over HTTPS
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5428,20 +5428,19 @@ pref("network.captive-portal-service.max
 // Every 10 checks, the delay is increased by a factor of 5
 pref("network.captive-portal-service.backoffFactor", "5.0");
 pref("network.captive-portal-service.enabled", false);
 
 // DNS Trusted Recursive Resolver
 // 0 - default off, 1 - race, 2 TRR first, 3 TRR only, 4 shadow, 5 off by choice
 pref("network.trr.mode", 0);
 // DNS-over-HTTP service to use, must be HTTPS://
-pref("network.trr.uri", "https://mozilla.cloudflare-dns.com/dns-query");
+pref("network.trr.uri", "");
 // credentials to pass to DOH end-point
 pref("network.trr.credentials", "");
-pref("network.trr.custom_uri", "");
 // Wait for captive portal confirmation before enabling TRR
 #if defined(ANDROID)
 // On Android, the captive portal is handled by the OS itself
 pref("network.trr.wait-for-portal", false);
 #else
 pref("network.trr.wait-for-portal", true);
 #endif
 // Allow RFC1918 address in responses?