summaryrefslogtreecommitdiff
path: root/website-appearance-ui-rfp.patch
blob: 0de55042bbdfb2470475470234e9e622ff7ce7dd (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
--- a/browser/components/preferences/main.js
+++ b/browser/components/preferences/main.js
@@ -3737,6 +3737,7 @@ const AppearanceChooser = {
     FORCED_COLORS_QUERY.addEventListener("change", this);
     SYSTEM_DARK_MODE_QUERY.addEventListener("change", this);
     Services.prefs.addObserver(PREF_USE_SYSTEM_COLORS, this);
+    Services.prefs.addObserver("privacy.resistFingerprinting", this);
     Services.obs.addObserver(this, "look-and-feel-changed");
     this._update();
   },
@@ -3756,6 +3757,7 @@ const AppearanceChooser = {
 
   destroy() {
     Services.prefs.removeObserver(PREF_USE_SYSTEM_COLORS, this);
+    Services.prefs.removeObserver("privacy.resistFingerprinting", this);
     Services.obs.removeObserver(this, "look-and-feel-changed");
     FORCED_COLORS_QUERY.removeEventListener("change", this);
     SYSTEM_DARK_MODE_QUERY.removeEventListener("change", this);
@@ -3798,5 +3800,33 @@ const AppearanceChooser = {
       (AppConstants.platform == "win" ||
         !Services.prefs.getBoolPref(PREF_USE_SYSTEM_COLORS));
     this.warning.hidden = !forcingColorsAndNoColorSchemeSupport;
+
+    if (Services.prefs.getBoolPref("privacy.resistFingerprinting")) {
+      document.getElementById("web-appearance-chooser").style.opacity = 0.3;
+      document.getElementById("web-appearance-chooser").style.pointerEvents = "none";
+      const infoBox = document.createElement("div");
+      infoBox.id = "web-appearance-rfp-warning";
+      infoBox.classList.add("info-box-container");
+      infoBox.style.display = "flex";
+      infoBox.style.alignItems = "center";
+      infoBox.style.marginTop = "10px";
+      infoBox.style.marginBottom = "5px";
+      const text = document.createElement("div");
+      text.innerText = "This feature is disabled because ResistFingerprinting is enabled. This means LibreWolf will force web content to display in a light theme.";
+      infoBox.appendChild(text);
+      const learnMore = document.createElement("a");
+      learnMore.classList.add("text-link");
+      learnMore.style.marginLeft = "5px";
+      learnMore.style.flexShrink = 0;
+      learnMore.setAttribute("is", "learn-more");
+      learnMore.href = "https://librewolf.net/docs/faq/#why-is-librewolf-forcing-light-theme";
+      learnMore.innerText = "Learn more";
+      infoBox.appendChild(learnMore);
+      document.getElementById("webAppearanceSettings").insertBefore(infoBox, document.getElementById("webAppearanceSettings").children[2]);
+    } else {
+      document.getElementById("web-appearance-rfp-warning")?.remove();
+      document.getElementById("web-appearance-chooser").style.opacity = 1;
+      document.getElementById("web-appearance-chooser").style.pointerEvents = "all";
+    }
   },
 };
bgstack15