diff --git a/browser/components/preferences/jar.mn b/browser/components/preferences/jar.mn
index 4f3babe..97c7ec2 100644
--- a/browser/components/preferences/jar.mn
+++ b/browser/components/preferences/jar.mn
@@ -11,6 +11,7 @@ browser.jar:
content/browser/preferences/home.js
content/browser/preferences/search.js
content/browser/preferences/privacy.js
+ content/browser/preferences/librewolf.js
content/browser/preferences/containers.js
content/browser/preferences/sync.js
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 0000000..74395a0
--- /dev/null
+++ b/browser/components/preferences/librewolf.inc.xhtml
@@ -0,0 +1,381 @@
+# 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/.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/browser/components/preferences/librewolf.js b/browser/components/preferences/librewolf.js
new file mode 100644
index 0000000..6a1f974
--- /dev/null
+++ b/browser/components/preferences/librewolf.js
@@ -0,0 +1,381 @@
+/* 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/. */
+
+/* import-globals-from extensionControlled.js */
+/* import-globals-from preferences.js */
+
+var { AppConstants } = ChromeUtils.import( "resource://gre/modules/AppConstants.jsm");
+XPCOMUtils.defineLazyGetter(this, "L10n", () => {
+ return new Localization([
+ "branding/brand.ftl",
+ "browser/preferences/preferences.ftl",
+ ]);
+});
+
+Preferences.addAll([
+ // IPv6
+ { id: "network.dns.disableIPv6", type: "bool" },
+ // WebGL
+ { id: "webgl.disabled", type: "bool" },
+ { id: "webgl.enable-webgl2", type: "bool" },
+ // Video Conferencing
+ { id: "media.peerconnection.enabled", type: "bool" },
+ { id: "media.peerconnection.ice.no_host", type: "bool" },
+ { id: "dom.webaudio.enabled", type: "bool" },
+ // Screensharing
+ { id: "media.getusermedia.screensharing.enabled", type: "bool" },
+ // DRM
+ //{ id: "media.eme.enabled", type: "bool" }, //already added
+ { id: "media.gmp-widevinecdm.visible", type: "bool" },
+ { id: "media.gmp-widevinecdm.enabled", type: "bool" },
+ { id: "media.gmp-provider.enabled", type: "bool" },
+ { id: "media.gmp-manager.url", type: "string" },
+ // Automatically Update Extensions
+ { id: "extensions.update.enabled", type: "bool" },
+ { id: "extensions.update.autoUpdateDefault", type: "bool" },
+ // Clipboard autocopy/paste
+ { id: "clipboard.autocopy", type: "bool" },
+ { id: "middlemouse.paste", type: "bool" },
+ // Search Suggestions //This is in the FAQ but it is also in about:preferences#search so I don't think it should be included here
+ //{ id: "browser.search.suggest.enabled", type: "bool" },
+ //{ id: "browser.urlbar.suggest.searches", type: "bool" },
+ // Harden
+ { id: "javascript.options.asmjs", type: "bool" },
+ { id: "javascript.options.wasm", type: "bool" },
+ { id: "privacy.resistFingerprinting.letterboxing", type: "bool" },
+ { id: "dom.event.clipboardevents.enabled", type: "bool" },
+ // OCSP certificate revocation
+ //{ id: "security.OCSP.enabled", type: "int" }, //Already enabled
+ { id: "security.OCSP.require", type: "bool" },
+ { id: "security.pki.crlite_mode", type: "int" },
+ // Google Safe Browsing
+ //{ id: "browser.safebrowsing.malware.enabled", type: "bool" }, // Already loaded
+ //{ id: "browser.safebrowsing.phishing.enabled", type: "bool" },
+ { id: "browser.safebrowsing.blockedURIs.enabled", type: "bool" },
+ { id: "browser.safebrowsing.provider.google4.gethashURL", type: "string" },
+ { id: "browser.safebrowsing.provider.google4.updateURL", type: "string" },
+ { id: "browser.safebrowsing.provider.google.gethashURL", type: "string" },
+ { id: "browser.safebrowsing.provider.google.updateURL", type: "string" },
+ // Restore Previous Session
+ //{ id: "browser.startup.page", type: "int" }, //Already added
+ { id: "privacy.clearOnShutdown.history", type: "bool" },
+ /**** Prefs that require changing a lockPref ****/
+ // Google safe browsing check downloads
+ //{ id: "browser.safebrowsing.downloads.enabled", type: "bool" }, //Also already added
+ // Mozilla Tracking Protection
+ //{ id: "privacy.trackingprotection.enabled", type: "bool" }, //Already added
+ //{ id: "privacy.trackingprotection.pbmode.enabled", type: "bool" }, //already added
+ { id: "browser.contentblocking.cryptomining.preferences.ui.enabled", type: "bool" },
+ { id: "browser.contentblocking.fingerprinting.preferences.ui.enabled", type: "bool" },
+ { id: "browser.safebrowsing.provider.mozilla.updateURL", type: "string" },
+ { id: "browser.safebrowing.provider.mozilla.gethashURL", type: "string" },
+ //{ id: "privacy.trackingprotection.cryptomining.enabled", type: "bool" }, //Already added
+ //{ id: "privacy.trackingprotection.fingerprinting.enabled", type: "bool" }, //Already added
+ //{ id: "privacy.trackingprotection.socialtracking.enabled", type: "bool" }, //Already added
+ { id: "toolkit.legacyUserProfileCustomizations.stylesheets", type: "bool" },
+ { id: "layout.css.backdrop-filter.enabled", type: "bool" },
+ { id: "svg.context-properties.content.enabled", type: "bool" },
+ // Install language packs
+ { id: "extensions.getAddons.langpacks.url", type: "string" },
+ // Canvas UI when blocked
+ { id: "privacy.resistFingerprinting.autoDeclineNoUserInputCanvasPrompts", type: "bool" },
+ // Geolocation data
+ { id: "geo.enabled", type: "bool" },
+]);
+
+var gLibrewolfPane = {
+ _pane: null,
+
+ // called when the document is first parsed
+ init() {
+ this._pane = document.getElementById("paneLibrewolf");
+
+ // Set all event listeners on checkboxes
+ setBoolSyncListeners(
+ "librewolf-extension-update-checkbox",
+ ["extensions.update.autoUpdateDefault", "extensions.update.enabled"],
+ [true, true ],
+ );
+ setBoolSyncListeners(
+ "librewolf-ipv6-checkbox",
+ ["network.dns.disableIPv6"],
+ [false, ],
+ );
+ setSyncListeners(
+ "librewolf-restore-session-checkbox",
+ ["browser.startup.page", "privacy.clearOnShutdown.history", ],
+ [3, false, ],
+ [1, true, ],
+ );
+ setSyncListeners("librewolf-restore-session-startup-page", ["browser.startup.page"], [3], [1]);
+ setBoolSyncListeners(
+ "librewolf-autocopy-checkbox",
+ ["clipboard.autocopy", "middlemouse.paste"],
+ [true, true ],
+ );
+ setBoolSyncListeners(
+ "librewolf-styling-checkbox",
+ ["toolkit.legacyUserProfileCustomizations.stylesheets", "layout.css.backdrop-filter.enabled", "svg.context-properties.content.enabled"],
+ [true, true, true ],
+ );
+
+ setBoolSyncListeners(
+ "librewolf-webgl-checkbox",
+ ["webgl.disabled", "webgl.enable-webgl2"],
+ [false, true ],
+ );
+ setBoolSyncListeners(
+ "librewolf-conferencing-checkbox",
+ ["media.peerconnection.enabled", "media.peerconnection.ice.no_host"],
+ [true, true, ],
+ );
+ setBoolSyncListeners(
+ "librewolf-screensharing-checkbox",
+ ["media.getusermedia.screensharing.enabled"],
+ [true ],
+ );
+ setBoolSyncListeners(
+ "librewolf-auto-decline-canvas-checkbox",
+ ["privacy.resistFingerprinting.autoDeclineNoUserInputCanvasPrompts"],
+ [true ],
+ );
+ setSyncListeners(
+ "librewolf-drm-checkbox",
+ ["media.eme.enabled", "media.gmp-widevinecdm.visible", "media.gmp-widevinecdm.enabled", "media.gmp-provider.enabled", "media.gmp-manager.url"],
+ [true, true, true, true, "https://aus5.mozilla.org/update/3/GMP/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml"],
+ [false, false, false, false, "" ],
+ );
+ setSyncListeners("librewolf-drm-url", ["media.gmp-manager.url"], ["https://aus5.mozilla.org/update/3/GMP/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml"], [""]);
+
+ setBoolSyncListeners(
+ "librewolf-hardened-master-checkbox",
+ ["privacy.resistFingerprinting.letterboxing", "javascript.options.asmjs", "javascript.options.wasm"],
+ [true, false, false ],
+ );
+ setBoolSyncListeners("librewolf-web-applications-checkbox", ["javascript.options.asmjs"], [false]);
+ setBoolSyncListeners("librewolf-wasm-checkbox", ["javascript.options.wasm"], [false]);
+
+ setSyncListeners(
+ "librewolf-goog-safe-checkbox",
+ [
+ "browser.safebrowsing.malware.enabled",
+ "browser.safebrowsing.phishing.enabled",
+ "browser.safebrowsing.blockedURIs.enabled",
+ "browser.safebrowsing.provider.google4.gethashURL",
+ "browser.safebrowsing.provider.google4.updateURL",
+ "browser.safebrowsing.provider.google.gethashURL",
+ "browser.safebrowsing.provider.google.updateURL",
+ ],
+ [
+ true,
+ true,
+ true,
+ "https://safebrowsing.googleapis.com/v4/fullHashes:find?$ct=application/x-protobuf&key=%GOOGLE_SAFEBROWSING_API_KEY%&$httpMethod=POST",
+ "https://safebrowsing.googleapis.com/v4/threatListUpdates:fetch?$ct=application/x-protobuf&key=%GOOGLE_SAFEBROWSING_API_KEY%&$httpMethod=POST",
+ "https://safebrowsing.google.com/safebrowsing/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2",
+ "https://safebrowsing.google.com/safebrowsing/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2&key=%GOOGLE_SAFEBROWSING_API_KEY%",
+ ],
+ [
+ false,
+ false,
+ false,
+ "",
+ "",
+ "",
+ "",
+ ]
+ );
+ /* TODO commented out because lockpref and also unsure what we want to do with it
+ setSyncListeners(
+ "librewolf-moz-track-prot-checkbox",
+ [
+ "privacy.trackingprotection.enabled",
+ "browser.contentblocking.cryptomining.preferences.ui.enabled",
+ "browser.contentblocking.fingerprinting.preferences.ui.enabled",
+ "privacy.trackingprotection.cryptomining.enabled",
+ "privacy.trackingprotection.fingerprinting.enabled",
+ "privacy.trackingprotection.socialtracking.enabled",
+ "browser.safebrowsing.provider.mozilla.updateURL",
+ "browser.safebrowing.provider.mozilla.gethashURL",
+ ],
+ [
+ true,
+ true,
+ true,
+ true,
+ true,
+ true,
+ "https://shavar.services.mozilla.com/downloads?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2",
+ "https://shavar.services.mozilla.com/gethash?client=SAFEBROWSING_ID&appver=%MAJOR_VERSION%&pver=2.2",
+ ],
+ [
+ false,
+ false,
+ false,
+ false,
+ false,
+ false,
+ "",
+ "",
+ ]
+ );
+ */
+ setSyncListeners("librewolf-language-checkbox", ["extensions.getAddons.langpacks.url"], ["https://services.addons.mozilla.org/api/v3/addons/language-tools/?app=firefox&type=language&appversion=%VERSION%"], [""]);
+ setSyncListeners("librewolf-language-url", ["extensions.getAddons.langpacks.url"], ["https://services.addons.mozilla.org/api/v3/addons/language-tools/?app=firefox&type=language&appversion=%VERSION%"], [""]);
+
+ // Set event listeners on the radio buttons for OCSP
+ /* TODO commented out because not ready yet
+ syncFromOCSP();
+ setEventListener("librewolf-OCSP-radiogroup", "command", syncToOCSP);
+ // Update radio-value when the pref changes
+ Preferences.get("security.pki.crlite_mode").on("change", syncFromOCSP);
+ Preferences.get("security.OCSP.enabled").on("change", syncFromOCSP);
+ Preferences.get("security.OCSP.require").on("change", syncFromOCSP);
+ */
+
+ // Set event listener on open profile directory button
+ setEventListener("librewolf-open-profile-button", "command", openProfileDirectory);
+ // Set event listener on open about:config button
+ setEventListener("librewolf-config-link", "click", openAboutConfig);
+
+ // Notify observers that the UI is now ready
+ Services.obs.notifyObservers(window, "librewolf-pane-loaded");
+ },
+};
+
+function openProfileDirectory() {
+ // Get the profile directory.
+ let currProfD = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ let profileDir = currProfD.path;
+
+ // Show the profile directory.
+ let nsLocalFile = Components.Constructor(
+ "@mozilla.org/file/local;1",
+ "nsIFile",
+ "initWithPath"
+ );
+ new nsLocalFile(profileDir).reveal();
+}
+
+function openAboutConfig() {
+ window.open("about:config", "_blank");
+}
+
+function setBoolSyncListeners(checkboxid, opts, vals) {
+ setSyncFromPrefListener(checkboxid, () => readGenericBoolPrefs(opts, vals));
+ setSyncToPrefListener(checkboxid, () => writeGenericBoolPrefs(opts, vals, document.getElementById(checkboxid).checked));
+ for (let i = 1; i < opts.length; i++) {
+ Preferences.get(opts[i]).on("change", () => makeMasterCheckboxesReactive(checkboxid, () => readGenericBoolPrefs(opts, vals)));
+ }
+}
+function setSyncListeners(checkboxid, opts, onVals, offVals) {
+ setSyncFromPrefListener(checkboxid, () => readGenericPrefs(opts, onVals, offVals));
+ setSyncToPrefListener(checkboxid, () => writeGenericPrefs(opts, onVals, offVals, document.getElementById(checkboxid).checked));
+ for (let i = 1; i < opts.length; i++) {
+ Preferences.get(opts[i]).on("change", () => makeMasterCheckboxesReactive(checkboxid, () => readGenericPrefs(opts, onVals, offVals)));
+ }
+}
+
+function makeMasterCheckboxesReactive(checkboxid, func) {
+ let 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);
+/* if (retval === undefined) {
+ return defaultValue;
+ } */
+ return retval._value;
+}
+// Returns true if all the preferences in prefs are equal to onVals, false otherwise TODO may need a third array for their default values because mozilla is dumb, after testing though pretty sure this was misinformation being spread by comments in default FF code that has long since been fixed
+function readGenericBoolPrefs(prefs, onVals) {
+ for (let i = 0; i < prefs.length; i++) {
+ if (getPref(prefs[i]) != onVals[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+function writeGenericBoolPrefs(opts, vals, changeToOn) {
+ valsCopy = [...vals];
+ if (!changeToOn) {
+ for (let i = 0; i < vals.length; i++) {
+ valsCopy[i] = !vals[i];
+ }
+ }
+ // Start at 1 because returning sets the last one
+ for (let i = 1; i < vals.length; i++) {
+ Services.prefs.setBoolPref(opts[i], valsCopy[i]);
+ }
+ return valsCopy[0];
+}
+
+// Returns true if all the preferences in prefs are equal to onVals, false otherwise... currently the same as for Bool as offVals is ignored
+function readGenericPrefs(prefs, onVals, offVals) {
+ for (let i = 0; i < prefs.length; i ++) {
+ let temp = getPref(prefs[i]);
+ if (getPref(prefs[i]) != onVals[i]) {
+ return false;
+ }
+ }
+ return true;
+}
+function writeGenericPrefs(opts, onVals, offVals, changeToOn) {
+ let writeArr = (changeToOn) ? onVals : offVals;
+ for (let i = 1; i < opts.length; i++) {
+ let type = typeof(writeArr[i]);
+ if (type == "number") {
+ Services.prefs.setIntPref(opts[i], writeArr[i]);
+ } else if (type == "boolean") {
+ Services.prefs.setBoolPref(opts[i], writeArr[i]);
+ } else if (type == "string") {
+ Services.prefs.setCharPref(opts[i], writeArr[i]);
+ } else {
+ console.log("BADNESS 10000");
+ }
+ }
+ return writeArr[0];
+}
+
+function syncFromOCSP() {
+ let OCSPpolicy = getPref("security.OCSP.enabled");
+ let OCSPrequire = getPref("security.OCSP.require");
+ let crlitePolicy = getPref("security.pki.crlite_mode");
+ let radioButtons = document.getElementById("librewolf-OCSP-radiogroup");
+
+ if (OCSPpolicy == 0 && OCSPrequire == false && crlitePolicy == 0) {
+ radioButtons.value = "0";
+ } else if (OCSPpolicy == 0 && OCSPrequire == false && crlitePolicy == 1) {
+ radioButtons.value = "1";
+ } else if (OCSPpolicy == 1 && OCSPrequire == true && crlitePolicy == 1) {
+ radioButtons.value = "2";
+ } else if (OCSPpolicy == 1 && OCSPrequire == true && crlitePolicy == 0) {
+ radioButtons.value = "3";
+ } else {
+ radioButtons.value = "unknown";
+ }
+ console.log(radioButtons.value);
+}
+function syncToOCSP() {
+ let value = document.getElementById("librewolf-OCSP-radiogroup").value;
+ if (value == "0") {
+ Services.prefs.setBoolPref("security.OCSP.require", false);
+ Services.prefs.setIntPref("security.OCSP.enabled", 0);
+ Services.prefs.setIntPref("security.pki.crlite_mode", 0);
+ } else if (value == "1") {
+ Services.prefs.setBoolPref("security.OCSP.require", false);
+ Services.prefs.setIntPref("security.OCSP.enabled", 0);
+ Services.prefs.setIntPref("security.pki.crlite_mode", 1);
+ } else if (value == "2") {
+ Services.prefs.setBoolPref("security.OCSP.require", true);
+ Services.prefs.setIntPref("security.OCSP.enabled", 1);
+ Services.prefs.setIntPref("security.pki.crlite_mode", 1);
+ } else if (value == "3") {
+ Services.prefs.setBoolPref("security.OCSP.require", true);
+ Services.prefs.setIntPref("security.OCSP.enabled", 1);
+ Services.prefs.setIntPref("security.pki.crlite_mode", 0);
+ } // else value == "unknown" and do nothing
+}
diff --git a/browser/components/preferences/preferences.js b/browser/components/preferences/preferences.js
index 91e9e46..763ab49 100644
--- a/browser/components/preferences/preferences.js
+++ b/browser/components/preferences/preferences.js
@@ -8,6 +8,7 @@
/* import-globals-from search.js */
/* import-globals-from containers.js */
/* import-globals-from privacy.js */
+/* import-globals-from librewolf.js */
/* import-globals-from sync.js */
/* import-globals-from experimental.js */
/* import-globals-from findInPage.js */
@@ -117,6 +118,7 @@ function init_all() {
register_module("paneHome", gHomePane);
register_module("paneSearch", gSearchPane);
register_module("panePrivacy", gPrivacyPane);
+ register_module("paneLibrewolf", gLibrewolfPane);
register_module("paneContainers", gContainersPane);
if (Services.prefs.getBoolPref("browser.preferences.experimental")) {
// Set hidden based on previous load's hidden value.
diff --git a/browser/components/preferences/preferences.xhtml b/browser/components/preferences/preferences.xhtml
index aab4a9e..907a631 100644
--- a/browser/components/preferences/preferences.xhtml
+++ b/browser/components/preferences/preferences.xhtml
@@ -12,6 +12,7 @@
+
@@ -128,6 +129,17 @@
+
+
+
+
+
+
+
+-->
+
+
+
diff --git a/browser/themes/shared/preferences/librewolf.css b/browser/themes/shared/preferences/librewolf.css
new file mode 100644
index 0000000..aeb550c
--- /dev/null
+++ b/browser/themes/shared/preferences/librewolf.css
@@ -0,0 +1,16 @@
+.librewolf-collapse > input {
+ display: none;
+}
+.librewolf-collapse > input ~ .librewolf-collapsed {
+ display: none;
+ /* max-height: 0; */
+ transition: max-height 0.25s ease-in-out;
+}
+.librewolf-collapse > input:checked ~ .librewolf-collapsed {
+ display: block;
+ /* max-height: 20rem; */
+}
+.librewolf-warning {
+ display: inline;
+ font-size: 0.8em;
+}
diff --git a/browser/themes/shared/preferences/preferences.inc.css b/browser/themes/shared/preferences/preferences.inc.css
index 31bffd0..1f9fbcf 100644
--- a/browser/themes/shared/preferences/preferences.inc.css
+++ b/browser/themes/shared/preferences/preferences.inc.css
@@ -201,6 +201,10 @@ checkbox {
list-style-image: url("chrome://browser/skin/preferences/category-privacy-security.svg");
}
+#category-librewolf > .category-icon {
+ list-style-image: url("chrome://browser/skin/preferences/category-librewolf.svg");
+}
+
#category-sync > .category-icon {
list-style-image: url("chrome://browser/skin/preferences/category-sync.svg");
}