summaryrefslogtreecommitdiff
path: root/librewolf-pref-pane.patch
diff options
context:
space:
mode:
Diffstat (limited to 'librewolf-pref-pane.patch')
-rw-r--r--librewolf-pref-pane.patch325
1 files changed, 273 insertions, 52 deletions
diff --git a/librewolf-pref-pane.patch b/librewolf-pref-pane.patch
index 974b43d..8f24965 100644
--- a/librewolf-pref-pane.patch
+++ b/librewolf-pref-pane.patch
@@ -1,23 +1,27 @@
-diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
-new file mode 100644
-index 0000000..2badfe9
---- /dev/null
-+++ b/.gitlab-ci.yml
-@@ -0,0 +1,12 @@
-+stages:
-+ - build
-+
-+create-patch:
-+ stage: build
-+ variables:
-+ GIT_DEPTH: 200
-+ script:
-+ - git diff 1fee314adc81000294fc0cf3196a758e4b64dace > librewolf-pref-pane.patch
-+ artifacts:
-+ paths:
-+ - librewolf-pref-pane.patch
+From 7da96b1ab28e2e0e9e61bb4b3d7645a2d31e36cb Mon Sep 17 00:00:00 2001
+From: ohfp <1813007-ohfp@users.noreply.gitlab.com>
+Date: Tue, 12 Apr 2022 11:57:53 +0200
+Subject: [PATCH 1/2] port pref-pane patch changes to gecko-dev
+
+---
+ browser/components/preferences/jar.mn | 1 +
+ .../preferences/librewolf.inc.xhtml | 254 +++++++++++++++++
+ browser/components/preferences/librewolf.js | 260 ++++++++++++++++++
+ browser/components/preferences/preferences.js | 2 +
+ .../components/preferences/preferences.xhtml | 13 +
+ .../en-US/browser/preferences/preferences.ftl | 90 ++++++
+ browser/themes/shared/jar.inc.mn | 2 +
+ .../shared/preferences/category-librewolf.svg | 96 +++++++
+ .../themes/shared/preferences/librewolf.css | 23 ++
+ .../themes/shared/preferences/preferences.css | 4 +
+ 10 files changed, 745 insertions(+)
+ create mode 100644 browser/components/preferences/librewolf.inc.xhtml
+ create mode 100644 browser/components/preferences/librewolf.js
+ create mode 100644 browser/themes/shared/preferences/category-librewolf.svg
+ create mode 100644 browser/themes/shared/preferences/librewolf.css
+
diff --git a/browser/components/preferences/jar.mn b/browser/components/preferences/jar.mn
-index 4f3babe..97c7ec2 100644
+index 752b0b2ae3d2..0aa6f606b851 100644
--- a/browser/components/preferences/jar.mn
+++ b/browser/components/preferences/jar.mn
@@ -11,6 +11,7 @@ browser.jar:
@@ -30,10 +34,10 @@ index 4f3babe..97c7ec2 100644
content/browser/preferences/experimental.js
diff --git a/browser/components/preferences/librewolf.inc.xhtml b/browser/components/preferences/librewolf.inc.xhtml
new file mode 100644
-index 0000000..f27541d
+index 000000000000..7a582fb9bb0c
--- /dev/null
+++ b/browser/components/preferences/librewolf.inc.xhtml
-@@ -0,0 +1,224 @@
+@@ -0,0 +1,254 @@
+# 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/.
@@ -78,6 +82,18 @@ index 0000000..f27541d
+ </vbox>
+ </vbox>
+
++ <hbox>
++ <checkbox id="librewolf-sync-checkbox" data-l10n-id="librewolf-sync-checkbox" preference="identity.fxaccounts.enabled" flex="1" />
++ <html:label for="librewolf-sync-collapse" class="sidebar-footer-link" pack="end"> <image class="sidebar-footer-icon help-icon"/> </html:label>
++ </hbox>
++ <vbox class="librewolf-collapse indent">
++ <html:input type="checkbox" id="librewolf-sync-collapse" />
++ <vbox class="librewolf-collapsed tracking-protection-ui content-blocking-category">
++ <label data-l10n-id="librewolf-sync-description" />
++ <html:div> <image src="chrome://browser/skin/warning.svg" /> <label data-l10n-id="librewolf-sync-warning1" class="librewolf-warning" /> </html:div>
++ <checkbox preference="identity.fxaccounts.enabled" label="identity.fxaccounts.enabled" />
++ </vbox>
++ </vbox>
+
+ <hbox>
+ <checkbox id="librewolf-autocopy-checkbox" data-l10n-id="librewolf-autocopy-checkbox" preference="clipboard.autocopy" flex="1" />
@@ -126,6 +142,24 @@ index 0000000..f27541d
+</groupbox>
+
+<groupbox hidden="true" data-category="paneLibrewolf">
++ <html:h2 data-l10n-id="librewolf-privacy-heading" />
++
++ <hbox>
++ <checkbox id="librewolf-xorigin-ref-checbox" data-l10n-id="librewolf-xorigin-ref-checbox" preference="network.http.referer.XOriginPolicy" flex="1" />
++ <html:label for="librewolf-xorigin-ref-collapse" class="sidebar-footer-link" pack="end"> <image class="sidebar-footer-icon help-icon"/> </html:label>
++ </hbox>
++ <vbox class="librewolf-collapse indent">
++ <html:input type="checkbox" id="librewolf-xorigin-ref-collapse" />
++ <vbox class="librewolf-collapsed tracking-protection-ui content-blocking-category">
++ <label data-l10n-id="librewolf-xorigin-ref-description" />
++ <html:div> <image src="chrome://browser/skin/warning.svg" /> <label data-l10n-id="librewolf-xorigin-ref-warning1" class="librewolf-warning" /> </html:div>
++ <checkbox preference="network.http.referer.XOriginPolicy" label="network.http.referer.XOriginPolicy" />
++ </vbox>
++ </vbox>
++
++</groupbox>
++
++<groupbox hidden="true" data-category="paneLibrewolf">
+ <html:h2 data-l10n-id="librewolf-broken-heading" />
+
+ <hbox>
@@ -260,10 +294,10 @@ index 0000000..f27541d
+</html:template>
diff --git a/browser/components/preferences/librewolf.js b/browser/components/preferences/librewolf.js
new file mode 100644
-index 0000000..ee49f0f
+index 000000000000..23395f027a50
--- /dev/null
+++ b/browser/components/preferences/librewolf.js
-@@ -0,0 +1,240 @@
+@@ -0,0 +1,260 @@
+/* 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/. */
@@ -275,14 +309,17 @@ index 0000000..ee49f0f
+XPCOMUtils.defineLazyGetter(this, "L10n", () => {
+ return new Localization([
+ "branding/brand.ftl",
-+ "browser/preferences/preferences.ftl",
++ "browser/locales/en-US/browser/preferences/preferences.ftl",
+ ]);
+});
+
+Preferences.addAll([
-+ // IPv6
-+ { id: "network.dns.disableIPv6", type: "bool" },
-+ { id: "security.OCSP.require", type: "bool" },
++ // IPv6
++ { id: "network.dns.disableIPv6", type: "bool" },
++ // ocsp hard-fail
++ { id: "security.OCSP.require", type: "bool" },
++ // ocsp hard-fail
++ { id: "identity.fxaccounts.enabled", type: "bool" },
+ // WebGL
+ { id: "webgl.disabled", type: "bool" },
+ // RFP
@@ -293,6 +330,8 @@ index 0000000..ee49f0f
+ // Clipboard autocopy/paste
+ { id: "clipboard.autocopy", type: "bool" },
+ { id: "middlemouse.paste", type: "bool" },
++ // XOrigin referrers
++ { id: "network.http.referer.XOriginPolicy", type: "int"},
+ // Harden
+ { id: "privacy.resistFingerprinting.letterboxing", type: "bool" },
+ // Google Safe Browsing
@@ -335,6 +374,11 @@ index 0000000..ee49f0f
+ [true, ],
+ );
+ setBoolSyncListeners(
++ "librewolf-sync-checkbox",
++ ["identity.fxaccounts.enabled"],
++ [true, ],
++ );
++ setBoolSyncListeners(
+ "librewolf-autocopy-checkbox",
+ ["clipboard.autocopy", "middlemouse.paste"],
+ [true, true ],
@@ -398,6 +442,8 @@ index 0000000..ee49f0f
+ ]
+ );
+
++ Preferences.get("network.http.referer.XOriginPolicy").on("change", syncXOriginPolicy(Preferences.get("network.http.referer.XOriginPolicy")));
++
+ // Set event listener on open profile directory button
+ setEventListener("librewolf-open-profile", "command", openProfileDirectory);
+ // Set event listener on open about:config button
@@ -408,6 +454,14 @@ index 0000000..ee49f0f
+ },
+};
+
++function syncXOriginPolicy(prefValue) {
++ if (prefValue == "0" || prefValue == "1") {
++ Services.prefs.setIntPref("network.http.referer.XOriginPolicy", 2);
++ } else {
++ Services.prefs.setIntPref("network.http.referer.XOriginPolicy", 0);
++ }
++}
++
+function openProfileDirectory() {
+ // Get the profile directory.
+ let currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
@@ -505,7 +559,7 @@ index 0000000..ee49f0f
+}
+
diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js
-index 91e9e46..763ab49 100644
+index f6dc2b3781f8..7d401fc63219 100644
--- a/browser/components/preferences/preferences.js
+++ b/browser/components/preferences/preferences.js
@@ -8,6 +8,7 @@
@@ -516,7 +570,7 @@ index 91e9e46..763ab49 100644
/* import-globals-from sync.js */
/* import-globals-from experimental.js */
/* import-globals-from moreFromMozilla.js */
-@@ -117,6 +118,7 @@ function init_all() {
+@@ -191,6 +192,7 @@ function init_all() {
register_module("paneHome", gHomePane);
register_module("paneSearch", gSearchPane);
register_module("panePrivacy", gPrivacyPane);
@@ -525,10 +579,10 @@ index 91e9e46..763ab49 100644
if (Services.prefs.getBoolPref("browser.preferences.experimental")) {
// Set hidden based on previous load's hidden value.
diff --git a/browser/components/preferences/preferences.xhtml b/browser/components/preferences/preferences.xhtml
-index aab4a9e..907a631 100644
+index 81059f3d2e01..d815682d68bc 100644
--- a/browser/components/preferences/preferences.xhtml
+++ b/browser/components/preferences/preferences.xhtml
-@@ -12,6 +12,7 @@
+@@ -13,6 +13,7 @@
<?xml-stylesheet href="chrome://browser/skin/preferences/search.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/containers.css"?>
<?xml-stylesheet href="chrome://browser/skin/preferences/privacy.css"?>
@@ -536,7 +590,7 @@ index aab4a9e..907a631 100644
<!DOCTYPE html>
-@@ -128,6 +129,17 @@
+@@ -129,6 +130,17 @@
<label class="category-name" flex="1" data-l10n-id="pane-privacy-title"></label>
</richlistitem>
@@ -554,7 +608,7 @@ index aab4a9e..907a631 100644
<richlistitem id="category-sync"
class="category"
hidden="true"
-@@ -201,6 +213,7 @@
+@@ -211,6 +223,7 @@
#include home.inc.xhtml
#include search.inc.xhtml
#include privacy.inc.xhtml
@@ -563,10 +617,10 @@ index aab4a9e..907a631 100644
#include sync.inc.xhtml
#include experimental.inc.xhtml
diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl
-index d276f7a..127c8e1 100644
+index 8c3f3f575598..40fdfefd7e52 100644
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
-@@ -1347,3 +1347,82 @@ choose-download-folder-title = Choose Download Folder:
+@@ -1372,3 +1372,93 @@ choose-download-folder-title = Choose Download Folder:
# $service-name (String) - Name of a cloud storage provider like Dropbox, Google Drive, etc...
save-files-to-cloud-storage =
.label = Save files to { $service-name }
@@ -579,7 +633,7 @@ index d276f7a..127c8e1 100644
+ .tooltiptext = about:config changes, logically grouped and easily accessible
+
+# Main content
-+librewolf-header = Librewolf Preferences
++librewolf-header = LibreWolf Preferences
+librewolf-warning-title = Heads up!
+librewolf-warning-description = We carefully choose default settings to focus on privacy and security. When changing these settings, read the descriptions to understand the implications of those changes.
+
@@ -587,6 +641,8 @@ index d276f7a..127c8e1 100644
+librewolf-general-heading = Browser Behavior
+librewolf-extension-update-checkbox =
+ .label = Update add-ons automatically
++librewolf-sync-checkbox =
++ .label = Enable Firefox Sync
+librewolf-autocopy-checkbox =
+ .label = Enable middle click paste
+librewolf-styling-checkbox =
@@ -596,11 +652,13 @@ index d276f7a..127c8e1 100644
+librewolf-ipv6-checkbox =
+ .label = Enable IPv6
+
++librewolf-privacy-heading = Privacy
++librewolf-xorigin-ref-checbox =
++ .label = Limit cross-origin referrers
++
+librewolf-broken-heading = Fingerprinting
+librewolf-webgl-checkbox =
+ .label = Enable WebGL
-+librewolf-ocsp-checkbox =
-+ .label = Enforce OCSP hard-fail
+librewolf-rfp-checkbox =
+ .label = Enable ResistFingerprinting
+librewolf-auto-decline-canvas-checkbox =
@@ -609,6 +667,8 @@ index d276f7a..127c8e1 100644
+ .label = Enable letterboxing
+
+librewolf-security-heading = Security
++librewolf-ocsp-checkbox =
++ .label = Enforce OCSP hard-fail
+librewolf-goog-safe-checkbox =
+ .label = Enable Google Safe Browsing
+librewolf-goog-safe-download-checkbox =
@@ -621,13 +681,18 @@ index d276f7a..127c8e1 100644
+librewolf-ipv6-description = Allow { -brand-short-name } to connect using IPv6.
+librewolf-ipv6-warning1 = Before you change this, make sure your OS uses the IPv6 privacy extension.
+librewolf-ocsp-description = Prevent connecting to a website if the OCSP check cannot be performed.
-+librewolf-ocsp-warning1 = This increases security, but it will cause breakage when a OCSP server is down.
++librewolf-ocsp-warning1 = This increases security, but it will cause breakage when an OCSP server is down.
++librewolf-sync-description = Sync your data with other browsers. Requires restart.
++librewolf-sync-warning1 = Firefox Sync encrypts data locally before transmitting it to the server.
+
+librewolf-autocopy-description = Select some text to copy it, then paste it with a middle-mouse click.
+
+librewolf-styling-description = Enable this if you want to customize the UI with a manually loaded theme.
+librewolf-styling-warning1 = Make sure you trust the provider of the theme.
+
++librewolf-xorigin-ref-description = Send a referrer only on same-origin.
++librewolf-xorigin-ref-warning1 = This causes breakage. Additionally, even when sent referrers will still be trimmed.
++
+librewolf-webgl-description = WebGL is a strong fingerprinting vector.
+librewolf-webgl-warning1 = If you need to enable it, consider using an extension like Canvas Blocker.
+
@@ -650,28 +715,28 @@ index d276f7a..127c8e1 100644
+librewolf-config-link = All advanced settings (about:config)
+librewolf-open-profile = Open user profile directory
diff --git a/browser/themes/shared/jar.inc.mn b/browser/themes/shared/jar.inc.mn
-index cf1ebf0..336118c 100644
+index 9e25fa92fd4c..f47605332b3f 100644
--- a/browser/themes/shared/jar.inc.mn
+++ b/browser/themes/shared/jar.inc.mn
-@@ -79,6 +79,7 @@
+@@ -86,6 +86,7 @@
skin/classic/browser/preferences/android-menu.svg (../shared/preferences/android-menu.svg)
skin/classic/browser/preferences/category-general.svg (../shared/preferences/category-general.svg)
skin/classic/browser/preferences/category-privacy-security.svg (../shared/preferences/category-privacy-security.svg)
+ skin/classic/browser/preferences/category-librewolf.svg (../shared/preferences/category-librewolf.svg)
skin/classic/browser/preferences/category-search.svg (../shared/preferences/category-search.svg)
skin/classic/browser/preferences/category-sync.svg (../shared/preferences/category-sync.svg)
- skin/classic/browser/preferences/face-sad.svg (../shared/preferences/face-sad.svg)
-@@ -97,6 +98,7 @@
+ skin/classic/browser/preferences/containers.css (../shared/preferences/containers.css)
+@@ -108,6 +109,7 @@
skin/classic/browser/preferences/vpn-logo.svg (../shared/preferences/vpn-logo.svg)
skin/classic/browser/preferences/search.css (../shared/preferences/search.css)
skin/classic/browser/preferences/siteDataSettings.css (../shared/preferences/siteDataSettings.css)
+ skin/classic/browser/preferences/librewolf.css (../shared/preferences/librewolf.css)
- * skin/classic/browser/preferences/containers.css (../shared/preferences/containers.css)
- * skin/classic/browser/preferences/containers-dialog.css (../shared/preferences/containers-dialog.css)
skin/classic/browser/upgradeDialog.css (../shared/upgradeDialog.css)
+ skin/classic/browser/spotlight.css (../shared/spotlight.css)
+ skin/classic/browser/upgradeDialog/abstract.png (../shared/upgradeDialog/abstract.png)
diff --git a/browser/themes/shared/preferences/category-librewolf.svg b/browser/themes/shared/preferences/category-librewolf.svg
new file mode 100644
-index 0000000..8ebf2eb
+index 000000000000..8ebf2ebe19a9
--- /dev/null
+++ b/browser/themes/shared/preferences/category-librewolf.svg
@@ -0,0 +1,96 @@
@@ -773,7 +838,7 @@ index 0000000..8ebf2eb
+
diff --git a/browser/themes/shared/preferences/librewolf.css b/browser/themes/shared/preferences/librewolf.css
new file mode 100644
-index 0000000..12f926a
+index 000000000000..12f926ab7018
--- /dev/null
+++ b/browser/themes/shared/preferences/librewolf.css
@@ -0,0 +1,23 @@
@@ -800,11 +865,11 @@ index 0000000..12f926a
+ -moz-context-properties: fill, fill-opacity;
+ fill: currentColor;
+}
-diff --git a/browser/themes/shared/preferences/preferences.inc.css b/browser/themes/shared/preferences/preferences.inc.css
-index 31bffd0..1f9fbcf 100644
---- a/browser/themes/shared/preferences/preferences.inc.css
-+++ b/browser/themes/shared/preferences/preferences.inc.css
-@@ -201,6 +201,10 @@ checkbox {
+diff --git a/browser/themes/shared/preferences/preferences.css b/browser/themes/shared/preferences/preferences.css
+index 8b110d3eed52..801b1835a7a4 100644
+--- a/browser/themes/shared/preferences/preferences.css
++++ b/browser/themes/shared/preferences/preferences.css
+@@ -222,6 +222,10 @@ checkbox {
list-style-image: url("chrome://browser/skin/preferences/category-privacy-security.svg");
}
@@ -815,3 +880,159 @@ index 31bffd0..1f9fbcf 100644
#category-sync > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/category-sync.svg");
}
+--
+2.35.1
+
+
+From 05a4e5c148f53263b65577724ab857b16b516673 Mon Sep 17 00:00:00 2001
+From: ohfp <1813007-ohfp@users.noreply.gitlab.com>
+Date: Thu, 14 Apr 2022 10:28:41 +0200
+Subject: [PATCH 2/2] fix xorigin pref init and handling
+
+---
+ .../preferences/librewolf.inc.xhtml | 4 +-
+ browser/components/preferences/librewolf.js | 48 ++++++++++++-------
+ .../en-US/browser/preferences/preferences.ftl | 2 +-
+ 3 files changed, 33 insertions(+), 21 deletions(-)
+
+diff --git a/browser/components/preferences/librewolf.inc.xhtml b/browser/components/preferences/librewolf.inc.xhtml
+index 7a582fb9bb0c..c2dfea6d0858 100644
+--- a/browser/components/preferences/librewolf.inc.xhtml
++++ b/browser/components/preferences/librewolf.inc.xhtml
+@@ -105,7 +105,7 @@
+ <html:h2 data-l10n-id="librewolf-privacy-heading" />
+
+ <hbox>
+- <checkbox id="librewolf-xorigin-ref-checbox" data-l10n-id="librewolf-xorigin-ref-checbox" preference="network.http.referer.XOriginPolicy" flex="1" />
++ <checkbox id="librewolf-xorigin-ref-checkbox" data-l10n-id="librewolf-xorigin-ref-checkbox" preference="network.http.referer.XOriginPolicy" flex="1" />
+ <html:label for="librewolf-xorigin-ref-collapse" class="sidebar-footer-link" pack="end"> <image class="sidebar-footer-icon help-icon"/> </html:label>
+ </hbox>
+ <vbox class="librewolf-collapse indent">
+@@ -113,7 +113,7 @@
+ <vbox class="librewolf-collapsed tracking-protection-ui content-blocking-category">
+ <label data-l10n-id="librewolf-xorigin-ref-description" />
+ <html:div> <image src="chrome://browser/skin/warning.svg" /> <label data-l10n-id="librewolf-xorigin-ref-warning1" class="librewolf-warning" /> </html:div>
+- <checkbox preference="network.http.referer.XOriginPolicy" label="network.http.referer.XOriginPolicy" />
++ <checkbox disabled="true" preference="network.http.referer.XOriginPolicy" label="network.http.referer.XOriginPolicy" />
+ </vbox>
+ </vbox>
+
+diff --git a/browser/components/preferences/librewolf.js b/browser/components/preferences/librewolf.js
+index 23395f027a50..95c5dbb48291 100644
+--- a/browser/components/preferences/librewolf.js
++++ b/browser/components/preferences/librewolf.js
+@@ -9,17 +9,17 @@ var { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.
+ XPCOMUtils.defineLazyGetter(this, "L10n", () => {
+ return new Localization([
+ "branding/brand.ftl",
+- "browser/locales/en-US/browser/preferences/preferences.ftl",
++ "browser/preferences/preferences.ftl",
+ ]);
+ });
+
+ Preferences.addAll([
+- // IPv6
+- { id: "network.dns.disableIPv6", type: "bool" },
+- // ocsp hard-fail
+- { id: "security.OCSP.require", type: "bool" },
+- // ocsp hard-fail
+- { id: "identity.fxaccounts.enabled", type: "bool" },
++ // IPv6
++ { id: "network.dns.disableIPv6", type: "bool" },
++ // ocsp hard-fail
++ { id: "security.OCSP.require", type: "bool" },
++ // ocsp hard-fail
++ { id: "identity.fxaccounts.enabled", type: "bool" },
+ // WebGL
+ { id: "webgl.disabled", type: "bool" },
+ // RFP
+@@ -31,7 +31,7 @@ Preferences.addAll([
+ { id: "clipboard.autocopy", type: "bool" },
+ { id: "middlemouse.paste", type: "bool" },
+ // XOrigin referrers
+- { id: "network.http.referer.XOriginPolicy", type: "int"},
++ { id: "network.http.referer.XOriginPolicy", type: "int" },
+ // Harden
+ { id: "privacy.resistFingerprinting.letterboxing", type: "bool" },
+ // Google Safe Browsing
+@@ -47,7 +47,10 @@ Preferences.addAll([
+ //{ id: "browser.safebrowsing.downloads.enabled", type: "bool" }, //Also already added
+ { id: "toolkit.legacyUserProfileCustomizations.stylesheets", type: "bool" },
+ // Canvas UI when blocked
+- { id: "privacy.resistFingerprinting.autoDeclineNoUserInputCanvasPrompts", type: "bool" },
++ {
++ id: "privacy.resistFingerprinting.autoDeclineNoUserInputCanvasPrompts",
++ type: "bool",
++ },
+ ]);
+
+ var gLibrewolfPane = {
+@@ -142,7 +145,12 @@ var gLibrewolfPane = {
+ ]
+ );
+
+- Preferences.get("network.http.referer.XOriginPolicy").on("change", syncXOriginPolicy(Preferences.get("network.http.referer.XOriginPolicy")));
++ setXOriginPolicySyncListeners(
++ "librewolf-xorigin-ref-checkbox",
++ "network.http.referer.XOriginPolicy",
++ [1, 2],
++ [0]
++ );
+
+ // Set event listener on open profile directory button
+ setEventListener("librewolf-open-profile", "command", openProfileDirectory);
+@@ -154,12 +162,16 @@ var gLibrewolfPane = {
+ },
+ };
+
+-function syncXOriginPolicy(prefValue) {
+- if (prefValue == "0" || prefValue == "1") {
+- Services.prefs.setIntPref("network.http.referer.XOriginPolicy", 2);
+- } else {
+- Services.prefs.setIntPref("network.http.referer.XOriginPolicy", 0);
+- }
++function setXOriginPolicySyncListeners(checkboxid, pref, onVals, offVals) {
++ setSyncFromPrefListener(checkboxid, () => onVals.includes(getPref(pref)));
++ setSyncToPrefListener(checkboxid, () =>
++ writeGenericPrefs([pref], [2], [0], document.getElementById(checkboxid).checked)
++ );
++ Preferences.get(pref).on("change", () =>
++ makeMasterCheckboxesReactive(checkboxid, () =>
++ onVals.includes(getPref(pref))
++ )
++ );
+ }
+
+ function openProfileDirectory() {
+@@ -196,13 +208,13 @@ function setSyncListeners(checkboxid, opts, onVals, offVals) {
+ }
+
+ function makeMasterCheckboxesReactive(checkboxid, func) {
+- let shouldBeChecked = func();
++ const shouldBeChecked = func();
+ document.getElementById(checkboxid).checked = shouldBeChecked;
+ }
+
+ // Wrapper function in case something more is required (as I suspected in the first iteration of this)
+ function getPref(pref) {
+- let retval = Preferences.get(pref);
++ const retval = Preferences.get(pref);
+ /* if (retval === undefined) {
+ return defaultValue;
+ } */
+diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl
+index 40fdfefd7e52..bfde1423dc1a 100644
+--- a/browser/locales/en-US/browser/preferences/preferences.ftl
++++ b/browser/locales/en-US/browser/preferences/preferences.ftl
+@@ -1401,7 +1401,7 @@ librewolf-ipv6-checkbox =
+ .label = Enable IPv6
+
+ librewolf-privacy-heading = Privacy
+-librewolf-xorigin-ref-checbox =
++librewolf-xorigin-ref-checkbox =
+ .label = Limit cross-origin referrers
+
+ librewolf-broken-heading = Fingerprinting
+--
+2.35.1
+
bgstack15