Bug 1610741 - DoH Settings UI: Show error reason in Not Available label r=Gijs,kershaw,fluent-reviewers,necko-reviewers,settings-reviewers,flod
- The patch saves the confirmation channel's status and skipReason in the TRR Service - The UI queries the status and displays the stringified version in the Not Available (reason) label - Introduces doh-status-label CSS rule so the Learn-More link isn't off center Differential Revision: https://phabricator.services.mozilla.com/D174110
This commit is contained in:
@@ -608,8 +608,12 @@ var gPrivacyPane = {
|
||||
|
||||
let status = document.getElementById("dohStatus");
|
||||
|
||||
async function setStatus(localizedStringName) {
|
||||
let statusString = await document.l10n.formatValue(localizedStringName);
|
||||
async function setStatus(localizedStringName, options) {
|
||||
let opts = options || {};
|
||||
let statusString = await document.l10n.formatValue(
|
||||
localizedStringName,
|
||||
opts
|
||||
);
|
||||
document.l10n.setAttributes(status, "preferences-doh-status", {
|
||||
status: statusString,
|
||||
});
|
||||
@@ -635,11 +639,23 @@ var gPrivacyPane = {
|
||||
return "preferences-doh-status-disabled";
|
||||
}
|
||||
|
||||
let errReason = "";
|
||||
let confirmationStatus = Services.dns.lastConfirmationStatus;
|
||||
if (confirmationStatus != Cr.NS_OK) {
|
||||
errReason = ChromeUtils.getXPCOMErrorName(confirmationStatus);
|
||||
} else {
|
||||
errReason = Services.dns.getTRRSkipReasonName(
|
||||
Services.dns.lastConfirmationSkipReason
|
||||
);
|
||||
}
|
||||
let statusLabel = computeStatus();
|
||||
// setStatus will format and set the statusLabel asynchronously.
|
||||
setStatus(statusLabel);
|
||||
setStatus(statusLabel, { reason: errReason });
|
||||
dohResolver.hidden = statusLabel == "preferences-doh-status-disabled";
|
||||
|
||||
let statusLearnMore = document.getElementById("dohStatusLearnMore");
|
||||
statusLearnMore.hidden = statusLabel != "preferences-doh-status-not-active";
|
||||
|
||||
// No need to set the resolver name since we're not going to show it.
|
||||
if (statusLabel == "preferences-doh-status-disabled") {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user