Files
IronFox/patches/gecko-pref-handling.patch

53 lines
1.9 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: celenity <celenity@celenity.dev>
Date: Sun, 05 Jul 2026 20:19:20 +0000
Subject: [PATCH] Gecko - Pref handling
Locks Gecko preferences controlled by GeckoRuntimeSettings to ensure they stay in sync with Fenix's UI settings.
Signed-off-by: celenity <celenity@celenity.dev>
---
diff --git a/extensions/pref/autoconfig/src/prefcalls.js b/extensions/pref/autoconfig/src/prefcalls.js
index 47eb92982c97..ce9ac56af63f 100644
--- a/extensions/pref/autoconfig/src/prefcalls.js
+++ b/extensions/pref/autoconfig/src/prefcalls.js
@@ -5,6 +5,16 @@
/* globals gSandbox */
+const lazy = {};
+ChromeUtils.defineESModuleGetters(
+ lazy,
+ {
+ GeckoSettingsBridge:
+ "moz-src:///ironfox/utils/GeckoSettingsBridge.sys.mjs",
+ },
+ { global: "contextual" }
+);
+
const LDAPSyncQueryContractID = "@mozilla.org/ldapsyncquery;1";
var gIsUTF8;
@@ -36,7 +46,7 @@ function pref(prefName, value) {
function defaultPref(prefName, value) {
try {
var prefBranch = Services.prefs.getDefaultBranch(null);
- if (typeof value == "string") {
+ if (typeof value == "string" && lazy.GeckoSettingsBridge.autoconfCanSetStringPref(prefName)) {
// Unwrap the legacy homepage form that the localizable-pref reader used
// to handle (bug 1490339). Match it exactly so we don't touch deliberate
// data: URLs.
@@ -52,9 +62,9 @@ function defaultPref(prefName, value) {
return;
}
prefBranch.setCharPref(prefName, value);
- } else if (typeof value == "number") {
+ } else if (typeof value == "number" && lazy.GeckoSettingsBridge.autoconfCanSetIntPref(prefName)) {
prefBranch.setIntPref(prefName, value);
- } else if (typeof value == "boolean") {
+ } else if (typeof value == "boolean" && lazy.GeckoSettingsBridge.autoconfCanSetBoolPref(prefName)) {
prefBranch.setBoolPref(prefName, value);
}
} catch (e) {
--