Skip to content

Commit 2e188c9

Browse files
committed
Bug 1826749 - DoH Settings UI tests r=Gijs,settings-reviewers
This adapts previous test cases from the connection UI to the privacy UI. Additional improvements: - Set the ROLLOUT_URI_Pref to empty string to avoid DoHConfig reset setting it to undefined. - Always set network.trr.uri even if it matches the default_provider_uri if it's a user choice. - If the value of network.trr.uri doesn't match any of the providers, then set custom_uri so it shows up in the input text field. This can happen when it's set by a policy. Differential Revision: https://phabricator.services.mozilla.com/D174876
1 parent 8ba7034 commit 2e188c9

File tree

4 files changed

+187
-230
lines changed

4 files changed

+187
-230
lines changed

browser/components/doh/DoHController.sys.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ export const DoHController = {
249249
console.error(`Error getting dooh.ohttpURI: ${e.message}`);
250250
}
251251

252-
lazy.Preferences.set(ROLLOUT_URI_PREF, uri);
252+
lazy.Preferences.set(ROLLOUT_URI_PREF, uri || "");
253253
}
254254
this.runHeuristicsThrottled("startup");
255255
Services.obs.addObserver(this, kLinkStatusChangedTopic);

browser/components/preferences/privacy.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -583,14 +583,7 @@ var gPrivacyPane = {
583583
updateURIPref();
584584
} else {
585585
customInput.hidden = true;
586-
if (
587-
menu.value ==
588-
Preferences.get("network.trr.default_provider_uri").value
589-
) {
590-
Services.prefs.clearUserPref("network.trr.uri");
591-
} else {
592-
Services.prefs.setStringPref("network.trr.uri", menu.value);
593-
}
586+
Services.prefs.setStringPref("network.trr.uri", menu.value);
594587
}
595588

596589
// Update other menu too.
@@ -783,15 +776,20 @@ var gPrivacyPane = {
783776
document.getElementById("dohWarningBox2").hidden = false;
784777
}
785778

786-
if (Services.prefs.prefIsLocked("network.trr.mode")) {
787-
document.getElementById("dohCategoryRadioGroup").disabled = true;
788-
// The URI is locked by policy. We need to update the custom_uri pref
789-
// to make sure the input box contains the correct URL.
779+
let uriPref = Services.prefs.getStringPref("network.trr.uri");
780+
// If the value isn't one of the providers, we need to update the
781+
// custom_uri pref to make sure the input box contains the correct URL.
782+
if (uriPref && !this.dnsOverHttpsResolvers.some(e => e.uri == uriPref)) {
790783
Services.prefs.setStringPref(
791784
"network.trr.custom_uri",
792785
Services.prefs.getStringPref("network.trr.uri")
793786
);
794787
}
788+
789+
if (Services.prefs.prefIsLocked("network.trr.mode")) {
790+
document.getElementById("dohCategoryRadioGroup").disabled = true;
791+
Services.prefs.setStringPref("network.trr.custom_uri", uriPref);
792+
}
795793
},
796794

797795
/**

browser/components/preferences/tests/browser.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ skip-if = true
9595
[browser_primaryPassword.js]
9696
[browser_privacy_cookieBannerHandling.js]
9797
[browser_privacy_dnsoverhttps.js]
98-
skip-if = true # TODO change test to use new DNS over HTTPS UI
9998
[browser_privacy_firefoxSuggest.js]
10099
[browser_privacy_passwordGenerationAndAutofill.js]
101100
[browser_privacy_quickactions.js]

0 commit comments

Comments
 (0)