summarylogtreecommitdiffstats
path: root/allow_dark.patch
blob: 78931ab4512c4c827efd853f378e00f88c8c3b72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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.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
@@ -19449,7 +19449,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
@@ -14490,6 +14490,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