0
Fork 0
mirror of https://codeberg.org/librewolf/source.git synced 2025-01-03 03:10:07 -05:00

pref-pane patch for 99.0.1 with xorigin fixes

This commit is contained in:
ohfp 2022-04-14 11:30:39 +02:00
parent 4331a8590f
commit 8c73f576c1

View file

@ -1,5 +1,27 @@
From 7da96b1ab28e2e0e9e61bb4b3d7645a2d31e36cb 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 diff --git a/browser/components/preferences/jar.mn b/browser/components/preferences/jar.mn
index 752b0b2..0aa6f60 100644 index 752b0b2ae3d2..0aa6f606b851 100644
--- a/browser/components/preferences/jar.mn --- a/browser/components/preferences/jar.mn
+++ b/browser/components/preferences/jar.mn +++ b/browser/components/preferences/jar.mn
@@ -11,6 +11,7 @@ browser.jar: @@ -11,6 +11,7 @@ browser.jar:
@ -12,7 +34,7 @@ index 752b0b2..0aa6f60 100644
content/browser/preferences/experimental.js content/browser/preferences/experimental.js
diff --git a/browser/components/preferences/librewolf.inc.xhtml b/browser/components/preferences/librewolf.inc.xhtml diff --git a/browser/components/preferences/librewolf.inc.xhtml b/browser/components/preferences/librewolf.inc.xhtml
new file mode 100644 new file mode 100644
index 0000000..7a582fb index 000000000000..7a582fb9bb0c
--- /dev/null --- /dev/null
+++ b/browser/components/preferences/librewolf.inc.xhtml +++ b/browser/components/preferences/librewolf.inc.xhtml
@@ -0,0 +1,254 @@ @@ -0,0 +1,254 @@
@ -272,7 +294,7 @@ index 0000000..7a582fb
+</html:template> +</html:template>
diff --git a/browser/components/preferences/librewolf.js b/browser/components/preferences/librewolf.js diff --git a/browser/components/preferences/librewolf.js b/browser/components/preferences/librewolf.js
new file mode 100644 new file mode 100644
index 0000000..bd20104 index 000000000000..23395f027a50
--- /dev/null --- /dev/null
+++ b/browser/components/preferences/librewolf.js +++ b/browser/components/preferences/librewolf.js
@@ -0,0 +1,260 @@ @@ -0,0 +1,260 @@
@ -287,7 +309,7 @@ index 0000000..bd20104
+XPCOMUtils.defineLazyGetter(this, "L10n", () => { +XPCOMUtils.defineLazyGetter(this, "L10n", () => {
+ return new Localization([ + return new Localization([
+ "branding/brand.ftl", + "branding/brand.ftl",
+ "browser/preferences/preferences.ftl", + "browser/locales/en-US/browser/preferences/preferences.ftl",
+ ]); + ]);
+}); +});
+ +
@ -537,7 +559,7 @@ index 0000000..bd20104
+} +}
+ +
diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js
index f6dc2b3..7d401fc 100644 index f6dc2b3781f8..7d401fc63219 100644
--- a/browser/components/preferences/preferences.js --- a/browser/components/preferences/preferences.js
+++ b/browser/components/preferences/preferences.js +++ b/browser/components/preferences/preferences.js
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
@ -557,7 +579,7 @@ index f6dc2b3..7d401fc 100644
if (Services.prefs.getBoolPref("browser.preferences.experimental")) { if (Services.prefs.getBoolPref("browser.preferences.experimental")) {
// Set hidden based on previous load's hidden value. // Set hidden based on previous load's hidden value.
diff --git a/browser/components/preferences/preferences.xhtml b/browser/components/preferences/preferences.xhtml diff --git a/browser/components/preferences/preferences.xhtml b/browser/components/preferences/preferences.xhtml
index 81059f3..d815682 100644 index 81059f3d2e01..d815682d68bc 100644
--- a/browser/components/preferences/preferences.xhtml --- a/browser/components/preferences/preferences.xhtml
+++ b/browser/components/preferences/preferences.xhtml +++ b/browser/components/preferences/preferences.xhtml
@@ -13,6 +13,7 @@ @@ -13,6 +13,7 @@
@ -595,9 +617,9 @@ index 81059f3..d815682 100644
#include sync.inc.xhtml #include sync.inc.xhtml
#include experimental.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 diff --git a/browser/locales/en-US/browser/preferences/preferences.ftl b/browser/locales/en-US/browser/preferences/preferences.ftl
index 8c3f3f5..40fdfef 100644 index 8c3f3f575598..40fdfefd7e52 100644
--- a/browser/locales/en-US/browser/preferences/preferences.ftl --- a/browser/locales/en-US/browser/preferences/preferences.ftl
+++ b/browser/preferences/preferences.ftl +++ b/browser/locales/en-US/browser/preferences/preferences.ftl
@@ -1372,3 +1372,93 @@ choose-download-folder-title = Choose Download Folder: @@ -1372,3 +1372,93 @@ choose-download-folder-title = Choose Download Folder:
# $service-name (String) - Name of a cloud storage provider like Dropbox, Google Drive, etc... # $service-name (String) - Name of a cloud storage provider like Dropbox, Google Drive, etc...
save-files-to-cloud-storage = save-files-to-cloud-storage =
@ -693,7 +715,7 @@ index 8c3f3f5..40fdfef 100644
+librewolf-config-link = All advanced settings (about:config) +librewolf-config-link = All advanced settings (about:config)
+librewolf-open-profile = Open user profile directory +librewolf-open-profile = Open user profile directory
diff --git a/browser/themes/shared/jar.inc.mn b/browser/themes/shared/jar.inc.mn diff --git a/browser/themes/shared/jar.inc.mn b/browser/themes/shared/jar.inc.mn
index 9e25fa9..f476053 100644 index 9e25fa92fd4c..f47605332b3f 100644
--- a/browser/themes/shared/jar.inc.mn --- a/browser/themes/shared/jar.inc.mn
+++ b/browser/themes/shared/jar.inc.mn +++ b/browser/themes/shared/jar.inc.mn
@@ -86,6 +86,7 @@ @@ -86,6 +86,7 @@
@ -714,7 +736,7 @@ index 9e25fa9..f476053 100644
skin/classic/browser/upgradeDialog/abstract.png (../shared/upgradeDialog/abstract.png) skin/classic/browser/upgradeDialog/abstract.png (../shared/upgradeDialog/abstract.png)
diff --git a/browser/themes/shared/preferences/category-librewolf.svg b/browser/themes/shared/preferences/category-librewolf.svg diff --git a/browser/themes/shared/preferences/category-librewolf.svg b/browser/themes/shared/preferences/category-librewolf.svg
new file mode 100644 new file mode 100644
index 0000000..8ebf2eb index 000000000000..8ebf2ebe19a9
--- /dev/null --- /dev/null
+++ b/browser/themes/shared/preferences/category-librewolf.svg +++ b/browser/themes/shared/preferences/category-librewolf.svg
@@ -0,0 +1,96 @@ @@ -0,0 +1,96 @@
@ -816,7 +838,7 @@ index 0000000..8ebf2eb
+ +
diff --git a/browser/themes/shared/preferences/librewolf.css b/browser/themes/shared/preferences/librewolf.css diff --git a/browser/themes/shared/preferences/librewolf.css b/browser/themes/shared/preferences/librewolf.css
new file mode 100644 new file mode 100644
index 0000000..12f926a index 000000000000..12f926ab7018
--- /dev/null --- /dev/null
+++ b/browser/themes/shared/preferences/librewolf.css +++ b/browser/themes/shared/preferences/librewolf.css
@@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
@ -844,7 +866,7 @@ index 0000000..12f926a
+ fill: currentColor; + fill: currentColor;
+} +}
diff --git a/browser/themes/shared/preferences/preferences.css b/browser/themes/shared/preferences/preferences.css diff --git a/browser/themes/shared/preferences/preferences.css b/browser/themes/shared/preferences/preferences.css
index 8b110d3..801b183 100644 index 8b110d3eed52..801b1835a7a4 100644
--- a/browser/themes/shared/preferences/preferences.css --- a/browser/themes/shared/preferences/preferences.css
+++ b/browser/themes/shared/preferences/preferences.css +++ b/browser/themes/shared/preferences/preferences.css
@@ -222,6 +222,10 @@ checkbox { @@ -222,6 +222,10 @@ checkbox {
@ -858,3 +880,159 @@ index 8b110d3..801b183 100644
#category-sync > .category-icon { #category-sync > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/category-sync.svg"); list-style-image: url("chrome://browser/skin/preferences/category-sync.svg");
} }
--
2.35.1
From 05a4e5c148f53263b65577724ab857b16b516673 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 40fdfefd7e52..bfde1423dc1a 100644
--- a/browser/locales/en-US/browser/preferences/preferences.ftl
+++ b/browser/locales/en-US/browser/preferences/preferences.ftl
@@ -1401,7 +1401,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.35.1