From 4b3f6f7f43f17f669b667f849794940cece2a5be Mon Sep 17 00:00:00 2001 From: Narcis Beleuzu Date: Tue, 17 Oct 2023 07:01:25 +0300 Subject: [PATCH] Backed out changeset 5a4a0b5fd195 (bug 1777492) for crashtest failure on data:text/html . CLOSED TREE --- .eslintignore | 1 + .prettierignore | 1 + mobile/android/app/geckoview-prefs.js | 439 +++---------------------- mobile/android/app/mobile.js | 299 +++++++++++++++++ mobile/android/app/moz.build | 4 + modules/libpref/docs/index.md | 2 +- modules/libpref/init/all.js | 2 +- taskcluster/ci/source-test/mozlint.yml | 1 + tools/esmify/mach_commands.py | 1 + tools/lint/rejected-words.yml | 2 +- 10 files changed, 355 insertions(+), 397 deletions(-) create mode 100644 mobile/android/app/mobile.js diff --git a/.eslintignore b/.eslintignore index 742d63ee85bb..72c9cc975fad 100644 --- a/.eslintignore +++ b/.eslintignore @@ -176,6 +176,7 @@ js/src/fuzz-tests/ mobile/android/docs/geckoview/assets/js/search-data.json # Uses `#filter substitution` +mobile/android/app/mobile.js mobile/android/app/geckoview-prefs.js # Not much JS to lint and non-standard at that diff --git a/.prettierignore b/.prettierignore index 39d3005013f2..16092242e36b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1151,6 +1151,7 @@ js/src/fuzz-tests/ mobile/android/docs/geckoview/assets/js/search-data.json # Uses `#filter substitution` +mobile/android/app/mobile.js mobile/android/app/geckoview-prefs.js # Not much JS to lint and non-standard at that diff --git a/mobile/android/app/geckoview-prefs.js b/mobile/android/app/geckoview-prefs.js index 05ee66348f02..429fa08b921e 100644 --- a/mobile/android/app/geckoview-prefs.js +++ b/mobile/android/app/geckoview-prefs.js @@ -4,433 +4,84 @@ // 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/. */ -// Non-static prefs that are specific to GeckoView belong in this file. +// Non-static prefs that are specific to GeckoView belong in this file (unless +// there is a compelling and documented reason for them to belong in another +// file). Note that non-static prefs that are shared by GeckoView and Firefox +// for Android are in mobile.js, which this file includes. // // Please indent all prefs defined within #ifdef/#ifndef conditions. This // improves readability, particular for conditional blocks that exceed a single // screen. -// Caret browsing is disabled on mobile (bug 476009) -pref("accessibility.browsewithcaret_shortcut.enabled", false); +#include mobile.js -pref("accessibility.typeaheadfind", false); -pref("accessibility.typeaheadfind.flashBar", 1); -pref("accessibility.typeaheadfind.linksonly", false); -pref("accessibility.typeaheadfind.timeout", 5000); - -pref("app.support.baseURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/"); - -#ifdef MOZ_UPDATER - pref("app.update.channel", "@MOZ_UPDATE_CHANNEL@"); -#endif - -// Prefs used by UpdateTimerManager (including blocklist pings) (bug 783909) -pref("app.update.timerFirstInterval", 30000); // milliseconds -pref("app.update.timerMinimumDelay", 30); // seconds - -// Use a breakout angle of 45° (bug 1226655) -pref("apz.axis_lock.breakout_angle", "0.7853982"); - -// Use "strict" axis locking (bug 1226655) -pref("apz.axis_lock.mode", 1); - -// APZ content response timeout (bug 1247280) -pref("apz.content_response_timeout", 600); - -// Disable scrollbar dragging on Android (bug 1339831) -pref("apz.drag.enabled", false); - -// Tweak fling curving to make medium-length flings go a bit faster (bug 1243854) -pref("apz.fling_curve_function_x1", "0.59"); -pref("apz.fling_curve_function_x2", "0.05"); -pref("apz.fling_curve_function_y1", "0.46"); -pref("apz.fling_curve_function_y2", "1.00"); - -// :gordonb from UX said this value makes fling curving -// feel a lot better (bug 1095727) -pref("apz.fling_curve_threshold_inches_per_ms", "0.01"); - -// Adjust fling physics based on UX feedback (bug 1229839) -pref("apz.fling_friction", "0.004"); - -// Use Android OverScroller class for fling animation (bug 1229462) -pref("apz.fling_stopped_threshold", "0.0"); - -// :gordonb from UX said this value makes fling curving -// feel a lot better (bug 1095727) -pref("apz.max_velocity_inches_per_ms", "0.07"); - -// Enable overscroll on Android (bug 1230674) -pref("apz.overscroll.enabled", true); - -// Don't allow a faraway second tap to start a one-touch pinch gesture (bug 1391770) -pref("apz.second_tap_tolerance", "0.3"); - -// This value originates from bug 1174532 -pref("apz.touch_move_tolerance", "0.03"); - -// Lower the touch-start tolerance threshold to reduce scroll lag with APZ (bug 1230077) -pref("apz.touch_start_tolerance", "0.06"); - -// The breakpad report server to link to in about:crashes -pref("breakpad.reportURL", "https://crash-stats.mozilla.org/report/index/"); - -// Prevent tooltips from showing up (bug 623063) -pref("browser.chrome.toolbar_tips", false); - -// True if you always want dump() to work -// -// On Android, you also need to do the following for the output -// to show up in logcat: -// -// $ adb shell stop -// $ adb shell setprop log.redirect-stdio true -// $ adb shell start -pref("browser.dom.window.dump.enabled", true); - -// Default to ~/Downloads (bug 437954) -pref("browser.download.folderList", 1); - -// Use Android DownloadManager for scanning downloads (bug 816318) -pref("browser.download.manager.addToRecentDocs", true); - -// Load PDF files inline with PDF.js (bug 1754499) -pref("browser.download.open_pdf_attachments_inline", true); - -pref("browser.download.useDownloadDir", true); - -// When enabled, Services.uriFixup.isDomainKnown('localhost') will return true -pref("browser.fixup.domainwhitelist.localhost", true); - -// Open in tab preferences -pref("browser.link.open_newwindow", 3); - -// Supported values: -// - 0: Force all new windows to tabs -// - 1: Don't force -// - 2: Only force those with no features set -pref("browser.link.open_newwindow.restriction", 0); - -// Don't allow meta-refresh when backgrounded (bug 518805) -pref("browser.meta_refresh_when_inactive.disabled", true); - -// The download protection UI is not implemented yet (bug 1239094). -pref("browser.safebrowsing.downloads.enabled", false); - -pref("browser.safebrowsing.features.cryptomining.update", true); -pref("browser.safebrowsing.features.fingerprinting.update", true); -pref("browser.safebrowsing.features.malware.update", true); -pref("browser.safebrowsing.features.phishing.update", true); -pref("browser.safebrowsing.features.trackingAnnotation.update", true); -pref("browser.safebrowsing.features.trackingProtection.update", true); - -// Disable search suggestions by default (bug 784104) -pref("browser.search.suggest.enabled", false); - -// Disable search engine updating (bug 431842) -pref("browser.search.update", false); - -// Session history -pref("browser.sessionhistory.contentViewerTimeout", 360); -pref("browser.sessionhistory.max_entries", 50); - -// Session store -pref("browser.sessionstore.interval", 10000); // milliseconds -pref("browser.sessionstore.max_resumed_crashes", 2); -pref("browser.sessionstore.max_tabs_undo", 10); -// Supported values: -// - 0: all -// - 1: unencrypted sites -// - 2: never -pref("browser.sessionstore.privacy_level", 0); -pref("browser.sessionstore.resume_from_crash", true); +pref("privacy.trackingprotection.pbmode.enabled", false); pref("browser.tabs.remote.autostart", true); - -// Bug 1809922 to enable translations -#ifdef NIGHTLY_BUILD - pref("browser.translations.enable", true); -#endif - -// SSL error page behaviour (bug 437372) -pref("browser.xul.error_pages.expert_bad_cert", false); - -// Enable sparse localization by setting a few package locale overrides (bug 792077) -pref("chrome.override_package.global", "browser"); -pref("chrome.override_package.mozapps", "browser"); -pref("chrome.override_package.passwordmgr", "browser"); - -// Allow Console API to log messages on stdout (bug 1480544) -pref("devtools.console.stdout.chrome", true); - -// Absolute path to the devtools unix domain socket file used -// to communicate with a usb cable via adb forward. -pref("devtools.debugger.unix-domain-socket", "@ANDROID_PACKAGE_NAME@/firefox-debugger-socket"); - -// Enable capture attribute for file input (bug 1553603) -pref("dom.capture.enabled", true); - -// Block popups by default (bug 436057) -pref("dom.disable_open_during_load", true); - -// Don't allow JS to move and resize existing windows (bug 456081) -pref("dom.disable_window_move_resize", true); - -// Disable opening windows with the dialog feature (bug 725502) -pref("dom.disable_window_open_dialog_feature", true); - -// "graceful" process termination is misinterpreted as a process crash. -// To avoid this issue, we set dom.ipc.keepProcessesAlive.extension to 1. -// This stops Gecko from terminating the extension process. This also reduces -// the overhead of resuming a suspended (background) extension page. - -// Note that this only covers "graceful" termination by Gecko. -// Android-triggered force-kills and OOM are not prevented and should still -// be accounted for. See bug 1847608 for more info +pref("dom.ipc.keepProcessesAlive.web", 1); pref("dom.ipc.keepProcessesAlive.extension", 1); -// Keep empty content process alive on Android (bug 1447393) -pref("dom.ipc.keepProcessesAlive.web", 1); - -// This value is derived from the calculation: -// MOZ_ANDROID_CONTENT_SERVICE_COUNT - dom.ipc.processCount -// (dom.ipc.processCount is set in GeckoRuntimeSettings.java) (bug 1619655) -pref("dom.ipc.processCount.webCOOP+COEP", 38); - -// Disable the preallocated process on Android pref("dom.ipc.processPrelaunch.enabled", false); -// Increase script timeouts (bug 485610) -pref("dom.max_script_run_time", 20); - -// Enable meta-viewport support for font inflation code (bug 1106255) -pref("dom.meta-viewport.enabled", true); - -// The maximum number of recent message IDs to store for each push -// subscription, to avoid duplicates for unacknowledged messages (bug 1207743) -pref("dom.push.maxRecentMessageIDsPerSubscription", 0); - -// Allow service workers to open windows for a longer period after a notification -// click on mobile. This is to account for some devices being quite slow (bug 1409761) -pref("dom.serviceWorkers.disable_open_click_delay", 5000); - -// Enable WebShare support (bug 1402369) -pref("dom.webshare.enabled", true); - -// The abuse report feature needs some UI that we do not have on mobile -pref("extensions.abuseReport.amWebAPI.enabled", false); - -// Disable add-ons that are not installed by the user in all scopes by default (See the SCOPE -// constants in AddonManager.jsm for values to use here, and Bug 1405528 for a rationale) -pref("extensions.autoDisableScopes", 15); - -pref("extensions.enabledScopes", 5); - -// If true, unprivileged extensions may use experimental APIs -pref("extensions.experiments.enabled", false); - -// Support credit cards in GV autocomplete API (bug 1691819) -pref("extensions.formautofill.addresses.capture.enabled", true); - -pref("extensions.getAddons.browseAddons", "https://addons.mozilla.org/%LOCALE%/android/collections/4757633/mob/?page=1&collection_sort=-popularity"); -pref("extensions.getAddons.cache.enabled", true); -pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/api/v4/addons/search/?guid=%IDS%&lang=%LOCALE%"); -pref("extensions.getAddons.langpacks.url", "https://services.addons.mozilla.org/api/v4/addons/language-tools/?app=android&type=language&appversion=%VERSION%"); -pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/android/search?q=%TERMS%&platform=%OS%&appver=%VERSION%"); - -// Don't let XPIProvider install distribution add-ons; we do our own thing on mobile -pref("extensions.installDistroAddons", false); - -// Require language packs to be signed (bug 1454141) -pref("extensions.langpacks.signatures.required", true); - -// Enables some extra Extension System Logging (can reduce performance) -pref("extensions.logging.enabled", false); - -// Whether MV3 restrictions for actions popup urls should be extended to MV2 extensions -// (only allowing same extension urls to be used as action popup urls) -pref("extensions.manifestV2.actionsPopupURLRestricted", true); - -// Disables strict compatibility, making addons compatible-by-default -pref("extensions.strictCompatibility", false); - -// Allow system add-on updates (bug 1260213) -pref("extensions.systemAddon.update.enabled", true) -pref("extensions.systemAddon.update.url", "https://aus5.mozilla.org/update/3/SystemAddons/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml"); - -pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%"); -pref("extensions.update.enabled", true); -pref("extensions.update.interval", 86400); -pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%"); - -// Enable prompts for browser.permissions.request() (bug 1392176) -pref("extensions.webextOptionalPermissionPrompts", true); - -// Scroll and zoom into editable form fields (bug 834613) -pref("formhelper.autozoom", true); - -// Optionally send web console output to logcat (bug 1415318) pref("geckoview.console.enabled", false); -// Turn off debug logging for official builds of GeckoView -// to prevent privacy-sensitive data like visited URLS from -// being saved in logs #ifdef RELEASE_OR_BETA pref("geckoview.logging", "Warn"); #else pref("geckoview.logging", "Debug"); #endif -pref("image.cache.size", 1048576); // bytes +// Enable WebShare support. +pref("dom.webshare.enabled", true); + +// Enable capture attribute for file input. +pref("dom.capture.enabled", true); // Inherit locale from the OS, used for multi-locale builds pref("intl.locale.requested", ""); -pref("keyword.enabled", true); +// Enable Safe Browsing blocklist updates +pref("browser.safebrowsing.features.phishing.update", true); +pref("browser.safebrowsing.features.malware.update", true); -// Always tilt the caret to match the text selection guideline (bug 1097398) -pref("layout.accessiblecaret.always_tilt", true); +// Enable Tracking Protection blocklist updates +pref("browser.safebrowsing.features.trackingAnnotation.update", true); +pref("browser.safebrowsing.features.trackingProtection.update", true); -// Show the caret when long tapping on empty content (bug 1246064) -pref("layout.accessiblecaret.caret_shown_when_long_tapping_on_empty_content", true); +// Enable cryptomining protection blocklist updates +pref("browser.safebrowsing.features.cryptomining.update", true); +// Enable fingerprinting protection blocklist updates +pref("browser.safebrowsing.features.fingerprinting.update", true); -// Initial text selection on long-press is enhanced to provide -// a smarter phone-number selection for direct-dial ActionBar action (bug 1235508) -pref("layout.accessiblecaret.extend_selection_for_phone_number", true); - -// Provide haptic feedback on longPress selection events (bug 1230613) -pref("layout.accessiblecaret.hapticfeedback", true); - -// AccessibleCaret css for Android L style assets (bug 1097398) -pref("layout.accessiblecaret.height", "22.0"); -pref("layout.accessiblecaret.margin-left", "-11.5"); -pref("layout.accessiblecaret.width", "22.0"); - -// Update any visible carets for selection changes due to JS calls, -// but don't show carets if carets are hidden (bug 1463576) -pref("layout.accessiblecaret.script_change_update_mode", 1); - -// Disable CSS error reporting by default to improve performance (bug 831123) -pref("layout.css.report_errors", false); - -pref("layout.spellcheckDefault", 0); - -// Enable EME permission prompts (bug 1620102) -pref("media.eme.require-app-approval", true); - -// Enable autoplay permission prompts (bug 1577596) +// Enable autoplay permission prompts pref("media.geckoview.autoplay.request", true); -// Disable future downloads of OpenH264 on Android (bug 1548679) -pref("media.gmp-gmpopenh264.autoupdate", false); - -// Make OpenH264 visible by default on mobile (bug 1532578) -pref("media.gmp-gmpopenh264.enabled", true); -pref("media.gmp-gmpopenh264.visible", true); - -// Enable GMP support in the addon manager (bug 1089867) -pref("media.gmp-provider.enabled", true); - -// Enable Widevine MediaKeySystem (bug 1306219) -pref("media.mediadrm-widevinecdm.visible", true); - -// Ask for permission when enumerating WebRTC devices (bug 1369108) -pref("media.navigator.permission.device", true); - -// On mobile we throttle the download once the readahead_limit is hit -// if we're using a cellular connection, even if the download is slow, -// this is to preserve battery and data (bug 1540573) -pref("media.throttle-cellular-regardless-of-download-rate", true); - -// Number of video frames we buffer while decoding video. -// On Android this is decided by a similar value which varies for -// each OMX decoder |OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountMin|. This -// number must be less than the OMX equivalent or gecko will think it is -// chronically starved of video frames. All decoders seen so far have a value -// of at least 4. (bug 973408) -pref("media.video-queue.default-size", 3); - -// The maximum number of queued frames to send to the compositor. -// On Android, it needs to be throttled because SurfaceTexture contains only one -// (the most recent) image data. (bug 1299068) -pref("media.video-queue.send-to-compositor-size", 1); - -// Increase necko buffer sizes for Android (bug 560591) -pref("network.buffer.cache.size", 16384); - -// CookieBehavior setting for private browsing (bug 1695050) -pref("network.cookie.cookieBehavior.pbmode", 4); - -// Set HPACK receive buffer size appropriately for Android (bug 1296280) -pref("network.http.http2.default-hpack-buffer", 4096); - -// HTTP/2 Server Push (bug 790388) -pref("network.http.http2.push-allowance", 32768); - -// Reduce HTTP Idle connection timeout on Android to improve battery life (bug 1007959) -pref("network.http.keep-alive.timeout", 109); - -// Update connection limits; especially for proxies (bug 648603) -pref("network.http.max-persistent-connections-per-proxy", 20); - -// Disable warning for mailto and tel protocols (bug 589403) -pref("network.protocol-handler.warn-external.mailto", false); -pref("network.protocol-handler.warn-external.tel", false); - -// Disable warning for sms protocol (bug 819554) -pref("network.protocol-handler.warn-external.sms", false); - -// Do not warn when opening YouTube (bug 630364) -pref("network.protocol-handler.warn-external.vnd.youtube", false); - -// Transmit UDP busy-work to the LAN when anticipating low latency -// network reads and on wifi to mitigate 802.11 Power Save Polling delays -// (bug 888268) -pref("network.tickle-wifi.enabled", true); - -// Editing PDFs is not supported on mobile -pref("pdfjs.annotationEditorMode", -1); - -// Enable the floating PDF.js toolbar on GeckoView (bug 1829366) -pref("pdfjs.enableFloatingToolbar", true); - -// Try to convert PDFs sent as octet-stream (bug 1754499) -pref("pdfjs.handleOctetStream", true); - -// Disable tracking protection in PBM for GeckoView (bug 1436887) -pref("privacy.trackingprotection.pbmode.enabled", false); - -// Relay integration is not supported on mobile -pref("signon.firefoxRelay.feature", "not available"); +// Enable EME permission prompts +pref("media.eme.require-app-approval", true); pref("signon.showAutoCompleteFooter", true); - -// Delegate autocomplete to GeckoView (bug 1618058) pref("toolkit.autocomplete.delegate", true); -// Locked because any other value would break GeckoView -pref("toolkit.defaultChromeURI", "chrome://geckoview/content/geckoview.xhtml", locked); - -// Whether to use unified telemetry behavior; requires a restart to take effect -pref("toolkit.telemetry.unified", false); - -// Show/Hide scrollbars when active/inactive (bug 1223928) -pref("ui.scrollbarFadeBeginDelay", 450); -pref("ui.scrollbarFadeDuration", 0); -pref("ui.useOverlayScrollbars", 1); - -// Download protection lists are not available on Android (bug 1397938, bug 1394017) -pref("urlclassifier.downloadAllowTable", ""); -pref("urlclassifier.downloadBlockTable", ""); - -// The Potentially Harmful Apps list replaces the malware one on Android (bug 1394017) -pref("urlclassifier.malwareTable", "goog-harmful-proto,goog-unwanted-proto,moztest-harmful-simple,moztest-malware-simple,moztest-unwanted-simple"); - -// Android doesn't support the new sync storage yet (bug 1625257) +// Android doesn't support the new sync storage yet, we will have our own in +// Bug 1625257. pref("webextensions.storage.sync.kinto", true); -// Require extensions to be signed (bug 1244329) -pref("xpinstall.signatures.required", true); +// This value is derived from the calculation: +// MOZ_ANDROID_CONTENT_SERVICE_COUNT - dom.ipc.processCount +// (dom.ipc.processCount is set in GeckoRuntimeSettings.java) +pref("dom.ipc.processCount.webCOOP+COEP", 38); -pref("xpinstall.whitelist.add", "https://addons.mozilla.org"); -pref("xpinstall.whitelist.fileRequest", false); +// Form autofill prefs. +pref("extensions.formautofill.addresses.capture.enabled", true); + +// PDF.js (enabled in StaticPrefList.yaml) +// Try to convert PDFs sent as octet-stream +pref("pdfjs.handleOctetStream", true); +pref("browser.download.open_pdf_attachments_inline", true); +pref("pdfjs.annotationEditorMode", -1); +pref("pdfjs.enableFloatingToolbar", true); + +// Bug 1809922 to enable translations +#ifdef NIGHTLY_BUILD + pref("browser.translations.enable", true); +#endif \ No newline at end of file diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js new file mode 100644 index 000000000000..c200f510e1f3 --- /dev/null +++ b/mobile/android/app/mobile.js @@ -0,0 +1,299 @@ +#filter dumbComments emptyLines substitution + +// 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/. + +// Non-static prefs that are specific to Firefox on Android belong in this file +// (unless there is a compelling and documented reason for them to belong in +// another file). +// +// Please indent all prefs defined within #ifdef/#ifndef conditions. This +// improves readability, particular for conditional blocks that exceed a single +// screen. + +pref("toolkit.defaultChromeURI", "chrome://geckoview/content/geckoview.xhtml", locked); + +// Show/Hide scrollbars when active/inactive +pref("ui.useOverlayScrollbars", 1); +pref("ui.scrollbarFadeBeginDelay", 450); +pref("ui.scrollbarFadeDuration", 0); + +/* image cache prefs */ +pref("image.cache.size", 1048576); // bytes + +/* disable some protocol warnings */ +pref("network.protocol-handler.warn-external.tel", false); +pref("network.protocol-handler.warn-external.sms", false); +pref("network.protocol-handler.warn-external.mailto", false); +pref("network.protocol-handler.warn-external.vnd.youtube", false); + +/* http prefs */ +pref("network.http.keep-alive.timeout", 109); +pref("network.http.max-persistent-connections-per-proxy", 20); + +// spdy +pref("network.http.http2.push-allowance", 32768); +pref("network.http.http2.default-hpack-buffer", 4096); // 4k + +// See bug 545869 for details on why these are set the way they are +pref("network.buffer.cache.size", 16384); + +// CookieBehavior setting for the private browsing. +pref("network.cookie.cookieBehavior.pbmode", 4); + +/* session history */ +pref("browser.sessionhistory.max_entries", 50); +pref("browser.sessionhistory.contentViewerTimeout", 360); + +/* session store */ +pref("browser.sessionstore.resume_from_crash", true); +pref("browser.sessionstore.interval", 10000); // milliseconds +pref("browser.sessionstore.max_tabs_undo", 10); +pref("browser.sessionstore.max_resumed_crashes", 2); +pref("browser.sessionstore.privacy_level", 0); // saving data: 0 = all, 1 = unencrypted sites, 2 = never + +// Download protection lists are not available on Fennec. +pref("urlclassifier.downloadAllowTable", ""); +pref("urlclassifier.downloadBlockTable", ""); + +/* these should help performance */ +pref("layout.css.report_errors", false); + +/* download manager (don't show the window or alert) */ +pref("browser.download.useDownloadDir", true); +pref("browser.download.folderList", 1); // Default to ~/Downloads +pref("browser.download.manager.addToRecentDocs", true); + +/* password manager */ +pref("signon.firefoxRelay.feature", "not available"); + +/* form helper (scroll to and optionally zoom into editable fields) */ +pref("formhelper.autozoom", true); + +/* spellcheck */ +pref("layout.spellcheckDefault", 0); + +/* extension manager and xpinstall */ +pref("xpinstall.whitelist.fileRequest", false); +pref("xpinstall.whitelist.add", "https://addons.mozilla.org"); + +pref("extensions.langpacks.signatures.required", true); +pref("xpinstall.signatures.required", true); + +// Whether MV3 restrictions for actions popup urls should be extended to MV2 extensions +// (only allowing same extension urls to be used as action popup urls). +pref("extensions.manifestV2.actionsPopupURLRestricted", true); + +// Disable add-ons that are not installed by the user in all scopes by default (See the SCOPE +// constants in AddonManager.jsm for values to use here, and Bug 1405528 for a rationale). +pref("extensions.autoDisableScopes", 15); + +pref("extensions.enabledScopes", 5); +pref("extensions.update.enabled", true); +pref("extensions.update.interval", 86400); +pref("extensions.logging.enabled", false); +pref("extensions.strictCompatibility", false); + +pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%"); +pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%¤tAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%"); + +/* preferences for the Get Add-ons pane */ +pref("extensions.getAddons.cache.enabled", true); +pref("extensions.getAddons.search.browseURL", "https://addons.mozilla.org/%LOCALE%/android/search?q=%TERMS%&platform=%OS%&appver=%VERSION%"); +pref("extensions.getAddons.browseAddons", "https://addons.mozilla.org/%LOCALE%/android/collections/4757633/mob/?page=1&collection_sort=-popularity"); +pref("extensions.getAddons.get.url", "https://services.addons.mozilla.org/api/v4/addons/search/?guid=%IDS%&lang=%LOCALE%"); +pref("extensions.getAddons.langpacks.url", "https://services.addons.mozilla.org/api/v4/addons/language-tools/?app=android&type=language&appversion=%VERSION%"); + +/* Don't let XPIProvider install distribution add-ons; we do our own thing on mobile. */ +pref("extensions.installDistroAddons", false); + +pref("extensions.webextOptionalPermissionPrompts", true); + +pref("extensions.experiments.enabled", false); + +/* The abuse report feature needs some UI that we do not have on mobile. */ +pref("extensions.abuseReport.amWebAPI.enabled", false); + +/* block popups by default, and notify the user about blocked popups */ +pref("dom.disable_open_during_load", true); + +/* disable opening windows with the dialog feature */ +pref("dom.disable_window_open_dialog_feature", true); + +pref("keyword.enabled", true); +pref("browser.fixup.domainwhitelist.localhost", true); + +pref("accessibility.typeaheadfind", false); +pref("accessibility.typeaheadfind.timeout", 5000); +pref("accessibility.typeaheadfind.flashBar", 1); +pref("accessibility.typeaheadfind.linksonly", false); +pref("accessibility.browsewithcaret_shortcut.enabled", false); + +// SSL error page behaviour +pref("browser.xul.error_pages.expert_bad_cert", false); + +// disable updating +pref("browser.search.update", false); + +// disable search suggestions by default +pref("browser.search.suggest.enabled", false); + +// Enable sparse localization by setting a few package locale overrides +pref("chrome.override_package.global", "browser"); +pref("chrome.override_package.mozapps", "browser"); +pref("chrome.override_package.passwordmgr", "browser"); + +// don't allow JS to move and resize existing windows +pref("dom.disable_window_move_resize", true); + +// open in tab preferences +pref("browser.link.open_newwindow", 3); +// 0=force all new windows to tabs, 1=don't force, 2=only force those with no features set +pref("browser.link.open_newwindow.restriction", 0); + +// content sink control -- controls responsiveness during page load +// see https://bugzilla.mozilla.org/show_bug.cgi?id=481566#c9 +//pref("content.sink.enable_perf_mode", 2); // 0 - switch, 1 - interactive, 2 - perf +//pref("content.sink.pending_event_mode", 0); +//pref("content.sink.perf_deflect_count", 1000000); +//pref("content.sink.perf_parse_time", 50000000); + +pref("dom.max_script_run_time", 20); + +// Absolute path to the devtools unix domain socket file used +// to communicate with a usb cable via adb forward. +pref("devtools.debugger.unix-domain-socket", "@ANDROID_PACKAGE_NAME@/firefox-debugger-socket"); + +// product URLs +// The breakpad report server to link to in about:crashes +pref("breakpad.reportURL", "https://crash-stats.mozilla.org/report/index/"); + +pref("app.support.baseURL", "https://support.mozilla.org/1/mobile/%VERSION%/%OS%/%LOCALE%/"); + +/* prefs used by the update timer system (including blocklist pings) */ +pref("app.update.timerFirstInterval", 30000); // milliseconds +pref("app.update.timerMinimumDelay", 30); // seconds + +#ifdef MOZ_UPDATER + /* prefs used specifically for updating the app */ + pref("app.update.channel", "@MOZ_UPDATE_CHANNEL@"); +#endif + +// APZ physics settings (fling acceleration, fling curving and axis lock) have +// been reviewed by UX +pref("apz.axis_lock.breakout_angle", "0.7853982"); // PI / 4 (45 degrees) +pref("apz.axis_lock.mode", 1); // Use "strict" axis locking +pref("apz.content_response_timeout", 600); +pref("apz.drag.enabled", false); +pref("apz.fling_curve_function_x1", "0.59"); +pref("apz.fling_curve_function_y1", "0.46"); +pref("apz.fling_curve_function_x2", "0.05"); +pref("apz.fling_curve_function_y2", "1.00"); +pref("apz.fling_curve_threshold_inches_per_ms", "0.01"); +// apz.fling_friction and apz.fling_stopped_threshold are currently ignored by Fennec. +pref("apz.fling_friction", "0.004"); +pref("apz.fling_stopped_threshold", "0.0"); +pref("apz.max_velocity_inches_per_ms", "0.07"); +pref("apz.overscroll.enabled", true); +pref("apz.second_tap_tolerance", "0.3"); +pref("apz.touch_move_tolerance", "0.03"); +pref("apz.touch_start_tolerance", "0.06"); + +// prevent tooltips from showing up +pref("browser.chrome.toolbar_tips", false); + +// don't allow meta-refresh when backgrounded +pref("browser.meta_refresh_when_inactive.disabled", true); + +// On mobile we throttle the download once the readahead_limit is hit +// if we're using a cellular connection, even if the download is slow. +// This is to preserve battery and data. +pref("media.throttle-cellular-regardless-of-download-rate", true); + +// Number of video frames we buffer while decoding video. +// On Android this is decided by a similar value which varies for +// each OMX decoder |OMX_PARAM_PORTDEFINITIONTYPE::nBufferCountMin|. This +// number must be less than the OMX equivalent or gecko will think it is +// chronically starved of video frames. All decoders seen so far have a value +// of at least 4. +pref("media.video-queue.default-size", 3); +// The maximum number of queued frames to send to the compositor. +// On Android, it needs to be throttled because SurfaceTexture contains only one +// (the most recent) image data. +pref("media.video-queue.send-to-compositor-size", 1); + +pref("media.mediadrm-widevinecdm.visible", true); + +// OpenH264 is visible in about:plugins, and enabled, by default. +pref("media.gmp-gmpopenh264.visible", true); +pref("media.gmp-gmpopenh264.enabled", true); + +// Disable future downloads of OpenH264 on Android +pref("media.gmp-gmpopenh264.autoupdate", false); + +// The download protection UI is not implemented yet (bug 1239094). +pref("browser.safebrowsing.downloads.enabled", false); + +// The Potentially Harmful Apps list replaces the malware one on Android. +pref("urlclassifier.malwareTable", "goog-harmful-proto,goog-unwanted-proto,moztest-harmful-simple,moztest-malware-simple,moztest-unwanted-simple"); + +// True if you always want dump() to work +// +// On Android, you also need to do the following for the output +// to show up in logcat: +// +// $ adb shell stop +// $ adb shell setprop log.redirect-stdio true +// $ adb shell start +pref("browser.dom.window.dump.enabled", true); +pref("devtools.console.stdout.chrome", true); + +// Transmit UDP busy-work to the LAN when anticipating low latency +// network reads and on wifi to mitigate 802.11 Power Save Polling delays +pref("network.tickle-wifi.enabled", true); + +// Enable meta-viewport support for font inflation code +pref("dom.meta-viewport.enabled", true); + +// Enable GMP support in the addon manager. +pref("media.gmp-provider.enabled", true); + +// Telemetry settings. +// Whether to use the unified telemetry behavior, requires a restart. +pref("toolkit.telemetry.unified", false); + +// AccessibleCaret CSS for the Android L style assets. +pref("layout.accessiblecaret.width", "22.0"); +pref("layout.accessiblecaret.height", "22.0"); +pref("layout.accessiblecaret.margin-left", "-11.5"); + +// Android needs to show the caret when long tapping on an empty content. +pref("layout.accessiblecaret.caret_shown_when_long_tapping_on_empty_content", true); + +// Androids carets are always tilt to match the text selection guideline. +pref("layout.accessiblecaret.always_tilt", true); + +// Update any visible carets for selection changes due to JS calls, +// but don't show carets if carets are hidden. +pref("layout.accessiblecaret.script_change_update_mode", 1); + +// Optionally provide haptic feedback on longPress selection events. +pref("layout.accessiblecaret.hapticfeedback", true); + +// Initial text selection on long-press is enhanced to provide +// a smarter phone-number selection for direct-dial ActionBar action. +pref("layout.accessiblecaret.extend_selection_for_phone_number", true); + +// Allow service workers to open windows for a longer period after a notification +// click on mobile. This is to account for some devices being quite slow. +pref("dom.serviceWorkers.disable_open_click_delay", 5000); + +pref("dom.push.maxRecentMessageIDsPerSubscription", 0); + +// Ask for permission when enumerating WebRTC devices. +pref("media.navigator.permission.device", true); + +// Allow system add-on updates +pref("extensions.systemAddon.update.url", "https://aus5.mozilla.org/update/3/SystemAddons/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/update.xml"); +pref("extensions.systemAddon.update.enabled", true); diff --git a/mobile/android/app/moz.build b/mobile/android/app/moz.build index 868aed564ae0..21fa8617c5ff 100644 --- a/mobile/android/app/moz.build +++ b/mobile/android/app/moz.build @@ -16,6 +16,10 @@ for var in ("MOZ_UPDATER", "MOZ_APP_UA_NAME", "ANDROID_PACKAGE_NAME", "CPU_ARCH" if CONFIG["MOZ_PKG_SPECIAL"]: DEFINES["MOZ_PKG_SPECIAL"] = CONFIG["MOZ_PKG_SPECIAL"] +JS_PREFERENCE_PP_FILES += [ + "mobile.js", +] + if not CONFIG["MOZ_ANDROID_FAT_AAR_ARCHITECTURES"]: # Equivalent to JS_PREFERENCE_PP_FILES[CONFIG['ANDROID_CPU_ARCH']], # which isn't supported out of the box. diff --git a/modules/libpref/docs/index.md b/modules/libpref/docs/index.md index 30bf66d278fa..389cf1b68701 100644 --- a/modules/libpref/docs/index.md +++ b/modules/libpref/docs/index.md @@ -184,7 +184,7 @@ include: - `modules/libpref/init/all.js`, used by all products; - `browser/app/profile/firefox.js`, used by Firefox desktop; -- `mobile/android/app/geckoview-prefs.js`, used by GeckoView; +- `mobile/android/app/mobile.js`, used by Firefox mobile; - `mail/app/profile/all-thunderbird.js`, used by Thunderbird (in comm-central); - `suite/browser/browser-prefs.js`, used by SeaMonkey (in comm-central). diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 45172c54170b..0a36ca2e2a3e 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -6,7 +6,7 @@ // The prefs in this file are shipped with the GRE and should apply to all // embedding situations. Application-specific preferences belong somewhere // else, such as browser/app/profile/firefox.js or -// mobile/android/app/geckoview-prefs.js. +// mobile/android/app/mobile.js. // // NOTE: Not all prefs should be defined in this (or any other) data file. // Static prefs are defined in StaticPrefList.yaml. Those prefs should *not* diff --git a/taskcluster/ci/source-test/mozlint.yml b/taskcluster/ci/source-test/mozlint.yml index 0685d854e137..05ff986ceaa8 100644 --- a/taskcluster/ci/source-test/mozlint.yml +++ b/taskcluster/ci/source-test/mozlint.yml @@ -213,6 +213,7 @@ lintpref: - 'modules/libpref/init/all.js' - 'modules/libpref/init/StaticPrefList.yaml' - 'browser/app/profile/firefox.js' + - 'mobile/android/app/mobile.js' - 'devtools/client/preferences/debugger.js' - 'mobile/android/app/geckoview-prefs.js' - 'browser/branding/official/pref/firefox-branding.js' diff --git a/tools/esmify/mach_commands.py b/tools/esmify/mach_commands.py index 9ecfc8c737e4..8d6a5e628a45 100644 --- a/tools/esmify/mach_commands.py +++ b/tools/esmify/mach_commands.py @@ -123,6 +123,7 @@ excluded_from_imports_prefix = list( "browser/components/enterprisepolicies/schemas/schema.sys.mjs", "browser/locales/en-US/firefox-l10n.js", "mobile/android/app/geckoview-prefs.js", + "mobile/android/app/mobile.js", "mobile/android/locales/en-US/mobile-l10n.js", "modules/libpref/greprefs.js", "modules/libpref/init/all.js", diff --git a/tools/lint/rejected-words.yml b/tools/lint/rejected-words.yml index c9a5196c7585..43afad76ae04 100644 --- a/tools/lint/rejected-words.yml +++ b/tools/lint/rejected-words.yml @@ -156,7 +156,7 @@ avoid-blacklist-and-whitelist: - layout/tools/reftest/reftestcommandline.py - layout/tools/reftest/runreftest.py - layout/tools/reftest/selftest/conftest.py - - mobile/android/app/geckoview-prefs.js + - mobile/android/app/mobile.js - mobile/android/geckoview/src/main/java/org/mozilla/gecko/util/HardwareCodecCapabilityUtils.java - mobile/android/geckoview/src/main/java/org/mozilla/geckoview/ContentBlocking.java - mobile/android/geckoview/src/main/java/org/mozilla/geckoview/CrashReporter.java