diff --git a/patches/gecko-overlay/ironfox/prefs/GeckoSettingsBridge.sys.mjs b/patches/gecko-overlay/ironfox/prefs/GeckoSettingsBridge.sys.mjs index a637ed77..8f5f78b9 100644 --- a/patches/gecko-overlay/ironfox/prefs/GeckoSettingsBridge.sys.mjs +++ b/patches/gecko-overlay/ironfox/prefs/GeckoSettingsBridge.sys.mjs @@ -93,8 +93,6 @@ export var GeckoSettingsBridge = { this.setWebRTCEnabled(value); } else if (pref === "browser.ironfox.fenix.xpinstallEnabled") { this.setXPInstallEnabled(value); - } else { - throw new Error(`Unsupported preference: ${pref}`); }; if (type === "boolean") { Services.prefs.getDefaultBranch(null).setBoolPref(pref, value); diff --git a/patches/gecko-overlay/ironfox/prefs/ironfox.js b/patches/gecko-overlay/ironfox/prefs/ironfox.js index 84d4d38b..909613bd 100644 --- a/patches/gecko-overlay/ironfox/prefs/ironfox.js +++ b/patches/gecko-overlay/ironfox/prefs/ironfox.js @@ -3,10 +3,6 @@ /// Actual preferences are set at `ironfox.cfg` (located at `patches/build/gecko/ironfox.cfg` within the IronFox source repo) // This is just a "bootstrap" of sorts... -/// First, we need to set the default values for preferences set via GeckoRuntimeSettings -#include geckoruntimesettings-prefs.js -#include contentblocking-prefs.js - /// Set-up AutoConfig // https://support.mozilla.org/kb/customizing-firefox-using-autoconfig pref("general.config.sandbox_enabled", true, locked); // Ensure AutoConfig is sandboxed diff --git a/scripts/prebuild-if.sh b/scripts/prebuild-if.sh index f4044a53..115870d0 100755 --- a/scripts/prebuild-if.sh +++ b/scripts/prebuild-if.sh @@ -896,41 +896,6 @@ function prepare_firefox() { # Nuke undesired Mozilla endpoints bash -x "${IRONFOX_SCRIPTS}/noop_mozilla_endpoints.sh" 'firefox' - # Fail on use of prebuilt binary - "${IRONFOX_SED}" -i 's|https://github.com|hxxps://github.com|' "${IRONFOX_GECKO}/python/mozboot/mozboot/android.py" - - # Make the build system think we installed the emulator and an AVD - mkdir -vp "${IRONFOX_ANDROID_SDK}/emulator" - mkdir -vp "${IRONFOX_MOZBUILD}/android-device/avd" - - # Do not check the "emulator" utility which is obviously absent in the empty directory we created above - "${IRONFOX_SED}" -i -e '/check_android_tools("emulator"/d' "${IRONFOX_GECKO}/build/moz.configure/android-sdk.configure" - - # Do not define `browser.safebrowsing.features.` prefs by default - ## These are unnecessary, add extra confusion and complexity, and don't appear to interact well with our other prefs/settings - "${IRONFOX_SED}" -i \ - -e 's|"browser.safebrowsing.features.cryptomining.update"|"z99.ignore.boolean"|' \ - -e 's|"browser.safebrowsing.features.fingerprinting.update"|"z99.ignore.boolean"|' \ - -e 's|"browser.safebrowsing.features.harmfuladdon.update"|"z99.ignore.boolean"|' \ - -e 's|"browser.safebrowsing.features.malware.update"|"z99.ignore.boolean"|' \ - -e 's|"browser.safebrowsing.features.phishing.update"|"z99.ignore.boolean"|' \ - -e 's|"browser.safebrowsing.features.trackingAnnotation.update"|"z99.ignore.boolean"|' \ - -e 's|"browser.safebrowsing.features.trackingProtection.update"|"z99.ignore.boolean"|' \ - "${IRONFOX_GECKO}/mobile/android/app/geckoview-prefs.js" - - # Gecko prefs - echo '' >>"${IRONFOX_GECKO}/mobile/android/app/geckoview-prefs.js" - echo '#include ../../../ironfox/prefs/ironfox.js' >>"${IRONFOX_GECKO}/mobile/android/app/geckoview-prefs.js" - - # Apply Gecko overlay - apply_overlay "${IRONFOX_GECKO_OVERLAY}/" - - # Convert prefs set by GeckoRuntimeSettings to static/standard prefs .js files - ## We need this because there have been instances in the past where upstream only defined default pref values - ## for Android as GeckoRuntimeSettings, and not elsewhere at ex. `all.js`/`geckoview-prefs.js` - bash -x "${IRONFOX_SCRIPTS}/extract-geckoruntimesettings-prefs.sh" "${IRONFOX_GECKO}/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java" "${IRONFOX_GECKO}/ironfox/prefs/geckoruntimesettings-prefs.js" - bash -x "${IRONFOX_SCRIPTS}/extract-contentblocking-prefs.sh" "${IRONFOX_GECKO}/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ContentBlocking.java" "${IRONFOX_GECKO}/ironfox/prefs/contentblocking-prefs.js" - # Take back control of preferences ## This prevents GeckoView from overriding the follow prefs at runtime, which also means we don't have to worry about Nimbus overriding them, etc... ## The prefs will instead take the values we specify in the phoenix/ironfox .js files, and users will also be able to override them via the `about:config` @@ -1016,6 +981,35 @@ function prepare_firefox() { -e 's|"webgl.msaa-samples"|"z99.ignore.integer"|' \ "${IRONFOX_GECKO}/mobile/android/geckoview/src/main/java/org/mozilla/geckoview/GeckoRuntimeSettings.java" + # Fail on use of prebuilt binary + "${IRONFOX_SED}" -i 's|https://github.com|hxxps://github.com|' "${IRONFOX_GECKO}/python/mozboot/mozboot/android.py" + + # Make the build system think we installed the emulator and an AVD + mkdir -vp "${IRONFOX_ANDROID_SDK}/emulator" + mkdir -vp "${IRONFOX_MOZBUILD}/android-device/avd" + + # Do not check the "emulator" utility which is obviously absent in the empty directory we created above + "${IRONFOX_SED}" -i -e '/check_android_tools("emulator"/d' "${IRONFOX_GECKO}/build/moz.configure/android-sdk.configure" + + # Do not define `browser.safebrowsing.features.` prefs by default + ## These are unnecessary, add extra confusion and complexity, and don't appear to interact well with our other prefs/settings + "${IRONFOX_SED}" -i \ + -e 's|"browser.safebrowsing.features.cryptomining.update"|"z99.ignore.boolean"|' \ + -e 's|"browser.safebrowsing.features.fingerprinting.update"|"z99.ignore.boolean"|' \ + -e 's|"browser.safebrowsing.features.harmfuladdon.update"|"z99.ignore.boolean"|' \ + -e 's|"browser.safebrowsing.features.malware.update"|"z99.ignore.boolean"|' \ + -e 's|"browser.safebrowsing.features.phishing.update"|"z99.ignore.boolean"|' \ + -e 's|"browser.safebrowsing.features.trackingAnnotation.update"|"z99.ignore.boolean"|' \ + -e 's|"browser.safebrowsing.features.trackingProtection.update"|"z99.ignore.boolean"|' \ + "${IRONFOX_GECKO}/mobile/android/app/geckoview-prefs.js" + + # Gecko prefs + echo '' >>"${IRONFOX_GECKO}/mobile/android/app/geckoview-prefs.js" + echo '#include ../../../ironfox/prefs/ironfox.js' >>"${IRONFOX_GECKO}/mobile/android/app/geckoview-prefs.js" + + # Apply Gecko overlay + apply_overlay "${IRONFOX_GECKO_OVERLAY}/" + ## The following are for the build script, so that it can update the environment variables if needed ### (ex. if the user changes them) if [[ -f "${IRONFOX_BUILD}/tmp/gecko/toolkit/content/neterror/supportpages/connection-not-secure.html" ]]; then diff --git a/templates/gecko/ironfox.cfg b/templates/gecko/ironfox.cfg index 75267245..32b7f882 100644 --- a/templates/gecko/ironfox.cfg +++ b/templates/gecko/ironfox.cfg @@ -197,6 +197,19 @@ lockPref("notification.prompt.testing", false); // [DEFAULT] Notifications defaultPref("browser.ironfox.services.settings.allowedCollections", "blocklists/addons,blocklists/addons-bloomfilters,blocklists/gfx,blocklists/plugins,main/addons-data-leak-blocker-domains,main/anti-tracking-url-decoration,main/bounce-tracking-protection-exceptions,main/cookie-banner-rules-list,main/fingerprinting-protection-overrides,main/hijack-blocklists,main/ml-inference-options,main/ml-inference-request-options,main/ml-model-allow-deny-list,main/ml-onnx-runtime,main/partitioning-exempt-urls,main/password-recipes,main/public-suffix-list,main/query-stripping,main/remote-permissions,main/third-party-cookie-blocking-exempt-urls,main/tracking-protection-lists,main/translations-identification-models,main/translations-models,main/translations-models-v2,main/translations-wasm,main/translations-wasm-v2,main/url-classifier-exceptions,main/url-classifier-skip-urls,main/url-parser-default-unknown-schemes-interventions,main/webcompat-interventions,security-state/cert-revocations,security-state/ct-logs,security-state/intermediates,security-state/onecrl"); defaultPref("browser.ironfox.services.settings.allowedCollectionsFromDump", "main/ironfox-fingerprinting-protection-overrides-harden,main/ironfox-fingerprinting-protection-overrides-unbreak,main/ironfox-fingerprinting-protection-overrides-unbreak-timezone,main/ironfox-fingerprinting-protection-overrides-unbreak-webgl,blocklists/addons,blocklists/addons-bloomfilters,blocklists/gfx,blocklists/plugins,main/addons-data-leak-blocker-domains,main/anti-tracking-url-decoration,main/bounce-tracking-protection-exceptions,main/cookie-banner-rules-list,main/fingerprinting-protection-overrides,main/hijack-blocklists,main/moz-essential-domain-fallbacks,main/ml-inference-options,main/ml-inference-request-options,main/ml-model-allow-deny-list,main/ml-onnx-runtime,main/partitioning-exempt-urls,main/password-recipes,main/public-suffix-list,main/query-stripping,main/remote-permissions,main/third-party-cookie-blocking-exempt-urls,main/tracking-protection-lists,main/translations-identification-models,main/translations-models,main/translations-models-v2,main/translations-wasm,main/translations-wasm-v2,main/url-classifier-exceptions,main/url-classifier-skip-urls,main/url-parser-default-unknown-schemes-interventions,main/webcompat-interventions,security-state/cert-revocations,security-state/ct-logs,security-state/intermediates,security-state/onecrl"); +// Safe Browsing +/// Mozilla used to define these values at `all.js`, but seem to have unfortunately stopped doing so +/// Instead, for Android, these are usually set by GeckoView's `ContentBlocking.java` +/// We don't want to set them with that mechanism though, as it prevents users from being able to override those +/// prefs - so we need to set them here +defaultPref("browser.safebrowsing.provider.google.advisoryURL", "https://developers.google.com/safe-browsing/v4/advisory"); +defaultPref("browser.safebrowsing.provider.google.pver", "2.2"); +defaultPref("browser.safebrowsing.provider.google4.advisoryURL", "https://developers.google.com/safe-browsing/v4/advisory"); +defaultPref("browser.safebrowsing.provider.google4.lists", "goog-badbinurl-proto,goog-downloadwhite-proto,goog-phish-proto,googpub-phish-proto,goog-malware-proto,goog-unwanted-proto,goog-harmful-proto"); +defaultPref("browser.safebrowsing.provider.google4.pver", "4"); +defaultPref("browser.safebrowsing.provider.google5.advisoryURL", "https://developers.google.com/safe-browsing/v4/advisory"); +defaultPref("browser.safebrowsing.provider.google5.lists", "goog-badbinurl-proto,goog-downloadwhite-proto,goog-phish-proto,googpub-phish-proto,goog-malware-proto,goog-unwanted-proto,goog-harmful-proto"); + // Set the default log level for GeckoSettingsBridge defaultPref("browser.ironfox.geckoSettingsBridge.loglevel", "warn");