mirror of
https://codeberg.org/librewolf/source.git
synced 2024-12-22 13:43:04 -05:00
update pref pane patch with latest changes from gecko-dev
This commit is contained in:
parent
f42fd2e2e8
commit
586b3d5b49
1 changed files with 52 additions and 203 deletions
|
@ -1,25 +1,3 @@
|
|||
From cf709e1a1c879fb6b88d7dc05d2ab3e7b759ffbe 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 912d9edf0855..30a83da4edca 100644
|
||||
--- a/browser/components/preferences/jar.mn
|
||||
|
@ -34,7 +12,7 @@ index 912d9edf0855..30a83da4edca 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 000000000000..7a582fb9bb0c
|
||||
index 000000000000..c2dfea6d0858
|
||||
--- /dev/null
|
||||
+++ b/browser/components/preferences/librewolf.inc.xhtml
|
||||
@@ -0,0 +1,254 @@
|
||||
|
@ -145,7 +123,7 @@ index 000000000000..7a582fb9bb0c
|
|||
+ <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">
|
||||
|
@ -153,7 +131,7 @@ index 000000000000..7a582fb9bb0c
|
|||
+ <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>
|
||||
+
|
||||
|
@ -294,10 +272,10 @@ index 000000000000..7a582fb9bb0c
|
|||
+</html:template>
|
||||
diff --git a/browser/components/preferences/librewolf.js b/browser/components/preferences/librewolf.js
|
||||
new file mode 100644
|
||||
index 000000000000..23395f027a50
|
||||
index 000000000000..c8cbb075d59b
|
||||
--- /dev/null
|
||||
+++ b/browser/components/preferences/librewolf.js
|
||||
@@ -0,0 +1,260 @@
|
||||
@@ -0,0 +1,287 @@
|
||||
+/* 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/. */
|
||||
|
@ -309,17 +287,17 @@ index 000000000000..23395f027a50
|
|||
+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
|
||||
|
@ -331,7 +309,7 @@ index 000000000000..23395f027a50
|
|||
+ { 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
|
||||
|
@ -347,7 +325,10 @@ index 000000000000..23395f027a50
|
|||
+ //{ 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 = {
|
||||
|
@ -442,7 +423,12 @@ index 000000000000..23395f027a50
|
|||
+ ]
|
||||
+ );
|
||||
+
|
||||
+ 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);
|
||||
|
@ -454,12 +440,16 @@ index 000000000000..23395f027a50
|
|||
+ },
|
||||
+};
|
||||
+
|
||||
+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() {
|
||||
|
@ -496,13 +486,13 @@ index 000000000000..23395f027a50
|
|||
+}
|
||||
+
|
||||
+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;
|
||||
+ } */
|
||||
|
@ -558,6 +548,21 @@ index 000000000000..23395f027a50
|
|||
+ return writeArr[0];
|
||||
+}
|
||||
+
|
||||
+Preferences.get("identity.fxaccounts.enabled").on("change", () => {
|
||||
+ confirmRestartPrompt(
|
||||
+ Services.prefs.getBoolPref("identity.fxaccounts.enabled"), // Restart is required to *enable* / *disable* the pref
|
||||
+ 1, // Default Button Index
|
||||
+ true, // Cancel instead of Revert Button
|
||||
+ false // No Restart Later button
|
||||
+ ).then(buttonIndex => {
|
||||
+ if (buttonIndex == CONFIRM_RESTART_PROMPT_RESTART_NOW) {
|
||||
+ Services.startup.quit(
|
||||
+ Ci.nsIAppStartup.eAttemptQuit | Ci.nsIAppStartup.eRestart
|
||||
+ );
|
||||
+ return;
|
||||
+ }
|
||||
+ });
|
||||
+});
|
||||
diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js
|
||||
index f6dc2b3781f8..7d401fc63219 100644
|
||||
--- a/browser/components/preferences/preferences.js
|
||||
|
@ -617,7 +622,7 @@ index 81059f3d2e01..d815682d68bc 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 f4d5eaea2193..61c05fb0560f 100644
|
||||
index f4d5eaea2193..46de6b40af65 100644
|
||||
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
|
||||
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
|
||||
@@ -1409,3 +1409,93 @@ choose-download-folder-title = Choose Download Folder:
|
||||
|
@ -653,7 +658,7 @@ index f4d5eaea2193..61c05fb0560f 100644
|
|||
+ .label = Enable IPv6
|
||||
+
|
||||
+librewolf-privacy-heading = Privacy
|
||||
+librewolf-xorigin-ref-checbox =
|
||||
+librewolf-xorigin-ref-checkbox =
|
||||
+ .label = Limit cross-origin referrers
|
||||
+
|
||||
+librewolf-broken-heading = Fingerprinting
|
||||
|
@ -880,159 +885,3 @@ index 406dc5603070..d6920777ec81 100644
|
|||
#category-sync > .category-icon {
|
||||
list-style-image: url("chrome://browser/skin/preferences/category-sync.svg");
|
||||
}
|
||||
--
|
||||
2.36.0
|
||||
|
||||
|
||||
From 0844e8bdf9c85bb4d74f923d0b97ae834c24e6c1 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 61c05fb0560f..46de6b40af65 100644
|
||||
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
|
||||
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
|
||||
@@ -1438,7 +1438,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.36.0
|
||||
|
||||
|
|
Loading…
Reference in a new issue