adds an override/exception pref for dark mode and RFP

master
ohfp 2021-06-13 16:17:55 +02:00
parent 5899038df5
commit 15266e5f51
No known key found for this signature in database
GPG Key ID: 2954CC8585E27A3F
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp
index ce2cbca..60fda48 100644
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -17084,6 +17084,7 @@ void Document::RemoveToplevelLoadingDocument(Document* aDoc) {
StylePrefersColorScheme Document::PrefersColorScheme(
IgnoreRFP aIgnoreRFP) const {
if (aIgnoreRFP == IgnoreRFP::No &&
+ !StaticPrefs::privacy_override_rfp_for_color_scheme() &&
nsContentUtils::ShouldResistFingerprinting(this)) {
return StylePrefersColorScheme::Light;
}
diff --git a/modules/libref/init/StaticPrefList.yaml b/modules/libref/init/StaticPrefList.yaml
index b4b2dc7..e65d43f 100644
--- a/modules/libref/init/StaticPrefList.yaml
+++ b/modules/libref/init/StaticPrefList.yaml
@@ -9863,6 +9863,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
+
# We automatically decline canvas permission requests if they are not initiated
# from user input. Just in case that breaks something, we allow the user to
# revert this behavior with this obscure pref. We do not intend to support this