Commit 26691804 authored by Dan Ballard's avatar Dan Ballard
Browse files

BB 43544: DoH pane undefined error in Privacy and Security



From: Sarah Jamie Lewis <sarah@openprivacy.ca>
Date: Fri, 28 Feb 2025 09:30:45 -0800
Subject: [PATCH 1/1] DoH Settings: Check for nulll gParentalControlsService

When the parental controls service is disabled in a build, the DoH
settings now display the correct stauts when Increased or Max Protection
is enabled.

Previously, selecting either of these options would cause DoH to be
enabled, but the "Status" and "Provider" fields would not be properly
populated, due to a check on the gParentalControlsService causing an
error.

This check is now identical to the same check in DownloadIntegration.sys.mjs

Apply 1 suggestion(s) to 1 file(s)

Co-authored-by: ma1's avatarma1 <giorgio@maone.net>
parent 8e3b1f41
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -54,11 +54,12 @@ ChromeUtils.defineLazyGetter(lazy, "AboutLoginsL10n", () => {
  return new Localization(["branding/brand.ftl", "browser/aboutLogins.ftl"]);
});

XPCOMUtils.defineLazyServiceGetter(
  lazy,
  "gParentalControlsService",
  "@mozilla.org/parental-controls-service;1",
  "nsIParentalControlsService"
ChromeUtils.defineLazyGetter(lazy, "gParentalControlsService", () =>
  "@mozilla.org/parental-controls-service;1" in Cc
    ? Cc["@mozilla.org/parental-controls-service;1"].createInstance(
        Ci.nsIParentalControlsService
      )
    : null
);

// TODO: module import via ChromeUtils.defineModuleGetter
@@ -735,7 +736,7 @@ var gPrivacyPane = {
        mode == Ci.nsIDNSService.MODE_TRRFIRST ||
        mode == Ci.nsIDNSService.MODE_TRRONLY
      ) {
        if (lazy.gParentalControlsService.parentalControlsEnabled) {
        if (lazy.gParentalControlsService?.parentalControlsEnabled) {
          return "preferences-doh-status-not-active";
        }
        let confirmationState = Services.dns.currentTrrConfirmationState;
@@ -758,7 +759,7 @@ var gPrivacyPane = {
    if (
      (mode == Ci.nsIDNSService.MODE_TRRFIRST ||
        mode == Ci.nsIDNSService.MODE_TRRONLY) &&
      lazy.gParentalControlsService.parentalControlsEnabled
      lazy.gParentalControlsService?.parentalControlsEnabled
    ) {
      errReason = Services.dns.getTRRSkipReasonName(
        Ci.nsITRRSkipReason.TRR_PARENTAL_CONTROL