diff --git a/browser/components/preferences/main.js b/browser/components/preferences/main.js
index bec54fd56f46..cf62774eb99f 100644
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -190,7 +190,6 @@ Preferences.addAll([
// WATERFOX
// Enable auto update checking
{ id: "app.update.enabled", type: "bool" },
-
]);
if (AppConstants.HAVE_SHELL_SERVICE) {
@@ -2630,11 +2629,19 @@ var gMainPane = {
let radiogroup = document.getElementById("updateRadioGroup");
radiogroup.disabled = true;
- let enabled = await UpdateUtils.getAppUpdateAutoEnabled();
+ let autoPref = await UpdateUtils.getAppUpdateAutoEnabled();
// WATERFOX
// If user sets app.update.enabled to false, set value to disabled, else use enabled
- let manualUpdates = Services.prefs.getBoolPref(PREF_UPDATE_ENABLED, true);
- radiogroup.value = !manualUpdates ? "disabled" : enabled;
+ var enabledPref = Preferences.get("app.update.enabled");
+
+ if (!enabledPref.value) {
+ // Don't care for autoPref.value in this case.
+ radiogroup.value = "disabled"; // 3. Never check for updates.
+ } else if (autoPref.value) {
+ radiogroup.value = "true"; //1. Automatically install updates
+ } else {
+ radiogroup.value = "false"; // 2. Check, but let me choose
+ }
radiogroup.disabled = false;
this.maybeDisableBackgroundUpdateControls();
@@ -2657,14 +2664,15 @@ var gMainPane = {
);
radiogroup.disabled = true;
try {
- await UpdateUtils.setAppUpdateAutoEnabled(updateAutoValue);
- await _disableTimeOverPromise;
- // WATERFOX
- // Ensure enabled pref is updated based on radiogroup value
+ // We need to set this pref first so that the auto pref observer
+ // has access to the correct enabled pref value.
Services.prefs.setBoolPref(
PREF_UPDATE_ENABLED,
radiogroup.value != "disabled"
);
+ await UpdateUtils.setAppUpdateAutoEnabled(updateAutoValue);
+ await _disableTimeOverPromise;
+
radiogroup.disabled = false;
} catch (error) {
console.error(error);
@@ -2880,16 +2888,14 @@ var gMainPane = {
throw new Error("Invalid preference value for app.update.auto");
}
// WATERFOX
- // Going from Auto to Disable needs to be correctly reflected here
- // At this point app.update.enabled has not yet been set, so we
- // want to set disabled if it is going from true->false and is
- // currently true
let manualUpdates = Services.prefs.getBoolPref(
"app.update.enabled",
true
);
+ // Only if enabledPref and autoPref are false should we select
+ // disabled, otherwise we just use the value of autoPref.
document.getElementById("updateRadioGroup").value =
- manualUpdates && !(aData === "true") ? "disabled" : aData;
+ !manualUpdates && !(aData === "true") ? "disabled" : aData;
this.maybeDisableBackgroundUpdateControls();
} else if (aTopic == BACKGROUND_UPDATE_CHANGED_TOPIC) {
if (!AppConstants.MOZ_UPDATE_AGENT) {
diff --git a/waterfox/browser/components/preferences/content/general.js b/waterfox/browser/components/preferences/content/general.js
index dd463ca3d21d..36fbf9819276 100644
--- a/waterfox/browser/components/preferences/content/general.js
+++ b/waterfox/browser/components/preferences/content/general.js
@@ -1,11 +1,4 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* eslint-env mozilla/browser-window */
-"use strict";
-
-const gMainPaneOverlay = {
+const _gMainPaneOverlay = {
init() {
// Initialize prefs
window.Preferences.addAll(this.preferences);
@@ -60,6 +53,9 @@ const gMainPaneOverlay = {
// Scripts
{ id: "javascript.enabled", type: "bool" },
+
+ // DoOH
+ { id: "network.trr.use_ohttp", type: "bool" },
];
},
@@ -72,15 +68,115 @@ const gMainPaneOverlay = {
// Select the correct radio button based on current pref value
this.showRelevantElements();
this.setDynamicThemeGroupValue();
- this.setEventListener("dynamicThemeGroup", "command", event => {
+ this.setEventListener("dynamicThemeGroup", "command", (event) => {
this.updateDynamicThemePref(event.target.value);
});
+ if (document.readyState === "complete") {
+ this.tocGenerate();
+ } else {
+ document.addEventListener("readystatechange", () => {
+ if (document.readyState === "complete") {
+ this.tocGenerate();
+ }
+ });
+ }
document.initialized = true;
}
+ this.setEventListener("enableObliviousDns", "click", () => {
+ const value = document.getElementById("enableObliviousDns").checked ? 2 : 0;
+ Services.prefs.setIntPref("network.trr.mode", value);
+ });
},
+ tocGenerate() {
+ const contentSelector = "#mainPrefPane";
+ const headingSelector =
+ "#mainPrefPane > hbox:not([hidden]) > h1, #mainPrefPane > groupbox:not([hidden]) > h2, #mainPrefPane > groupbox:not([hidden]) label:not([hidden]) > h2";
+ const headerTarget = headingSelector.replaceAll(":not([hidden])", "");
+ const specialCharRegex = /[!@#$%^&*():]/gi;
+ const createHeadingId = () => {
+ const content = document.querySelector(contentSelector);
+ const headings = content?.querySelectorAll(headerTarget);
+ const headingMap = {};
+
+ let count = 0;
+ /**
+ * @param {Element} heading
+ * @returns {string}
+ */
+ const getHeadingId = (heading) => {
+ const id = heading.id;
+ if (id) {
+ return id;
+ }
+
+ if (heading instanceof HTMLElement) {
+ const i18nId = heading.dataset.l10nId;
+ if (i18nId) {
+ return i18nId;
+ }
+ }
+
+ return (
+ heading.textContent
+ ?.trim()
+ .toLowerCase()
+ .split(" ")
+ .join("-")
+ .replace(specialCharRegex, "") ?? `${count++}`
+ );
+ };
+ /**
+ * @param {string} headingText
+ * @param {number} count
+ * @returns {string}
+ */
+ const createId = (headingText, count) =>
+ `${headingText}${count > 0 ? `-${count}` : ""}`;
+ if (headings) {
+ for (const heading of headings) {
+ const id = getHeadingId(heading);
+ headingMap[id] = !Number.isNaN(headingMap[id]) ? ++headingMap[id] : 0;
+ heading.id = createId(id, headingMap[id]);
+ }
+ }
+ };
+
+ createHeadingId();
+ tocbot.init({
+ tocSelector: ".toc",
+ contentSelector,
+ headingSelector,
+ scrollContainer: ".main-content",
+ headingsOffset: 100, // 90 + margins
+ hasInnerContainers: false,
+
+ /**
+ * @param {MouseEvent} e
+ */
+ onClick(e) {
+ e.preventDefault();
+
+ /** @type {HTMLLinkElement} */
+ const link = e.target;
+ const targetSelector = link?.getAttribute("href");
+ if (targetSelector) {
+ const target = document.querySelector(targetSelector);
+ if (target) {
+ target.scrollIntoView({ behavior: "smooth", block: "start" });
+ }
+ }
+ },
+ });
+ const tocRefresh = () => {
+ createHeadingId();
+ tocbot.refresh();
+ };
+ window.addEventListener("hashchange", tocRefresh);
+ },
+
showRelevantElements() {
- let idsGeneral = [
+ const idsGeneral = [
"dynamicThemeGroup",
"restartGroup",
"statusBarGroup",
@@ -88,25 +184,25 @@ const gMainPaneOverlay = {
"geolocationGroup",
];
- let idsPrivacy = ["webrtc", "refheader"];
- let win = Services.wm.getMostRecentWindow("navigator:browser");
- let uri = win.gBrowser.currentURI.spec;
+ const idsPrivacy = ["webrtc", "refheader", "dohBox"];
+ const win = Services.wm.getMostRecentWindow("navigator:browser");
+ const uri = win.gBrowser.currentURI.spec;
if (
- (uri == "about:preferences" || uri == "about:preferences#general") &&
- document.visibilityState == "visible"
+ (uri === "about:preferences" || uri === "about:preferences#general") &&
+ document.visibilityState === "visible"
) {
- for (let id of idsGeneral) {
- let el = document.getElementById(id);
+ for (const id of idsGeneral) {
+ const el = document.getElementById(id);
if (el) {
el.removeAttribute("hidden");
}
}
} else if (
- uri == "about:preferences#privacy" &&
- document.visibilityState == "visible"
+ uri === "about:preferences#privacy" &&
+ document.visibilityState === "visible"
) {
- for (let id of idsPrivacy) {
- let el = document.getElementById(id);
+ for (const id of idsPrivacy) {
+ const el = document.getElementById(id);
if (el) {
el.removeAttribute("hidden");
}
@@ -117,11 +213,11 @@ const gMainPaneOverlay = {
setEventListener(aId, aEventType, aCallback) {
document
.getElementById(aId)
- ?.addEventListener(aEventType, aCallback.bind(gMainPaneOverlay));
+ ?.addEventListener(aEventType, aCallback.bind(_gMainPaneOverlay));
},
async setDynamicThemeGroupValue() {
- let radiogroup = document.getElementById("dynamicThemeRadioGroup");
+ const radiogroup = document.getElementById("dynamicThemeRadioGroup");
radiogroup.disabled = true;
radiogroup.value = Services.prefs.getIntPref("ui.systemUsesDarkTheme", -1);
diff --git a/waterfox/browser/components/preferences/content/preferences-general.xhtml b/waterfox/browser/components/preferences/content/preferences-general.xhtml
index 351f13e3de80..bbb719480ef6 100644
--- a/waterfox/browser/components/preferences/content/preferences-general.xhtml
+++ b/waterfox/browser/components/preferences/content/preferences-general.xhtml
@@ -3,23 +3,21 @@
+
-
-
+
+
@@ -124,6 +122,8 @@
#endif
+
+
diff --git a/waterfox/browser/components/preferences/content/preferences-other.xhtml b/waterfox/browser/components/preferences/content/preferences-other.xhtml
index 9cf16212423a..7088c2e3ca30 100644
--- a/waterfox/browser/components/preferences/content/preferences-other.xhtml
+++ b/waterfox/browser/components/preferences/content/preferences-other.xhtml
@@ -19,7 +19,7 @@
/* eslint-env mozilla/browser-window */
/* globals gPrivacyPaneOverlay */
Services.scriptloader.loadSubScript("chrome://browser/content/overlays/privacy.js", this);
- gPrivacyPaneOverlay.init();
+ _gPrivacyPaneOverlay.init();
@@ -67,5 +67,13 @@
preference="javascript.enabled" flex="1" />
+
+
+
+
+
+
+
diff --git a/waterfox/browser/components/preferences/content/preferences-theme.xhtml b/waterfox/browser/components/preferences/content/preferences-theme.xhtml
index 18d944bdf955..eb54a2882903 100644
--- a/waterfox/browser/components/preferences/content/preferences-theme.xhtml
+++ b/waterfox/browser/components/preferences/content/preferences-theme.xhtml
@@ -2,11 +2,11 @@