librewolf-allow-dark/allow_dark.patch
2025-03-08 10:59:21 -06:00

58 lines
No EOL
2.5 KiB
Diff

diff -ru a/browser/components/preferences/main.js b/browser/components/preferences/main.js
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -4287,6 +4287,7 @@
FORCED_COLORS_QUERY.addEventListener("change", this);
Services.prefs.addObserver(PREF_USE_SYSTEM_COLORS, this);
Services.prefs.addObserver("privacy.resistFingerprinting", this);
+ Services.prefs.addObserver("privacy.override_rfp_for_color_scheme", this);
Services.obs.addObserver(this, "look-and-feel-changed");
this._update();
},
@@ -4324,6 +4325,7 @@
destroy() {
Services.prefs.removeObserver(PREF_USE_SYSTEM_COLORS, this);
Services.prefs.removeObserver("privacy.resistFingerprinting", this);
+ Services.prefs.removeObserver("privacy.override_rfp_for_color_scheme", this);
Services.obs.removeObserver(this, "look-and-feel-changed");
FORCED_COLORS_QUERY.removeEventListener("change", this);
},
@@ -4365,7 +4367,8 @@
this.warning.hidden = !forcingColorsAndNoColorSchemeSupport;
document.getElementById("web-appearance-rfp-warning")?.remove();
- if (Services.prefs.getBoolPref("privacy.resistFingerprinting")) {
+ if (Services.prefs.getBoolPref("privacy.resistFingerprinting") &&
+ !Services.prefs.getBoolPref("privacy.override_rfp_for_color_scheme")) {
document.getElementById("web-appearance-chooser").style.opacity = 0.3;
document.getElementById("web-appearance-chooser").style.pointerEvents = "none";
const infoBox = document.createElement("div");
diff -ru a/dom/base/Document.cpp b/dom/base/Document.cpp
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -19620,7 +19620,8 @@
ColorScheme Document::PreferredColorScheme(IgnoreRFP aIgnoreRFP) const {
if (ShouldResistFingerprinting(RFPTarget::CSSPrefersColorScheme) &&
- aIgnoreRFP == IgnoreRFP::No) {
+ aIgnoreRFP == IgnoreRFP::No &&
+ !StaticPrefs::privacy_override_rfp_for_color_scheme()) {
return ColorScheme::Light;
}
diff -ru a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml
--- a/modules/libpref/init/StaticPrefList.yaml
+++ b/modules/libpref/init/StaticPrefList.yaml
@@ -15246,6 +15246,12 @@
value: false
mirror: always
+# Allows overriding RFP for only the dark/light pref
+- name: privacy.override_rfp_for_color_scheme
+ type: bool
+ value: false
+ mirror: always
+
# Enforce tracking protection in all modes.
- name: privacy.trackingprotection.enabled
type: bool