From c95028688332902bbc03b89d01ab75163e17274e Mon Sep 17 00:00:00 2001 From: Alexander Frick Date: Wed, 4 Sep 2024 04:10:08 -0500 Subject: [PATCH] 129.0.2 rebase --- app/nsBrowserApp.cpp | 3 + app/profile/firefox.js | 285 +++++--- .../customizableui/CustomizableUI.sys.mjs | 65 +- browser/confvars.sh | 32 - browser/installer/package-manifest.in | 10 +- .../installer/windows/nsis/uninstaller.nsi | 7 +- browser/moz.configure | 36 + build/moz.configure/lto-pgo.configure | 35 +- build/moz.configure/toolchain.configure | 628 +++++++++++++++--- moz.build | 2 + mozconfigs/context.py | 34 +- mozconfigs/mozconfig | 6 + mozconfigs/mozconfig-arm64 | 5 + mozconfigs/mozconfig-avx2 | 6 + mozconfigs/mozconfig-debug | 12 +- mozconfigs/mozconfig-macos-arm64 | 9 +- mozconfigs/mozconfig-macos-arm64-cross | 9 +- mozconfigs/mozconfig-macos-x64 | 2 + mozconfigs/mozconfig-macos-x64-cross | 2 + mozconfigs/mozconfig-sse3 | 6 + mozconfigs/mozconfig-sse4 | 6 + mozconfigs/mozconfig-win | 4 +- mozconfigs/mozconfig-win-avx2 | 4 +- mozconfigs/mozconfig-win-avx2-cross | 3 + mozconfigs/mozconfig-win-cross | 3 + mozconfigs/mozconfig-win-debug | 9 +- mozconfigs/mozconfig-win-sse3 | 4 +- mozconfigs/mozconfig-win-sse4 | 4 +- netwerk/protocol/http/nsHttpHandler.cpp | 197 ++++-- policies/policies.json | 2 +- toolkit/moz.configure | 363 ++++++++-- trunk.sh => version.sh | 2 +- 32 files changed, 1417 insertions(+), 378 deletions(-) rename trunk.sh => version.sh (95%) diff --git a/app/nsBrowserApp.cpp b/app/nsBrowserApp.cpp index 5ff2332..94a69c2 100644 --- a/app/nsBrowserApp.cpp +++ b/app/nsBrowserApp.cpp @@ -192,6 +192,9 @@ static int do_main(int argc, char* argv[], char* envp[]) { #ifdef LIBFUZZER shellData.fuzzerDriver = fuzzer::FuzzerDriver; #endif +#ifdef AFLFUZZ + shellData.fuzzerDriver = afl_interface_raw; +#endif return gBootstrap->XRE_XPCShellMain(--argc, argv, envp, &shellData); } diff --git a/app/profile/firefox.js b/app/profile/firefox.js index e8edb94..9fd6670 100644 --- a/app/profile/firefox.js +++ b/app/profile/firefox.js @@ -23,8 +23,6 @@ pref("browser.hiddenWindowChromeURL", "chrome://browser/content/hiddenWindowMac. // Set add-ons abuse report related prefs specific to Firefox Desktop. pref("extensions.abuseReport.enabled", true); -pref("extensions.abuseReport.amWebAPI.enabled", true); -pref("extensions.abuseReport.amoFormEnabled", true); // Enables some extra Extension System Logging (can reduce performance) pref("extensions.logging.enabled", false); @@ -152,6 +150,8 @@ pref("toolkit.telemetry.enabled", false); pref("browser.ping-centre.telemetry", false); pref("browser.attribution.enabled", false); pref("toolkit.telemetry.pioneer-new-studies-available", false); +// Enables search SERP telemetry (impressions, engagements and abandonment) +pref("browser.search.serpEventTelemetry.enabled", false); // Disable Auto Update pref("app.update.auto", false); // Allow WebAudio to play automatically. @@ -165,6 +165,8 @@ pref("browser.newtabpage.activity-stream.section.highlights.includePocket", fals pref("browser.newtabpage.activity-stream.feeds.system.topstories", false); pref("browser.newtabpage.activity-stream.feeds.section.highlights", false); pref("browser.newtabpage.activity-stream.feeds.snippets", true); +// Disable Firefox View +pref("browser.tabs.firefox-view", false); // Enable AutoScrolling and Smooth Scroll by default pref("general.autoScroll", true); pref("general.smoothScroll", true); @@ -368,6 +370,9 @@ pref("browser.shell.defaultBrowserCheckCount", 0); // Attempt to set the default browser on Windows 10 using the UserChoice registry keys, // before falling back to launching the modern Settings dialog. pref("browser.shell.setDefaultBrowserUserChoice", true); +// When setting default via UserChoice, temporarily rename an ancestor registry key to +// prevent kernel drivers from locking the UserChoice subkeys. +pref("browser.shell.setDefaultBrowserUserChoice.regRename", false); // When setting the default browser on Windows 10 using the UserChoice // registry keys, also try to set Firefox as the default PDF handler. pref("browser.shell.setDefaultPDFHandler", false); @@ -382,6 +387,9 @@ pref("browser.shell.checkDefaultPDF", true); // Will be set to `true` if the user indicates that they don't want to be asked // again about Firefox being their default PDF handler any more. pref("browser.shell.checkDefaultPDF.silencedByUser", false); +// Whether or not the user should be shown the guidance notifications when +// setting Firefox as their default browser. +pref("browser.shell.setDefaultGuidanceNotifications", true); #endif @@ -413,7 +421,7 @@ pref("browser.startup.couldRestoreSession.count", 0); pref("browser.startup.preXulSkeletonUI", true); // Whether the checkbox to enable Windows launch on login is shown -pref("browser.startup.windowsLaunchOnLogin.enabled", false); +pref("browser.startup.windowsLaunchOnLogin.enabled", true); // Whether to show the launch on login infobar notification pref("browser.startup.windowsLaunchOnLogin.disableLaunchOnLoginPrompt", false); #endif @@ -509,18 +517,12 @@ pref("browser.urlbar.suggest.engines", true); pref("browser.urlbar.suggest.calculator", false); pref("browser.urlbar.suggest.recentsearches", true); -#if defined(EARLY_BETA_OR_EARLIER) - // Enable QuickActions and its urlbar search mode button. - pref("browser.urlbar.quickactions.enabled", true); - pref("browser.urlbar.suggest.quickactions", true); - pref("browser.urlbar.shortcuts.quickactions", true); - pref("browser.urlbar.quickactions.showPrefs", true); -#endif +pref("browser.urlbar.scotchBonnet.enableOverride", false); -#if defined(EARLY_BETA_OR_EARLIER) - // Enable Trending suggestions. - pref("browser.urlbar.trending.featureGate", true); -#endif +// Enable trending suggestions and recent searches. +pref("browser.urlbar.trending.featureGate", true); +pref("browser.urlbar.trending.requireSearchMode", false); +pref("browser.urlbar.recentsearches.featureGate", true); // Enable Rich Entities. pref("browser.urlbar.richSuggestions.featureGate", true); @@ -592,9 +594,11 @@ pref("browser.urlbar.quicksuggest.shouldShowOnboardingDialog", true); // Show QuickSuggest onboarding dialog on the nth browser restarts. pref("browser.urlbar.quicksuggest.showOnboardingDialogAfterNRestarts", 0); -// The indexes of the sponsored and non-sponsored quick suggest results within -// the general results group. -pref("browser.urlbar.quicksuggest.sponsoredIndex", -1); +// The index of sponsored Firefox Suggest results within the Firefox Suggest +// section when "Show search suggestions ahead of browsing history in address bar +// results" is checked. When not checked, the index is hardcoded as -1. Negative +// indexes are relative to the end of the section. +pref("browser.urlbar.quicksuggest.sponsoredIndex", 0); pref("browser.urlbar.quicksuggest.nonSponsoredIndex", -1); // Whether quick suggest results can be shown in position specified in the @@ -628,8 +632,10 @@ pref("browser.urlbar.trimURLs", false); #ifdef NIGHTLY_BUILD pref("browser.urlbar.trimHttps", false); +pref("browser.urlbar.untrimOnUserInteraction.featureGate", true); #else pref("browser.urlbar.trimHttps", false); +pref("browser.urlbar.untrimOnUserInteraction.featureGate", false); #endif // If changed to true, copying the entire URL from the location bar will put the @@ -669,12 +675,6 @@ pref("browser.urlbar.showSearchTerms.featureGate", false); // a default search engine results page. pref("browser.urlbar.showSearchTerms.enabled", true); -// Controls the empty search behavior in Search Mode: -// 0 - Show nothing -// 1 - Show search history -// 2 - Show search and browsing history -pref("browser.urlbar.update2.emptySearchBehavior", 0); - // Whether the urlbar displays one-offs to filter searches to history, // bookmarks, or tabs. pref("browser.urlbar.shortcuts.bookmarks", true); @@ -714,7 +714,7 @@ pref("browser.urlbar.merino.providers", ""); pref("browser.urlbar.merino.clientVariants", ""); // Enable site specific search result. -pref("browser.urlbar.contextualSearch.enabled", false); +pref("browser.urlbar.contextualSearch.enabled", true); // Feature gate pref for addon suggestions in the urlbar. pref("browser.urlbar.addons.featureGate", true); @@ -728,19 +728,15 @@ pref("browser.urlbar.suggest.addons", true); pref("browser.urlbar.suggest.mdn", true); // Feature gate pref for Yelp suggestions in the urlbar. -pref("browser.urlbar.yelp.featureGate", false); +pref("browser.urlbar.yelp.featureGate", true); // The minimum prefix length of a Yelp keyword the user must type to trigger the // suggestion. 0 means the min length should be taken from Nimbus. -pref("browser.urlbar.yelp.minKeywordLength", 0); +pref("browser.urlbar.yelp.minKeywordLength", 4); // Whether Yelp suggestions should be shown as top picks. pref("browser.urlbar.yelp.priority", false); -// The group-relative suggestedIndex of Yelp suggestions within the Firefox -// Suggest section. Ignored when Yelp suggestions are shown as top picks. -pref("browser.urlbar.yelp.suggestedIndex", 0); - // If `browser.urlbar.yelp.featureGate` is true, this controls whether // Yelp suggestions are turned on. pref("browser.urlbar.suggest.yelp", false); @@ -832,9 +828,6 @@ pref("browser.search.separatePrivateDefault.ui.enabled", false); // The maximum amount of times the private default banner is shown. pref("browser.search.separatePrivateDefault.ui.banner.max", 0); -// Enables search SERP telemetry (impressions, engagements and abandonment) -pref("browser.search.serpEventTelemetry.enabled", false); - // Enables search SERP telemetry page categorization. #ifdef NIGHTLY_BUILD pref("browser.search.serpEventTelemetryCategorization.enabled", false); @@ -842,7 +835,12 @@ pref("browser.search.serpEventTelemetryCategorization.enabled", false); pref("browser.search.serpEventTelemetryCategorization.enabled", false); #endif -// Search Bar removal from the toolbar for users who haven't used it in 120 +// A count of Glean SERP categorization event metrics that have been recorded +// but not yet submitted in a ping. Needed to prevent sending a ping with only +// experiment info (and not actual SERP categorizations) at startup. +pref("browser.search.serpMetricsRecordedCounter", 0); + +// Search Bar removal from the toolbar for users who haven’t used it in 120 // days pref("browser.search.widget.removeAfterDaysUnused", 120); @@ -904,6 +902,9 @@ pref("browser.shopping.experience2023.sidebarClosedCount", 0); // When conditions are met, shows a prompt on the shopping sidebar asking users if they want to disable auto-open behavior pref("browser.shopping.experience2023.showKeepSidebarClosedMessage", true); +// Spin the cursor while the page is loading +pref("browser.spin_cursor_while_busy", false); + // Enable display of megalist option in browser sidebar // Keep it hidden from about:config for now. // pref("browser.megalist.enabled", false); @@ -914,14 +915,14 @@ pref("browser.privatebrowsing.vpnpromourl", "https://vpn.mozilla.org/?utm_source // Whether the user has opted-in to recommended settings for data features. pref("browser.dataFeatureRecommendations.enabled", false); -// Temporary pref to control whether or not Private Browsing windows show up -// as separate icons in the Windows taskbar. -pref("browser.privateWindowSeparation.enabled", true); - // Use dark theme variant for PBM windows. This is only supported if the theme // sets darkTheme data. pref("browser.theme.dark-private-windows", true); +// Pref to control whether or not Private Browsing windows show up +// as separate icons in the Windows taskbar. +pref("browser.privateWindowSeparation.enabled", true); + // Controls visibility of the privacy segmentation preferences section. pref("browser.privacySegmentation.preferences.show", false); @@ -1038,14 +1039,14 @@ pref("browser.tabs.tooltipsShowPidAndActiveness", true); pref("browser.tabs.tooltipsShowPidAndActiveness", false); #endif -pref("browser.tabs.cardPreview.enabled", true); -pref("browser.tabs.cardPreview.showThumbnails", true); +#ifdef NIGHTLY_BUILD +pref("browser.tabs.hoverPreview.enabled", true); +#else +pref("browser.tabs.hoverPreview.enabled", false); +#endif +pref("browser.tabs.hoverPreview.showThumbnails", true); -pref("browser.tabs.firefox-view", false); -pref("browser.tabs.firefox-view-next", false); -pref("browser.tabs.firefox-view-newIcon", false); pref("browser.tabs.firefox-view.logLevel", "Warn"); -pref("browser.tabs.firefox-view.notify-for-tabs", false); // allow_eval_* is enabled on Firefox Desktop only at this // point in time @@ -1132,6 +1133,8 @@ pref("browser.bookmarks.openInTabClosesMenu", true); // the bookmarks toolbar as a default. pref("browser.bookmarks.defaultLocation", "toolbar"); +pref("browser.tabs.allow_transparent_browser", true); + // Scripts & Windows prefs pref("dom.disable_open_during_load", true); @@ -1191,12 +1194,12 @@ pref("privacy.history.custom", false); // 6 - Last 24 hours pref("privacy.sanitize.timeSpan", 1); -pref("privacy.sanitize.useOldClearHistoryDialog", true); +pref("privacy.sanitize.useOldClearHistoryDialog", false); -pref("privacy.sanitize.clearOnShutdown.hasMigratedToNewPrefs", false); +pref("privacy.sanitize.clearOnShutdown.hasMigratedToNewPrefs2", false); // flag to track migration of clear history dialog prefs, where cpd stands for // clear private data -pref("privacy.sanitize.cpd.hasMigratedToNewPrefs", false); +pref("privacy.sanitize.cpd.hasMigratedToNewPrefs2", false); pref("privacy.panicButton.enabled", true); @@ -1269,7 +1272,7 @@ pref("browser.history_swipe_animation.disabled", false); // who want to keep using this feature, let's enable it with alt+wheel. This // is better for consistency with macOS users. pref("mousewheel.with_shift.action", 4); - pref("mousewheel.with_control.action",3); + pref("mousewheel.with_control.action",3); // Zoom pref("mousewheel.with_alt.action", 2); pref("mousewheel.with_meta.action", 1); // win key on Win, Super/Hyper on Linux #endif @@ -1367,6 +1370,24 @@ pref("browser.sessionstore.interval.idle", 3600000); // 1h // collect/save the session quite as often. pref("browser.sessionstore.idleDelay", 180); // 3 minutes +// Fine-grained default logging levels for each log appender +pref("browser.sessionstore.log.appender.console", "Fatal"); +pref("browser.sessionstore.log.appender.dump", "Error"); +pref("browser.sessionstore.log.appender.file.level", "Trace"); +pref("browser.sessionstore.log.appender.file.logOnError", true); + +// The default log level for all Session restore logs. +pref("browser.sessionstore.loglevel", "Warn"); + +#ifdef EARLY_BETA_OR_EARLIER + pref("browser.sessionstore.loglevel", "Debug"); + pref("browser.sessionstore.log.appender.file.logOnSuccess", true); +#else + pref("browser.sessionstore.log.appender.file.logOnSuccess", false); +#endif +// How old can a log file be before it gets deleted? +pref("browser.sessionstore.log.appender.file.maxErrorAge", 864000); // 10 days + // on which sites to save text data, POSTDATA and cookies // 0 = everywhere, 1 = unencrypted sites, 2 = nowhere pref("browser.sessionstore.privacy_level", 0); @@ -1399,12 +1420,12 @@ pref("browser.sessionstore.restore_pinned_tabs_on_demand", false); pref("browser.sessionstore.upgradeBackup.latestBuildID", ""); // How many upgrade backups should be kept pref("browser.sessionstore.upgradeBackup.maxUpgradeBackups", 3); -// End-users should not run sessionstore in debug mode +// Toggle some debug behavior; end-users should not run sessionstore in debug mode pref("browser.sessionstore.debug", false); // Forget closed windows/tabs after two weeks pref("browser.sessionstore.cleanup.forget_closed_after", 1209600000); -// Temporary pref that will be removed in a future release, see bug 1836952 +// temporary pref that will be removed in a future release, see bug 1836952 pref("browser.sessionstore.persist_closed_tabs_between_sessions", true); // Don't quit the browser when Ctrl + Q is pressed. @@ -1521,7 +1542,7 @@ pref("browser.bookmarks.editDialog.maxRecentFolders", 7); #if defined(NIGHTLY_BUILD) pref("security.sandbox.content.level", 7); #else - pref("security.sandbox.content.level", 6); + pref("security.sandbox.content.level", 7); #endif // Pref controlling if messages relevant to sandbox violations are logged. @@ -1598,8 +1619,6 @@ pref("browser.bookmarks.editDialog.maxRecentFolders", 7); pref("browser.taskbar.previews.max", 20); pref("browser.taskbar.previews.cachetime", 5); - pref("browser.taskbar.lists.legacyBackend", false); - pref("browser.taskbar.lists.enabled", true); pref("browser.taskbar.lists.frequent.enabled", true); pref("browser.taskbar.lists.recent.enabled", false); @@ -1619,7 +1638,7 @@ pref("services.sync.prefs.sync.accessibility.browsewithcaret", true); pref("services.sync.prefs.sync.accessibility.typeaheadfind", true); pref("services.sync.prefs.sync.accessibility.typeaheadfind.linksonly", true); pref("services.sync.prefs.sync.addons.ignoreUserEnabledChanges", true); -pref("services.sync.prefs.sync.app.shield.optoutstudies.enabled", false); +pref("services.sync.prefs.sync.app.shield.optoutstudies.enabled", true); // The addons prefs related to repository verification are intentionally // not synced for security reasons. If a system is compromised, a user // could weaken the pref locally, install an add-on from an untrusted @@ -1700,7 +1719,6 @@ pref("services.sync.prefs.sync.media.eme.enabled", true); pref("services.sync.prefs.sync-seen.media.eme.enabled", false); pref("services.sync.prefs.sync.media.videocontrols.picture-in-picture.video-toggle.enabled", true); pref("services.sync.prefs.sync.network.cookie.cookieBehavior", true); -pref("services.sync.prefs.sync.network.cookie.thirdparty.sessionOnly", true); pref("services.sync.prefs.sync.permissions.default.image", true); pref("services.sync.prefs.sync.pref.downloads.disable_button.edit_actions", true); pref("services.sync.prefs.sync.pref.privacy.disable_button.cookie_exceptions", true); @@ -1765,6 +1783,9 @@ pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.prop // This is a fallback value for when prompt callers do not specify a modalType. pref("prompts.defaultModalType", 3); +// Whether to use the discrete Top Sites component. +pref("browser.topsites.component.enabled", false); + pref("browser.topsites.useRemoteSetting", true); // Fetch sponsored Top Sites from Mozilla Tiles Service (Contile) pref("browser.topsites.contile.enabled", false); @@ -1781,12 +1802,48 @@ pref("browser.partnerlink.campaign.topsites", "amzn_2020_a1"); // Activates preloading of the new tab url. pref("browser.newtab.preload", true); +// Weather widget for newtab +pref("browser.newtabpage.activity-stream.showWeather", true); +pref("browser.newtabpage.activity-stream.weather.query", ""); +pref("browser.newtabpage.activity-stream.weather.display", "simple"); + +// enable location search for newtab weather widget +#ifdef NIGHTLY_BUILD + pref("browser.newtabpage.activity-stream.weather.locationSearchEnabled", true); +#else + pref("browser.newtabpage.activity-stream.weather.locationSearchEnabled", true); +#endif + +// List of regions that get weather by default. +#ifdef NIGHTLY_BUILD + pref("browser.newtabpage.activity-stream.discoverystream.region-weather-config", "US,CA"); +#else + pref("browser.newtabpage.activity-stream.discoverystream.region-weather-config", ""); +#endif +// List of locales that weather widget supports. +pref("browser.newtabpage.activity-stream.discoverystream.locale-weather-config", "en-US,en-GB,en-CA"); + // Preference to enable wallpaper selection in the Customize Menu of new tab page -pref("browser.newtabpage.activity-stream.newtabWallpapers.enabled", false); +#ifdef NIGHTLY_BUILD + pref("browser.newtabpage.activity-stream.newtabWallpapers.enabled", true); + pref("browser.newtabpage.activity-stream.newtabWallpapers.v2.enabled", true); +#else + pref("browser.newtabpage.activity-stream.newtabWallpapers.v2.enabled", false); + pref("browser.newtabpage.activity-stream.newtabWallpapers.enabled", false); +#endif -// Current new tab page background image. +// Current new tab page background images. pref("browser.newtabpage.activity-stream.newtabWallpapers.wallpaper-light", ""); pref("browser.newtabpage.activity-stream.newtabWallpapers.wallpaper-dark", ""); +pref("browser.newtabpage.activity-stream.newtabWallpapers.wallpaper", ""); + +// Preference to show feature highlight about wallpaper on new tab page +pref("browser.newtabpage.activity-stream.newtabWallpapers.highlightEnabled", false); +pref("browser.newtabpage.activity-stream.newtabWallpapers.highlightDismissed", false); +pref("browser.newtabpage.activity-stream.newtabWallpapers.highlightSeenCounter", 0); +pref("browser.newtabpage.activity-stream.newtabWallpapers.highlightHeaderText", ""); +pref("browser.newtabpage.activity-stream.newtabWallpapers.highlightContentText", ""); +pref("browser.newtabpage.activity-stream.newtabWallpapers.highlightCtaText", ""); pref("browser.newtabpage.activity-stream.newNewtabExperience.colors", "#0090ED,#FF4F5F,#2AC3A2,#FF7139,#A172FF,#FFA437,#FF2A8A"); @@ -1802,8 +1859,9 @@ pref("browser.newtabpage.activity-stream.fxaccounts.endpoint", "https://accounts pref("browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts", true); // ASRouter provider configuration -pref("browser.newtabpage.activity-stream.asrouter.providers.cfr", "{\"id\":\"cfr\",\"enabled\":true,\"type\":\"remote-settings\",\"collection\":\"cfr\",\"updateCycleInMs\":3600000}"); pref("browser.newtabpage.activity-stream.asrouter.providers.message-groups", "{\"id\":\"message-groups\",\"enabled\":true,\"type\":\"remote-settings\",\"collection\":\"message-groups\",\"updateCycleInMs\":3600000}"); +pref("browser.newtabpage.activity-stream.asrouter.providers.onboarding", "{\"id\":\"onboarding\",\"type\":\"local\",\"localProvider\":\"OnboardingMessageProvider\",\"enabled\":true,\"exclude\":[]}"); +pref("browser.newtabpage.activity-stream.asrouter.providers.cfr", "{\"id\":\"cfr\",\"enabled\":true,\"type\":\"remote-settings\",\"collection\":\"cfr\",\"updateCycleInMs\":3600000}"); pref("browser.newtabpage.activity-stream.asrouter.providers.messaging-experiments", "{\"id\":\"messaging-experiments\",\"enabled\":true,\"type\":\"remote-experiments\",\"updateCycleInMs\":3600000}"); // ASRouter user prefs @@ -1840,7 +1898,7 @@ pref("browser.newtabpage.activity-stream.discoverystream.spoc-positions", "1,5,7 pref("browser.newtabpage.activity-stream.discoverystream.spoc-topsites-positions", "2"); // This is a 0-based index, for consistency with the other position CSVs, // but Contile positions are a 1-based index, so we end up adding 1 to these before using them. -pref("browser.newtabpage.activity-stream.discoverystream.contile-topsites-positions", "0,1"); +pref("browser.newtabpage.activity-stream.discoverystream.contile-topsites-positions", "0,1,2"); pref("browser.newtabpage.activity-stream.discoverystream.widget-positions", ""); pref("browser.newtabpage.activity-stream.discoverystream.spocs-endpoint", ""); @@ -1872,11 +1930,21 @@ pref("browser.newtabpage.activity-stream.discoverystream.region-stories-block", pref("browser.newtabpage.activity-stream.discoverystream.region-stories-config", "US,DE,CA,GB,IE,CH,AT,BE,IN,FR,IT,ES"); // List of regions that support the new recommendations BFF, also requires region-stories-config pref("browser.newtabpage.activity-stream.discoverystream.region-bff-config", "US,DE,CA,GB,IE,CH,AT,BE,IN,FR,IT,ES"); +// Using merino for recommendations in nightly only +#ifdef NIGHTLY_BUILD + pref("browser.newtabpage.activity-stream.discoverystream.merino-provider.enabled", false); +#else + pref("browser.newtabpage.activity-stream.discoverystream.merino-provider.enabled", false); +#endif +pref("browser.newtabpage.activity-stream.discoverystream.merino-provider.endpoint", "merino.services.mozilla.com"); // List of regions that get spocs by default. pref("browser.newtabpage.activity-stream.discoverystream.region-spocs-config", "US,CA,DE,GB,FR,IT,ES"); // List of regions that don't get the 7 row layout. pref("browser.newtabpage.activity-stream.discoverystream.region-basic-config", ""); +// Add parameters to Pocket feed URL. +pref("browser.newtabpage.activity-stream.discoverystream.pocket-feed-parameters", ""); + // Allows Pocket story collections to be dismissed. pref("browser.newtabpage.activity-stream.discoverystream.isCollectionDismissible", true); pref("browser.newtabpage.activity-stream.discoverystream.personalization.enabled", false); @@ -1887,10 +1955,17 @@ pref("browser.newtabpage.activity-stream.discoverystream.recs.personalized", fal // System pref to allow Pocket sponsored content personalization to be turned on/off. pref("browser.newtabpage.activity-stream.discoverystream.spocs.personalized", false); +// System pref to enable topic selection for pocket feed +pref("browser.newtabpage.activity-stream.discoverystream.topicSelection.enabled", false); + // Flip this once the user has dismissed the Pocket onboarding experience, pref("browser.newtabpage.activity-stream.discoverystream.onboardingExperience.dismissed", true); pref("browser.newtabpage.activity-stream.discoverystream.onboardingExperience.enabled", false); +// Allow users to give thumbs up/down on recommended stories +pref("browser.newtabpage.activity-stream.discoverystream.thumbsUpDown.enabled", false); +pref("browser.newtabpage.activity-stream.discoverystream.thumbsUpDown.searchTopsitesCompact", false); + // User pref to show stories on newtab (feeds.system.topstories has to be set to true as well) pref("browser.newtabpage.activity-stream.feeds.section.topstories", false); @@ -1948,6 +2023,18 @@ pref("pdfjs.handleOctetStream", true); // Is the sidebar positioned ahead of the content browser pref("sidebar.position_start", true); pref("sidebar.revamp", false); +pref("sidebar.main.tools", "aichat,syncedtabs,history"); +pref("sidebar.verticalTabs", false); +pref("sidebar.visibility", "always-show"); + +pref("browser.ml.chat.enabled", false); +pref("browser.ml.chat.hideLocalhost", true); +pref("browser.ml.chat.prompt.prefix", 'I’m on page "%tabTitle%" with "%selection|12000%" selected. '); +pref("browser.ml.chat.prompts.0", '{"label":"Summarize","value":"Please summarize the selection using precise and concise language. Use headers and bulleted lists in the summary, to make it scannable. Maintain the meaning and factual accuracy.","id":"summarize"}'); +pref("browser.ml.chat.prompts.1", '{"label":"Simplify Language","value":"Please rewrite the selection in plain, clear language suitable for a general audience without specialized knowledge. Use all of the following tactics: simple vocabulary; short sentences; active voice; headers and bulleted lists for scannability. Maintain meaning and factual accuracy.","id":"simplify"}'); +pref("browser.ml.chat.prompts.2", '{"label":"Quiz Me","value":"Please quiz me on this selection. Ask me a variety of types of questions, for example multiple choice, true or false, and short answer. Wait for my response before moving on to the next question.","id":"quiz","targeting":"!provider|regExpMatch(\'gemini\')"}'); +pref("browser.ml.chat.provider", ""); +pref("browser.ml.chat.sidebar", true); pref("security.protectionspopup.recordEventTelemetry", false); pref("security.app_menu.recordEventTelemetry", false); @@ -2028,6 +2115,14 @@ pref("identity.mobilepromo.ios", "https://www.mozilla.org/firefox/ios/?utm_sourc // Default is 24 hours. pref("identity.fxaccounts.commands.missed.fetch_interval", 86400); +// Controls whether this client can send and receive "close tab" +// commands from other FxA clients +pref("identity.fxaccounts.commands.remoteTabManagement.enabled", false); + +// Controls whether or not the client association ping has values set on it +// when the sync-ui-state:update notification fires. +pref("identity.fxaccounts.telemetry.clientAssociationPing.enabled", false); + // Note: when media.gmp-*.visible is true, provided we're running on a // supported platform/OS version, the corresponding CDM appears in the // plugins list, Firefox will download the GMP/CDM if enabled, and our @@ -2075,7 +2170,7 @@ pref("browser.translations.newSettingsUI.enable", false); // Enable Firefox Select translations powered by Bergamot translations // engine https://browser.mt/. -pref("browser.translations.select.enable", false); +pref("browser.translations.select.enable", true); // Telemetry settings. // Determines if Telemetry pings can be archived locally. @@ -2185,8 +2280,15 @@ pref("browser.contentblocking.reject-and-isolate-cookies.preferences.ui.enabled" // "cookieBehaviorPBM3": cookie behaviour BEHAVIOR_LIMIT_FOREIGN // "cookieBehaviorPBM4": cookie behaviour BEHAVIOR_REJECT_TRACKER // "cookieBehaviorPBM5": cookie behaviour BEHAVIOR_REJECT_TRACKER_AND_PARTITION_FOREIGN +// Third-party cookie deprecation behavior: +// "3pcd": Third-party cookie deprecation enabled +// "-3pcd": Third-party cookie deprecation disabled // One value from each section must be included in the browser.contentblocking.features.strict pref. +#ifdef NIGHTLY_BUILD +pref("browser.contentblocking.features.strict", "tp,tpPrivate,cookieBehavior5,cookieBehaviorPBM5,cm,fp,stp,emailTP,emailTPPrivate,lvl2,rp,rpTop,ocsp,qps,qpsPBM,fpp,fppPrivate,3pcd"); +#else pref("browser.contentblocking.features.strict", "tp,tpPrivate,cookieBehavior5,cookieBehaviorPBM5,cm,fp,stp,emailTP,emailTPPrivate,lvl2,rp,rpTop,ocsp,qps,qpsPBM,fpp,fppPrivate"); +#endif // Hide the "Change Block List" link for trackers/tracking content in the custom // Content Blocking/ETP panel. By default, it will not be visible. There is also @@ -2322,6 +2424,9 @@ pref("privacy.exposeContentTitleInWindow.pbm", true); // Run media transport in a separate process? pref("media.peerconnection.mtransport_process", true); +// Whether the "Close duplicate tabs" tab context menu is enabled. +pref("browser.tabs.context.close-duplicate.enabled", true); + // For speculatively warming up tabs to improve perceived // performance while using the async tab switcher. pref("browser.tabs.remote.warmup.enabled", true); @@ -2434,15 +2539,10 @@ pref("extensions.pocket.refresh.emailButton.enabled", false); // Hides the recently saved section in the home panel. pref("extensions.pocket.refresh.hideRecentSaves.enabled", false); -pref("signon.management.page.fileImport.enabled", true); +pref("signon.management.page.fileImport.enabled", true);hether the user enabled the OS re-auth dial -#ifdef NIGHTLY_BUILD -pref("signon.management.page.os-auth.enabled", true); -#else -pref("signon.management.page.os-auth.enabled", false); -#endif -// "not available" - feature is not available (will be removed after enabling on Release). // "available" - user can see feature offer. +// "not available" - feature is not available (will be removed after enabling on Release). // "offered" - we have offered feature to user and they have not yet made a decision. // "enabled" - user opted in to the feature. // "disabled" - user opted out of the feature. @@ -2484,8 +2584,6 @@ pref("browser.crashReports.unsubmittedCheck.autoSubmit2", false); // Preferences for the form autofill toolkit component. // Checkbox in sync options for credit card data sync service pref("services.sync.engine.creditcards.available", true); -// Whether the user enabled the OS re-auth dialog. -pref("extensions.formautofill.reauth.enabled", false); // Whether or not to restore a session with lazy-browser tabs. pref("browser.sessionstore.restore_tabs_lazily", true); @@ -2496,15 +2594,14 @@ pref("browser.suppress_first_window_animation", true); pref("extensions.screenshots.disabled", false); // Preference that determines whether Screenshots uses the dedicated browser component -#ifdef NIGHTLY_BUILD - pref("screenshots.browser.component.enabled", true); -#else - pref("screenshots.browser.component.enabled", false); -#endif +pref("screenshots.browser.component.enabled", true); // Preference that determines what button to focus pref("screenshots.browser.component.last-saved-method", "download"); +// Preference that prevents events from reaching the content page. +pref("screenshots.browser.component.preventContentEvents", true); + // DoH Rollout: whether to clear the mode value at shutdown. pref("doh-rollout.clearModeOnShutdown", false); @@ -2595,7 +2692,7 @@ pref("identity.fxaccounts.toolbar.defaultVisible", false); // Prefs to control Firefox Account panels that shows call to actions // for other supported Mozilla products -pref("identity.fxaccounts.toolbar.pxiToolbarEnabled", false); +pref("identity.fxaccounts.toolbar.pxiToolbarEnabled", true); pref("identity.fxaccounts.toolbar.pxiToolbarEnabled.monitorEnabled", false); pref("identity.fxaccounts.toolbar.pxiToolbarEnabled.relayEnabled", false); pref("identity.fxaccounts.toolbar.pxiToolbarEnabled.vpnEnabled", false); @@ -2688,6 +2785,8 @@ pref("devtools.inspector.simple-highlighters-reduced-motion", false); // Wheter or not Enter on inplace editor in the Rules view moves focus and activates // next inplace editor. pref("devtools.inspector.rule-view.focusNextOnEnter", true); +// Display @starting-style rules in the Rules view. +pref("devtools.inspector.rule-view.starting-style", true); // Whether or not the box model panel is opened in the layout view pref("devtools.layout.boxmodel.opened", true); @@ -2969,6 +3068,9 @@ pref("devtools.debugger.hide-ignored-sources", false); // about:devtools-toolbox tabs unusable by mistake. pref("devtools.popup.disable_autohide", false); +// Add support for high contrast mode +pref("devtools.high-contrast-mode-support", false); + // FirstStartup service time-out in ms pref("first-startup.timeout", 30000); @@ -3027,10 +3129,8 @@ pref("browser.firefox-view.feature-tour", "{\"screen\":\"FIREFOX_VIEW_SPOTLIGHT\ pref("browser.firefox-view.view-count", 0); // Maximum number of rows to show on the "History" page. pref("browser.firefox-view.max-history-rows", 300); -// Enables search functionality in Firefox View. -pref("browser.firefox-view.search.enabled", false); // Enables virtual list functionality in Firefox View. -pref("browser.firefox-view.virtual-list.enabled", false); +pref("browser.firefox-view.virtual-list.enabled", true); // If the user has seen the pdf.js feature tour this value reflects the tour // message id, the id of the last screen they saw, and whether they completed the tour @@ -3085,6 +3185,7 @@ pref("cookiebanners.ui.desktop.cfrVariant", 0); #ifdef NIGHTLY_BUILD pref("dom.security.credentialmanagement.identity.enabled", true); + pref("dom.security.credentialmanagement.identity.heavyweight.enabled", true); #endif pref("ui.new-webcompat-reporter.enabled", true); @@ -3113,18 +3214,40 @@ pref("browser.privatebrowsing.resetPBM.showConfirmationDialog", true); // the preferences related to the Nimbus experiment, to activate and deactivate // the the entire rollout (see: bug 1864216 - two prompts, 1877500 - set two in one prompt) pref("browser.mailto.dualPrompt", false); -// When visiting a site which uses registerProtocolHandler: Ask the user to set Firefox as -// default mailto handler. -pref("browser.mailto.prompt.os", true); +// Display a reminder prompt for known webmailers if the prompt was not +// dismissed before the next visit of that webmailer. +pref("browser.mailto.dualPrompt.onLocationChange", false); +// configures after how many minutes is the prompt shown again after it was +// dismissed. This differs from clicking the 'x' button and 'not now' (forever=0) +pref("browser.mailto.dualPrompt.dismissNotNowMinutes", 525600); // one year +pref("browser.mailto.dualPrompt.dismissXClickMinutes", 1440); // one day // Pref to initialize the BackupService soon after startup. pref("browser.backup.enabled", true); +// Pref to control whether scheduled backups run or not. +pref("browser.backup.scheduled.enabled", false); +// Pref to control the visibility of the backup section in about:preferences +pref("browser.backup.preferences.ui.enabled", false); +// The number of SQLite database pages to backup per step. +pref("browser.backup.sqlite.pages_per_step", 50); +// The delay between SQLite database backup steps in milliseconds. +pref("browser.backup.sqlite.step_delay_ms", 50); +pref("browser.backup.scheduled.idle-threshold-seconds", 300); +pref("browser.backup.scheduled.minimum-time-between-backups-seconds", 3600); // Pref to enable the new profiles pref("browser.profiles.enabled", false); pref("startup.homepage_override_url_nimbus", ""); +// These prefs are referring to the Fx update version pref("startup.homepage_override_nimbus_maxVersion", ""); +pref("startup.homepage_override_nimbus_minVersion", ""); +// Pref to disable all What's New pages +pref("startup.homepage_override_nimbus_disable_wnp", false); // Pref to enable the content relevancy feature. pref("toolkit.contentRelevancy.enabled", false); +// Pref to enable the ingestion through the Rust component. +pref("toolkit.contentRelevancy.ingestEnabled", false); +// Pref to enable extra logging for the content relevancy feature +pref("toolkit.contentRelevancy.log", false); diff --git a/browser/components/customizableui/CustomizableUI.sys.mjs b/browser/components/customizableui/CustomizableUI.sys.mjs index 6ad76e6..fd6be17 100644 --- a/browser/components/customizableui/CustomizableUI.sys.mjs +++ b/browser/components/customizableui/CustomizableUI.sys.mjs @@ -252,6 +252,7 @@ var CustomizableUIInternal = { "developer-button", "unified-extensions-button", "fxa-toolbar-menu-button", + lazy.resetPBMToolbarButtonEnabled ? "reset-pbm-toolbar-button" : null, ].filter(name => name); this.registerArea( @@ -368,6 +369,14 @@ var CustomizableUIInternal = { shouldSetPref = shouldAdd; } else if (widget._introducedInVersion > currentVersion) { shouldAdd = true; + } else if ( + widget._introducedByPref && + Services.prefs.getBoolPref(widget._introducedByPref) + ) { + shouldSetPref = shouldAdd = !Services.prefs.getBoolPref( + prefId, + false + ); } if (shouldAdd) { @@ -747,7 +756,7 @@ var CustomizableUIInternal = { !widget || widget.source !== CustomizableUI.SOURCE_BUILTIN || !widget.defaultArea || - !widget._introducedInVersion || + !(widget._introducedInVersion || widget._introducedByPref) || savedPlacements.includes(widget.id) ) { continue; @@ -1138,6 +1147,10 @@ var CustomizableUIInternal = { continue; } + if (!inPrivateWindow && widget?.hideInNonPrivateBrowsing) { + continue; + } + this.ensureButtonContextMenu(node, aAreaNode); // This needs updating in case we're resetting / undoing a reset. @@ -1370,6 +1383,8 @@ var CustomizableUIInternal = { let showInPrivateBrowsing = gPalette.has(aWidgetId) ? gPalette.get(aWidgetId).showInPrivateBrowsing : true; + let hideInNonPrivateBrowsing = + gPalette.get(aWidgetId)?.hideInNonPrivateBrowsing ?? false; for (let areaNode of areaNodes) { let window = areaNode.ownerGlobal; @@ -1380,6 +1395,13 @@ var CustomizableUIInternal = { continue; } + if ( + hideInNonPrivateBrowsing && + !lazy.PrivateBrowsingUtils.isWindowPrivate(window) + ) { + continue; + } + let container = this.getCustomizationTarget(areaNode); let widgetNode = window.document.getElementById(aWidgetId); if (widgetNode && isOverflowable) { @@ -1557,6 +1579,8 @@ var CustomizableUIInternal = { let showInPrivateBrowsing = gPalette.has(aWidgetId) ? gPalette.get(aWidgetId).showInPrivateBrowsing : true; + let hideInNonPrivateBrowsing = + gPalette.get(aWidgetId)?.hideInNonPrivateBrowsing ?? false; if ( !showInPrivateBrowsing && @@ -1565,6 +1589,13 @@ var CustomizableUIInternal = { return; } + if ( + hideInNonPrivateBrowsing && + !lazy.PrivateBrowsingUtils.isWindowPrivate(window) + ) { + return; + } + let [, widgetNode] = this.getWidgetNode(aWidgetId, window); if (!widgetNode) { lazy.log.error("Widget '" + aWidgetId + "' not found, unable to move"); @@ -1826,6 +1857,12 @@ var CustomizableUIInternal = { ) { return null; } + if ( + aWidget.hideInNonPrivateBrowsing && + !lazy.PrivateBrowsingUtils.isWindowPrivate(aDocument.defaultView) + ) { + return null; + } lazy.log.debug("Building " + aWidget.id + " of type " + aWidget.type); @@ -2324,7 +2361,10 @@ var CustomizableUIInternal = { // gPalette. for (let [id, widget] of gPalette) { if (!widget.currentArea) { - if (widget.showInPrivateBrowsing || !isWindowPrivate) { + if ( + (isWindowPrivate && widget.showInPrivateBrowsing) || + (!isWindowPrivate && !widget.hideInNonPrivateBrowsing) + ) { widgets.add(id); } } @@ -2951,7 +2991,9 @@ var CustomizableUIInternal = { tooltiptext: null, l10nId: null, showInPrivateBrowsing: true, + hideInNonPrivateBrowsing: false, _introducedInVersion: -1, + _introducedByPref: null, keepBroadcastAttributesWhenCustomizing: false, disallowSubView: false, webExtension: false, @@ -2992,6 +3034,7 @@ var CustomizableUIInternal = { const kOptBoolProps = [ "removable", "showInPrivateBrowsing", + "hideInNonPrivateBrowsing", "overflows", "tabSpecific", "locationSpecific", @@ -3034,6 +3077,10 @@ var CustomizableUIInternal = { if (aSource == CustomizableUI.SOURCE_BUILTIN) { widget._introducedInVersion = aData.introducedInVersion || 0; + + if (aData._introducedByPref) { + widget._introducedByPref = aData._introducedByPref; + } } this.wrapWidgetEventHandler("onBeforeCreated", widget); @@ -3522,7 +3569,12 @@ var CustomizableUIInternal = { // that are present. This avoids including items that don't exist (e.g. ids // of add-on items that the user has uninstalled). let orderedPlacements = CustomizableUI.getWidgetIdsInArea(container.id); - return orderedPlacements.filter(w => currentWidgets.has(w)); + return orderedPlacements.filter(w => { + return ( + currentWidgets.has(w) || + this.getWidgetProvider(w) == CustomizableUI.PROVIDER_API + ); + }); }, get inDefaultState() { @@ -4164,6 +4216,8 @@ export var CustomizableUI = { * as the "$shortcut" variable to the fluent message. * - showInPrivateBrowsing: whether to show the widget in private browsing * mode (optional, default: true) + * - hideInNonPrivateBrowsing: whether to hide the widget in non private + * browsing mode windows (optional, default: false) * - tabSpecific: If true, closes the panel if the tab changes. * - locationSpecific: If true, closes the panel if the location changes. * This is similar to tabSpecific, but also if the location @@ -4218,6 +4272,8 @@ export var CustomizableUI = { * - tooltiptext: for API-provided widgets, the tooltip of the widget; * - showInPrivateBrowsing: for API-provided widgets, whether the widget is * visible in private browsing; + * - hideInNonPrivateBrowsing: for API-provided widgets, whether the widget is + * hidden in non-private browsing; * * Single window wrappers obtained through forWindow(someWindow) or from the * instances array have the following properties @@ -4772,7 +4828,7 @@ export var CustomizableUI = { let item = menuChild; if (!item.hasAttribute("onclick")) { subviewItem.addEventListener("click", event => { - let newEvent = new doc.defaultView.MouseEvent(event.type, event); + let newEvent = new doc.ownerGlobal.PointerEvent("click", event); // Telemetry should only pay attention to the original event. lazy.BrowserUsageTelemetry.ignoreEvent(newEvent); @@ -4919,6 +4975,7 @@ function WidgetGroupWrapper(aWidget) { "label", "tooltiptext", "showInPrivateBrowsing", + "hideInNonPrivateBrowsing", "viewId", "disallowSubView", "webExtension", diff --git a/browser/confvars.sh b/browser/confvars.sh index 127376f..09ac2c3 100755 --- a/browser/confvars.sh +++ b/browser/confvars.sh @@ -3,32 +3,6 @@ # 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/. -MOZ_APP_VENDOR=Alex313031 - -MOZ_UPDATER=0 - -if test "$OS_ARCH" = "WINNT"; then - if ! test "$HAVE_64BIT_BUILD"; then - if test "$MOZ_UPDATE_CHANNEL" = "nightly" -o \ - "$MOZ_UPDATE_CHANNEL" = "nightly-try" -o \ - "$MOZ_UPDATE_CHANNEL" = "aurora" -o \ - "$MOZ_UPDATE_CHANNEL" = "beta" -o \ - "$MOZ_UPDATE_CHANNEL" = "release"; then - if ! test "$MOZ_DEBUG"; then - if ! test "$USE_STUB_INSTALLER"; then - # Expect USE_STUB_INSTALLER from taskcluster for downstream task consistency - echo "ERROR: STUB installer expected to be enabled but" - echo "ERROR: USE_STUB_INSTALLER is not specified in the environment" - exit 1 - fi - MOZ_STUB_INSTALLER=1 - fi - fi - fi -fi - -BROWSER_CHROME_URL=chrome://browser/content/browser.xhtml - # MOZ_APP_DISPLAYNAME will be set by branding/configure.sh # MOZ_BRANDING_DIRECTORY is the default branding directory used when none is # specified. It should never point to the "official" branding directory. @@ -37,9 +11,3 @@ BROWSER_CHROME_URL=chrome://browser/content/browser.xhtml # For the mozilla-aurora repository, use "aurora". MOZ_BRANDING_DIRECTORY=browser/branding/mercury MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/official -MOZ_APP_ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384} - -MOZ_PROFILE_MIGRATOR=1 - -# Include the DevTools client, not just the server (which is the default) -MOZ_DEVTOOLS=all diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index b16533c..26e75cc 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -209,8 +209,6 @@ @RESPATH@/browser/chrome.manifest @RESPATH@/browser/chrome/browser@JAREXT@ @RESPATH@/browser/chrome/browser.manifest -@RESPATH@/chrome/pdfjs.manifest -@RESPATH@/chrome/pdfjs/* @RESPATH@/chrome/toolkit@JAREXT@ @RESPATH@/chrome/toolkit.manifest #ifdef MOZ_GTK @@ -231,6 +229,11 @@ @RESPATH@/browser/chrome/devtools.manifest @RESPATH@/browser/@PREF_DIR@/debugger.js +; PdfJs +@RESPATH@/chrome/pdfjs.manifest +@RESPATH@/chrome/pdfjs/* +@RESPATH@/defaults/pref/PdfJsDefaultPrefs.js + ; shell icons #ifdef XP_UNIX #ifndef XP_MACOSX @@ -392,9 +395,6 @@ bin/libfreebl_64int_3.so @BINPATH@/@DLL_PREFIX@mozwer@DLL_SUFFIX@ #endif #endif -#ifdef MOZ_CRASHREPORTER_INJECTOR -@BINPATH@/breakpadinjector.dll -#endif #endif ; [ minidump-analyzer ] diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi index c37ba1a..a423ba5 100644 --- a/browser/installer/windows/nsis/uninstaller.nsi +++ b/browser/installer/windows/nsis/uninstaller.nsi @@ -55,6 +55,9 @@ Var RefreshRequested ; MigrateTaskBarShortcut and is not intended to be used here. ; See Bug 1329869 for more. Var AddTaskbarSC +; Will be the registry hive that we are going to write things like class keys +; into. This will generally be HKLM if running with elevation, otherwise HKCU. +Var RegHive ; Other included files may depend upon these includes! ; The following includes are provided by NSIS. @@ -475,11 +478,11 @@ Section "Uninstall" ClearErrors WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test" ${If} ${Errors} - StrCpy $TmpVal "HKCU" ; used primarily for logging + StrCpy $RegHive "HKCU" ${Else} SetShellVarContext all ; Set SHCTX to HKLM DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" - StrCpy $TmpVal "HKLM" ; used primarily for logging + StrCpy $RegHive "HKLM" ${un.RegCleanMain} "Software\Mozilla" ${un.RegCleanUninstall} ${un.DeleteShortcuts} diff --git a/browser/moz.configure b/browser/moz.configure index d350fdd..8e51dcb 100644 --- a/browser/moz.configure +++ b/browser/moz.configure @@ -10,10 +10,46 @@ imply_option("MOZ_SERVICES_SYNC", True) imply_option("MOZ_DEDICATED_PROFILES", True) imply_option("MOZ_BLOCK_PROFILE_DOWNGRADE", False) imply_option("MOZ_NORMANDY", False) +imply_option("MOZ_PROFILE_MIGRATOR", True) + + +imply_option("MOZ_APP_VENDOR", "Alex313031") +imply_option("MOZ_APP_ID", "{ec8030f7-c20a-464f-9b0e-13a3a9e97385}") +# Include the DevTools client, not just the server (which is the default) +imply_option("MOZ_DEVTOOLS", "all") +imply_option("BROWSER_CHROME_URL", "chrome://browser/content/browser.xhtml") with only_when(target_has_linux_kernel & compile_environment): option(env="MOZ_NO_PIE_COMPAT", help="Enable non-PIE wrapper") set_config("MOZ_NO_PIE_COMPAT", depends_if("MOZ_NO_PIE_COMPAT")(lambda _: True)) + +@depends(target, update_channel, have_64_bit, moz_debug, "MOZ_AUTOMATION") +@imports(_from="os", _import="environ") +def requires_stub_installer( + target, update_channel, have_64_bit, moz_debug, moz_automation +): + if target.kernel != "WINNT": + return False + if have_64_bit: + return False + if update_channel not in ("nightly", "nightly-try", "aurora", "beta", "release"): + return False + + if moz_debug: + return False + + # Expect USE_STUB_INSTALLER from taskcluster for downstream task consistency + if moz_automation and not environ.get("USE_STUB_INSTALLER"): + die( + "STUB installer expected to be enabled but " + "USE_STUB_INSTALLER is not specified in the environment" + ) + + return True + + +imply_option("MOZ_STUB_INSTALLER", True, when=requires_stub_installer) + include("../toolkit/moz.configure") diff --git a/build/moz.configure/lto-pgo.configure b/build/moz.configure/lto-pgo.configure index d83e7de..c0ac1a1 100644 --- a/build/moz.configure/lto-pgo.configure +++ b/build/moz.configure/lto-pgo.configure @@ -26,19 +26,14 @@ option( help="Build a PGO instrumented binary", ) -imply_option("MOZ_PGO", depends_if("--enable-profile-generate")(lambda _: True)) +enable_profile_generate = depends_if("--enable-profile-generate")(lambda _: True) -set_config( - "MOZ_PROFILE_GENERATE", depends_if("--enable-profile-generate")(lambda _: True) -) -set_define( - "MOZ_PROFILE_GENERATE", depends_if("--enable-profile-generate")(lambda _: True) -) +imply_option("MOZ_PGO", enable_profile_generate) -add_old_configure_assignment( - "MOZ_PROFILE_GENERATE", 1, when="--enable-profile-generate" -) +set_config("MOZ_PROFILE_GENERATE", enable_profile_generate) + +set_define("MOZ_PROFILE_GENERATE", enable_profile_generate) option( "--enable-profile-use", @@ -47,6 +42,11 @@ option( choices=("cross",), help="Use a generated profile during the build", ) +enable_profile_use = depends_if("--enable-profile-use")(lambda _: True) + +imply_option("MOZ_PGO", enable_profile_use) +set_config("MOZ_PROFILE_USE", enable_profile_use) + option( "--with-pgo-profile-path", @@ -55,10 +55,6 @@ option( nargs=1, ) -imply_option("MOZ_PGO", depends_if("--enable-profile-use")(lambda _: True)) - -set_config("MOZ_PROFILE_USE", depends_if("--enable-profile-use")(lambda _: True)) - @depends( "--with-pgo-profile-path", @@ -429,6 +425,17 @@ def lto( ) +@depends( + dso_flags, + when=building_with_gnu_compatible_cc + & gcc_use_gnu_ld + & ~developer_options + & ~enable_profile_generate, +) +def remove_dead_symbols(dso_flags): + dso_flags.ldopts.append("-Wl,--gc-sections") + + add_old_configure_assignment("MOZ_LTO", lto.enabled) set_config("MOZ_LTO", lto.enabled) set_define("MOZ_LTO", lto.enabled) diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure index fb6ede4..b2c82e1 100644 --- a/build/moz.configure/toolchain.configure +++ b/build/moz.configure/toolchain.configure @@ -4,36 +4,131 @@ # 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/. +# Environment variables that impact the compilation step +# ============================================================== +option( + env="HOST_CPPFLAGS", + help="Extra flags for Preprocessing host sources.", + nargs=1, + default="", +) + + +option( + env="HOST_CFLAGS", + help="Extra flags for compiling host C sources.", + nargs=1, + default="", +) + + +option( + env="HOST_CXXFLAGS", + help="Extra flags for compiling host C++ sources.", + nargs=1, + default="", +) + + +option( + env="HOST_LDFLAGS", + help="Extra flags for linking host object files.", + nargs=1, + default="", +) + + +option( + env="CPPFLAGS", + help="Extra flags for preprocessing sources.", + nargs=1, + default="", +) + + +option( + env="CFLAGS", + help="Extra flags for compiling C sources.", + nargs=1, + default="", +) + + +option( + env="CXXFLAGS", + help="Extra flags for compiling C++ sources.", + nargs=1, + default="", +) + + +option( + env="ASFLAGS", + help="Extra flags for assembling sources.", + nargs=1, + default="", +) + + +option( + env="LDFLAGS", + help="Extra flags for linking object files.", + nargs=1, + default="", +) + + +option( + env="MOZ_OPTIMIZE_FLAGS", + help="Extra optimization flags.", + nargs=1, + default="", +) + + # Code optimization # ============================================================== option("--disable-optimize", nargs="?", help="Disable optimizations via compiler flags") +@depends(target, when="MOZ_PGO") +def forced_pgo_optimization_level(target): + if target.kernel == "Linux" and target.os != "Android": + return "-O3" + + @depends("--enable-optimize") def moz_optimize(option): - flags = None - if len(option): - flags = option[0] - if "-O0" in flags: - val = None - else: - val = "3" + if "-O0" not in option[0]: + return "3" elif option: - val = "1" - else: - val = None + return "1" + + +@depends("--enable-optimize", forced_pgo_optimization_level) +@imports(_from="mozbuild.shellutil", _import="split") +def moz_optimize_flags(option, forced_pgo_optimization_level): + if len(option): + return split(option[0]) + elif option and forced_pgo_optimization_level: + return [forced_pgo_optimization_level] + + +set_config("MOZ_OPTIMIZE", moz_optimize) +add_old_configure_assignment("MOZ_OPTIMIZE", moz_optimize) +add_old_configure_assignment("MOZ_CONFIGURE_OPTIMIZE_FLAGS", moz_optimize_flags) + + +@depends_if("MOZ_OPTIMIZE_FLAGS") +@imports(_from="mozbuild.shellutil", _import="split") +def moz_optimize_flags(env_optimize_flags): + return split(env_optimize_flags[0]) - return namespace( - optimize=val, - flags=flags, - ) +add_old_configure_assignment("MOZ_OPTIMIZE_FLAGS", moz_optimize_flags) -set_config("MOZ_OPTIMIZE", moz_optimize.optimize) -add_old_configure_assignment("MOZ_OPTIMIZE", moz_optimize.optimize) -add_old_configure_assignment("MOZ_CONFIGURE_OPTIMIZE_FLAGS", moz_optimize.flags) # Android NDK # ============================================================== @@ -100,7 +195,7 @@ with only_when(host_is_osx | target_is_osx): ) def mac_sdk_min_version(): - return "14.4" + return "14.2" @depends( "--with-macos-sdk", @@ -294,6 +389,17 @@ with only_when(target_is_ios): set_config("IPHONEOS_SDK_DIR", ios_sdk) +# Windows console settings +# ======================== + + +@dependable +def win32_subsystem_version(): + return "10.0" + + +add_old_configure_assignment("WIN32_SUBSYSTEM_VERSION", win32_subsystem_version) + # GC rooting and hazard analysis. # ============================================================== @@ -541,8 +647,7 @@ def check_compiler(configure_cache, compiler, language, target, android_version) # MSVC headers include C++17 features, but don't guard them # with appropriate checks. if info.type == "clang-cl": - flags.append("-Xclang") - flags.append("-std=c++17") + flags.append("-std:c++17") else: flags.append("-std=gnu++17") @@ -1208,7 +1313,11 @@ target_sysroot = sysroot(target) def system_lib_option(name, *args, **kwargs): option(name, *args, **kwargs) - @depends(name, target_sysroot.bootstrapped) + @depends( + name, + target_sysroot.bootstrapped, + when=kwargs.get("when"), + ) def no_system_lib_in_sysroot(value, bootstrapped): if bootstrapped and value: die( @@ -1546,6 +1655,11 @@ def compiler( % (host_or_target.alias, info.version) ) + if host_or_target.os == "WINNT" and info.type == "gcc": + raise FatalCheckError( + "Firefox cannot be built with mingw-gcc and requires a mingw-clang toolchain to work." + ) + if info.flags: raise FatalCheckError("Unknown compiler or compiler not supported.") @@ -1720,7 +1834,9 @@ host_windows_abi = windows_abi(host, host_c_compiler) # Generic compiler-based conditions. building_with_gcc = depends(c_compiler)(lambda info: info.type == "gcc") -building_with_gnu_cc = depends(c_compiler)(lambda info: info.type != "clang-cl") +building_with_gnu_compatible_cc = depends(c_compiler)( + lambda info: info.type != "clang-cl" +) @depends(cxx_compiler, ccache_prefix) @@ -2064,7 +2180,6 @@ linker_ldflags = linker_ldflags_tmpl(target) add_old_configure_assignment("LINKER_LDFLAGS", linker_ldflags) host_linker_ldflags = linker_ldflags_tmpl(host) -add_old_configure_assignment("HOST_LINKER_LDFLAGS", host_linker_ldflags) # There's a wrinkle with MinGW: linker configuration is not enabled, so @@ -2151,13 +2266,13 @@ try_compile( def default_debug_flags(compiler_info, target): # Debug info is ON by default. if compiler_info.type == "clang-cl": - return "-Z7" + return ("-Z7",) elif target.kernel == "WINNT" and compiler_info.type == "clang": - return "-g -gcodeview" + return ("-g", "-gcodeview") # The oldest versions of supported compilers default to DWARF-4, but # newer versions may default to DWARF-5 or newer (e.g. clang 14), which # Valgrind doesn't support. Force-use DWARF-4. - return "-gdwarf-4" + return ("-gdwarf-4",) option(env="MOZ_DEBUG_FLAGS", nargs=1, help="Debug compiler flags") @@ -2174,14 +2289,15 @@ set_config("MOZ_DEBUG_SYMBOLS", depends_if("--enable-debug-symbols")(lambda _: T @depends("MOZ_DEBUG_FLAGS", "--enable-debug-symbols", default_debug_flags) +@imports(_from="mozbuild.shellutil", _import="split") def debug_flags(env_debug_flags, enable_debug_flags, default_debug_flags): # If MOZ_DEBUG_FLAGS is set, and --enable-debug-symbols is set to a value, # --enable-debug-symbols takes precedence. Note, the value of # --enable-debug-symbols may be implied by --enable-debug. if len(enable_debug_flags): - return enable_debug_flags[0] + return split(enable_debug_flags[0]) if env_debug_flags: - return env_debug_flags[0] + return split(env_debug_flags[0]) return default_debug_flags @@ -2385,11 +2501,6 @@ def preprocess_option(compiler): set_config("PREPROCESS_OPTION", preprocess_option) -# We only want to include windows.configure when we are compiling on -# Windows, or for Windows. -include("windows.configure", when=is_windows) - - # On Power ISA, determine compiler flags for VMX, VSX and VSX-3. set_config( @@ -2410,6 +2521,36 @@ set_config( when=depends(target.cpu)(lambda cpu: cpu.startswith("ppc")), ) +# TARGET_XPCOM_ABI +# ============================================================== + +is_arm_eabi = c_compiler.try_compile( + body=""" + #if defined(__ARM_EABI__) + return 0; + #else + #error Not ARM EABI. + #endif""", + check_msg="for ARM EABI", + when=building_with_gnu_compatible_cc + & depends(target.cpu)(lambda cpu: cpu == "arm"), +) + + +@depends(target, is_arm_eabi, c_compiler) +def target_xpcom_abi(target, is_arm_eabi, compiler): + if compiler.type == "clang-cl": + return f"{target.cpu}-msvc" + elif target.cpu == "arm": + target_compiler_abi = "eabi" if is_arm_eabi else "oabi" + return f"{target.cpu}-{target_compiler_abi}-gcc3" + else: + return f"{target.cpu}-gcc3" + + +set_config("TARGET_XPCOM_ABI", target_xpcom_abi) +set_define("TARGET_XPCOM_ABI", depends(target_xpcom_abi)(lambda v: f'"{v}"')) + # ASAN # ============================================================== @@ -2421,7 +2562,89 @@ def asan(): return True +with only_when(asan): + option( + env="MOZ_CLANG_RT_ASAN_LIB_PATH", + nargs=1, + help="Path to clang runtime asan library", + ) + + @depends( + c_compiler, + target, + "MOZ_CLANG_RT_ASAN_LIB_PATH", + ) + @imports("os") + @imports("glob") + def clang_rt_asan_lib_path(c_compiler, target, clang_rt_asan_lib): + if clang_rt_asan_lib: + if os.path.exists(clang_rt_asan_lib[0]): + return clang_rt_asan_lib[0] + else: + die( + f"Specified MOZ_CLANG_RT_ASAN_LIB_PATH value '{clang_rt_asan_lib}' doesn't exist. " + ) + + # Look for the ASan runtime binary + if c_compiler.type == "clang-cl": + cpu = {"x86": "i386"}.get(target.cpu, target.cpu) + clang_rt_asan_lib = f"clang_rt.asan_dynamic-{cpu}.dll" + subdir = "windows" + elif target.os == "Android": + cpu = {"x86": "i686"}.get(target.cpu, target.cpu) + clang_rt_asan_lib = f"libclang_rt.asan-{cpu}-android.so" + subdir = "linux" + else: + return + + search_path = os.path.join( + os.path.dirname(c_compiler.compiler), + "..", + "lib", + "clang", + "*", + "lib", + subdir, + clang_rt_asan_lib, + ) + if candidates := glob.glob(search_path): + return candidates[0] + + die( + f"Couldn't find {clang_rt_asan_lib}. " + f"It should be available in the same location as {c_compiler.type}." + ) + + set_config("MOZ_CLANG_RT_ASAN_LIB_PATH", clang_rt_asan_lib_path) + + +@depends( + c_compiler, + target, + compilation_flags, + linker_flags, + build_environment, + when=asan, +) +def asan_flags(c_compiler, target, compilation_flags, linker_flags, build_env): + if c_compiler.type == "clang-cl": + # Suppressing errors in recompiled code. + if target.os == "WINNT": + flag = f"-fsanitize-blacklist={build_env.topsrcdir}/build/sanitizers/asan_blacklist_win.txt" + compilation_flags.cflags.append(flag) + compilation_flags.cxxflags.append(flag) + + asan_flag = "-fsanitize=address" + compilation_flags.cflags.append(asan_flag) + compilation_flags.cxxflags.append(asan_flag) + + if c_compiler.type != "clang-cl": + linker_flags.ldflags.extend([asan_flag, "-rdynamic"]) + + add_old_configure_assignment("MOZ_ASAN", asan) +set_define("MOZ_ASAN", True, when=asan) +set_config("MOZ_ASAN", True, when=asan) # MSAN # ============================================================== @@ -2434,7 +2657,18 @@ def msan(): return True +@depends(c_compiler, compilation_flags, linker_flags, when=msan) +def msan_flags(c_compiler, compilation_flags, linker_flags): + flags = ["-fsanitize=memory", "-fsanitize-memory-track-origins"] + compilation_flags.cflags.extend(flags) + compilation_flags.cxxflags.extend(flags) + if c_compiler.type != "clang-cl": + linker_flags.ldflags.extend(flags + ["-rdynamic"]) + + add_old_configure_assignment("MOZ_MSAN", msan) +set_define("MOZ_MSAN", True, when=msan) +set_config("MOZ_MSAN", True, when=msan) # TSAN # ============================================================== @@ -2447,7 +2681,18 @@ def tsan(): return True -add_old_configure_assignment("MOZ_TSAN", tsan) +@depends(c_compiler, compilation_flags, linker_flags, when=tsan) +def tsan_flags(c_compiler, compilation_flags, linker_flags): + flag = "-fsanitize=thread" + compilation_flags.cflags.append(flag) + compilation_flags.cxxflags.append(flag) + if c_compiler.type != "clang-cl": + linker_flags.ldflags.extend(["-fsanitize=thread", "-rdynamic"]) + + +add_old_configure_assignment("MOZ_TSAN", tsan) # still used in js/src/old-configure.in +set_define("MOZ_TSAN", True, when=tsan) +set_config("MOZ_TSAN", True, when=tsan) # UBSAN # ============================================================== @@ -2457,7 +2702,7 @@ option( ) -@depends("--enable-undefined-sanitizer", moz_optimize.optimize) +@depends("--enable-undefined-sanitizer", moz_optimize) def ubsan(options, optimize): if not options: return @@ -2479,10 +2724,37 @@ def ubsan(options, optimize): checks = options if len(options) else default_checks - return ",".join(checks) + return checks -add_old_configure_assignment("MOZ_UBSAN_CHECKS", ubsan) +@depends( + ubsan, c_compiler, compilation_flags, linker_flags, build_environment, when=ubsan +) +@imports(_from="__builtin__", _import="open") +@imports(_from="glob", _import="glob") +@imports("shutil") +def ubsan_flags(ubsan_checks, c_compiler, compilation_flags, linker_flags, build_env): + ubsan_txt = os.path.join(build_env.topobjdir, "ubsan_blacklist.txt") + with open(ubsan_txt, "w") as out_fd: + for blacklist in glob( + os.path.join( + build_env.topsrcdir, "build", "sanitizers", "ubsan_*_blacklist.txt" + ) + ): + with open(blacklist) as in_fd: + shutil.copyfileobj(in_fd, out_fd) + + joined_ubsan_checks = ",".join(ubsan_checks) + + flags = [ + f"-fsanitize={joined_ubsan_checks}", + f"-fno-sanitize-recover={joined_ubsan_checks}", + f"-fsanitize-blacklist={ubsan_txt}", + ] + compilation_flags.cflags.extend(flags) + compilation_flags.cxxflags.extend(flags) + if c_compiler.type != "clang-cl": + linker_flags.ldflags.extend(["-fsanitize=undefined", "-rdynamic"]) option( @@ -2496,7 +2768,34 @@ def ub_signed_overflow_san(): return True -add_old_configure_assignment("MOZ_SIGNED_OVERFLOW_SANITIZE", ub_signed_overflow_san) +@depends( + c_compiler, + compilation_flags, + linker_flags, + build_environment, + when=ub_signed_overflow_san, +) +def ub_signed_overflow_san_flags( + c_compiler, compilation_flags, linker_flags, build_env +): + sanitizer_blacklist = os.path.join( + build_env.topsrcdir, + "build", + "sanitizers", + "ubsan_signed_overflow_blacklist.txt", + ) + flags = [ + f"-fsanitize=signed-integer-overflow", + f"-fsanitize-blacklist={sanitizer_blacklist}", + ] + compilation_flags.cflags.extend(flags) + compilation_flags.cxxflags.extend(flags) + if c_compiler.type != "clang-cl": + linker_flags.ldflags.extend(["-fsanitize=signed-integer-overflow", "-rdynamic"]) + + +set_define("MOZ_SIGNED_OVERFLOW_SANITIZE", True, when=ub_signed_overflow_san) +set_config("MOZ_SIGNED_OVERFLOW_SANITIZE", True, when=ub_signed_overflow_san) option( @@ -2510,8 +2809,47 @@ def ub_unsigned_overflow_san(): return True -add_old_configure_assignment("MOZ_UNSIGNED_OVERFLOW_SANITIZE", ub_unsigned_overflow_san) +@depends( + c_compiler, + compilation_flags, + linker_flags, + build_environment, + when=ub_unsigned_overflow_san, +) +def ub_unsigned_overflow_san_flags( + c_compiler, compilation_flags, linker_flags, build_env +): + sanitizer_blacklist = os.path.join( + build_env.topsrcdir, + "build", + "sanitizers", + "ubsan_unsigned_overflow_blacklist.txt", + ) + flags = [ + f"-fsanitize=unsigned-integer-overflow", + f"-fsanitize-blacklist={sanitizer_blacklist}", + ] + compilation_flags.cflags.extend(flags) + compilation_flags.cxxflags.extend(flags) + if c_compiler.type != "clang-cl": + linker_flags.ldflags.extend( + ["-fsanitize=unsigned-integer-overflow", "-rdynamic"] + ) + + +set_define("MOZ_UNSIGNED_OVERFLOW_SANITIZE", True, when=ub_unsigned_overflow_san) +set_config("MOZ_UNSIGNED_OVERFLOW_SANITIZE", True, when=ub_unsigned_overflow_san) + +# +any_ubsan = ubsan | ub_signed_overflow_san | ub_unsigned_overflow_san +set_define("MOZ_UBSAN", True, when=any_ubsan) +set_config("MOZ_UBSAN", any_ubsan) + + +# We only want to include windows.configure when we are compiling on +# Windows, or for Windows. +include("windows.configure", when=is_windows) # Security Hardening # ============================================================== @@ -2680,7 +3018,7 @@ def frame_pointer_flags(compiler): @depends( - moz_optimize.optimize, + moz_optimize, moz_debug, target, "--enable-memory-sanitizer", @@ -2894,9 +3232,9 @@ option( help="Enable building with the Clang plugin (gecko specific static analyzers)", ) -add_old_configure_assignment( - "ENABLE_CLANG_PLUGIN", depends_if("--enable-clang-plugin")(lambda _: True) -) + +set_config("ENABLE_CLANG_PLUGIN", True, when="--enable-clang-plugin") +set_define("MOZ_CLANG_PLUGIN", True, when="--enable-clang-plugin") @depends(host_c_compiler, c_compiler, when="--enable-clang-plugin") @@ -2930,33 +3268,46 @@ llvm_config = check_prog( add_old_configure_assignment("LLVM_CONFIG", llvm_config) -option( - "--enable-clang-plugin-alpha", - env="ENABLE_CLANG_PLUGIN_ALPHA", - help="Enable static analysis with clang-plugin alpha checks.", -) - - -@depends("--enable-clang-plugin", "--enable-clang-plugin-alpha") -def check_clang_plugin_alpha(enable_clang_plugin, enable_clang_plugin_alpha): - if enable_clang_plugin_alpha: - if enable_clang_plugin: - return True - die("Cannot enable clang-plugin alpha checkers without --enable-clang-plugin.") +@template +def llvm_tool(name): + @depends(host_c_compiler, c_compiler, bindgen_config_paths) + def llvm_tool(host_c_compiler, c_compiler, bindgen_config_paths): + clang = None + for compiler in (host_c_compiler, c_compiler): + if compiler and compiler.type == "clang": + clang = compiler.compiler + break + elif compiler and compiler.type == "clang-cl": + clang = os.path.join(os.path.dirname(compiler.compiler), "clang") + break + + if not clang and bindgen_config_paths: + clang = bindgen_config_paths.clang_path + tool = name + if clang: + out = check_cmd_output( + clang, "--print-prog-name=%s" % tool, onerror=lambda: None + ) + if out: + tool = out.rstrip() + return (tool,) + return llvm_tool -add_old_configure_assignment("ENABLE_CLANG_PLUGIN_ALPHA", check_clang_plugin_alpha) -set_define("MOZ_CLANG_PLUGIN_ALPHA", check_clang_plugin_alpha) -option( - "--enable-mozsearch-plugin", - env="ENABLE_MOZSEARCH_PLUGIN", - help="Enable building with the mozsearch indexer plugin", +llvm_objdump = check_prog( + "LLVM_OBJDUMP", + llvm_tool("llvm-objdump"), + what="llvm-objdump", + when="--enable-compile-environment", + paths=clang_search_path, ) -add_old_configure_assignment( - "ENABLE_MOZSEARCH_PLUGIN", depends_if("--enable-mozsearch-plugin")(lambda _: True) -) +add_old_configure_assignment("LLVM_OBJDUMP", llvm_objdump) + +# Force clang-cl compiler to treat input as C++ +# ============================================================== +add_flag("-TP", cxx_compiler, when=target_is_windows & ~building_with_gnu_compatible_cc) # Use the old libstdc++ ABI # ============================================================== @@ -2972,6 +3323,27 @@ add_flag( ) +# Always included configuration file +# ============================================================== +@depends(c_compiler, build_environment, build_project) +def defines_cpp_flags(c_compiler, build_environment, build_project): + if build_project == "js": + config_h = "js/src/js-confdefs.h" + else: + config_h = "mozilla-config.h" + + if c_compiler.type == "clang-cl": + flag = "-FI" + else: + flag = "-include" + + return ["-DMOZILLA_CLIENT", flag, f"{build_environment.topobjdir}/{config_h}"] + + +set_config("OS_COMPILE_CFLAGS", defines_cpp_flags) +set_config("OS_COMPILE_CXXFLAGS", defines_cpp_flags) + + # Support various fuzzing options # ============================================================== option("--enable-fuzzing", help="Enable fuzzing support") @@ -3055,7 +3427,6 @@ set_define("FUZZING", enable_fuzzing) set_config("LIBFUZZER", enable_libfuzzer) set_define("LIBFUZZER", enable_libfuzzer) -add_old_configure_assignment("LIBFUZZER", enable_libfuzzer) set_config("AFLFUZZ", enable_aflfuzzer) set_define("AFLFUZZ", enable_aflfuzzer) @@ -3111,9 +3482,39 @@ def libfuzzer_flags(value, tsan, enable_js_fuzzilli): ) +@depends(libfuzzer_flags, when=enable_libfuzzer) +def sancov(libfuzzer_flags): + return any( + flag.startswith(head) + for head in ("-fsanitize-coverage", "-fsanitize=fuzzer") + for flag in libfuzzer_flags.use_flags + ) + + +add_old_configure_assignment("SANCOV", sancov) + + set_config("HAVE_LIBFUZZER_FLAG_FUZZER_NO_LINK", libfuzzer_flags.no_link_flag_supported) set_config("LIBFUZZER_FLAGS", libfuzzer_flags.use_flags) -add_old_configure_assignment("LIBFUZZER_FLAGS", libfuzzer_flags.use_flags) + + +# Required for stand-alone (sanitizer-less) libFuzzer. +# ============================================================== +@depends(libfuzzer_flags, linker_flags, when=enable_libfuzzer) +def add_libfuzzer_flags(libfuzzer_flags, linker_flags): + linker_flags.ldflags.extend(libfuzzer_flags.use_flags) + linker_flags.ldflags.append("-rdynamic") + + +# The LLVM symbolizer is used by all sanitizers +check_prog( + "LLVM_SYMBOLIZER", + ("llvm-symbolizer",), + allow_missing=True, + paths=clang_search_path, + when=asan | msan | tsan | any_ubsan | enable_fuzzing, +) + # Shared library building # ============================================================== @@ -3236,14 +3637,12 @@ set_config("AR_FLAGS", target_ar_config.flags) @depends(c_compiler, extra_toolchain_flags, target_ar, target_ar_config) @checking("whether ar supports response files") @imports("os") -@imports(_from="tempfile", _import="mkstemp") @imports(_from="__builtin__", _import="FileNotFoundError") +@imports(_from="__builtin__", _import="open") @imports(_from="mozbuild.configure.util", _import="LineIO") def ar_supports_response_files(c_compiler, extra_toolchain_flags, ar, ar_config): lib_path = list_path = None - try: - fd, obj_path = mkstemp(prefix="conftest.", suffix=".o") - os.close(fd) + with create_temporary_file(suffix=".o") as obj_path: if ( try_invoke_compiler( # No configure_cache because it would not create the @@ -3258,28 +3657,22 @@ def ar_supports_response_files(c_compiler, extra_toolchain_flags, ar, ar_config) ) is not None ): - fd, list_path = mkstemp(prefix="conftest.", suffix=".list") - with os.fdopen(fd, "w") as list: - list.write(obj_path) - log.debug("Creating `%s` with content:", list_path) - log.debug("| %s", obj_path) - fd, lib_path = mkstemp(prefix="conftest.", suffix=".a") - os.close(fd) - os.remove(lib_path) - ar_command = ( - [ar] - + [x.replace("$@", lib_path) for x in ar_config.flags] - + ["@" + list_path] - ) - result = check_cmd_output(*ar_command, onerror=lambda: None) - return result is not None - finally: - for cleanup_path in (obj_path, list_path, lib_path): - if cleanup_path: - try: - os.remove(cleanup_path) - except FileNotFoundError: - pass + with create_temporary_file(suffix=".list") as list_path: + with open(list_path, "w") as fd: + fd.write(obj_path) + + log.debug("Creating `%s` with content:", list_path) + log.debug("| %s", obj_path) + + with create_temporary_file(suffix=".a") as lib_path: + os.remove(lib_path) + ar_command = ( + [ar] + + [x.replace("$@", lib_path) for x in ar_config.flags] + + ["@" + list_path] + ) + result = check_cmd_output(*ar_command, onerror=lambda: None) + return result is not None set_config("AR_SUPPORTS_RESPONSE_FILE", True, when=ar_supports_response_files) @@ -3309,9 +3702,19 @@ def nm_names(toolchain_prefix, c_compiler): check_prog("NM", nm_names, paths=clang_search_path, when=target_has_linux_kernel) +# We don't use it in the code, but it can be useful for debugging, so give +# the user the option of enabling it. option("--enable-cpp-rtti", help="Enable C++ RTTI") -add_old_configure_assignment("_MOZ_USE_RTTI", "1", when="--enable-cpp-rtti") + +@depends(compilation_flags, c_compiler, "--enable-cpp-rtti") +def enable_cpp_rtti(compilation_flags, c_compiler, enable_rtti): + if enable_rtti: + return + if c_compiler.type == "clang-cl": + compilation_flags.cxxflags.append("-GR-") + else: + compilation_flags.cxxflags.append("-fno-rtti") option( @@ -3447,6 +3850,26 @@ set_config( ), ) +set_config( + "SVE2_FLAGS", + ["-march=armv9-a+sve2"], + try_compile( + check_msg="for ARM SVE2 target feature", + flags=["-march=armv9-a+sve2"], + when=is_aarch64_target, + ), +) + +set_config( + "DOTPROD_FLAGS", + ["-march=armv8.2-a+dotprod"], + try_compile( + check_msg="for ARM dotprod target feature", + flags=["-march=armv8.2-a+dotprod"], + when=is_aarch64_target, + ), +) + # dtrace support ## option("--enable-dtrace", help="Build with dtrace support") @@ -3459,3 +3882,20 @@ dtrace = check_header( set_config("HAVE_DTRACE", True, when=dtrace) set_define("INCLUDE_MOZILLA_DTRACE", True, when=dtrace) + + +@depends( + try_compile( + includes=["stdio.h"], + body='puts("demat");', + flags=moz_optimize_flags, + language="C", + check_msg="for valid C compiler optimization flags", + ), + moz_optimize_flags, + when=moz_optimize, +) +@imports(_from="mozbuild.shellutil", _import="quote") +def check_optimization_flags(check_result, moz_optimize_flags): + if not check_result: + die(f"Invalid C compiler optimization flags: {quote(*moz_optimize_flags)}") diff --git a/moz.build b/moz.build index 1b23506..b53e932 100644 --- a/moz.build +++ b/moz.build @@ -219,6 +219,8 @@ SPHINX_TREES["mots"] = "docs/mots" SPHINX_TREES["update-infrastructure"] = "docs/update-infrastructure" +SPHINX_TREES["content-security"] = "docs/content-security" + include("build/templates.mozbuild") DIRS += ["policies"] diff --git a/mozconfigs/context.py b/mozconfigs/context.py index 508e4f7..c3d2223 100644 --- a/mozconfigs/context.py +++ b/mozconfigs/context.py @@ -349,22 +349,22 @@ def __init__(self, context): ( "HOST_CXXFLAGS", context.config.substs.get("HOST_CXXFLAGS"), - ("HOST_CXXFLAGS", "HOST_CXX_LDFLAGS"), + ("HOST_CXXFLAGS",), ), ( "HOST_CFLAGS", context.config.substs.get("HOST_CFLAGS"), - ("HOST_CFLAGS", "HOST_C_LDFLAGS"), + ("HOST_CFLAGS",), ), ( "HOST_OPTIMIZE", self._optimize_flags(), - ("HOST_CFLAGS", "HOST_CXXFLAGS", "HOST_C_LDFLAGS", "HOST_CXX_LDFLAGS"), + ("HOST_CFLAGS", "HOST_CXXFLAGS"), ), - ("RTL", None, ("HOST_CFLAGS", "HOST_C_LDFLAGS")), + ("RTL", None, ("HOST_CFLAGS",)), ("HOST_DEFINES", None, ("HOST_CFLAGS", "HOST_CXXFLAGS")), - ("MOZBUILD_HOST_CFLAGS", [], ("HOST_CFLAGS", "HOST_C_LDFLAGS")), - ("MOZBUILD_HOST_CXXFLAGS", [], ("HOST_CXXFLAGS", "HOST_CXX_LDFLAGS")), + ("MOZBUILD_HOST_CFLAGS", [], ("HOST_CFLAGS",)), + ("MOZBUILD_HOST_CXXFLAGS", [], ("HOST_CXXFLAGS",)), ( "BASE_INCLUDES", ["-I%s" % main_src_dir, "-I%s" % context.objdir], @@ -419,16 +419,16 @@ def _debug_flags(self): debug_flags += ["-F", "cv8"] elif self._context.config.substs.get("OS_ARCH") != "Darwin": debug_flags += ["-F", "dwarf"] - elif ( - self._context.config.substs.get("OS_ARCH") == "WINNT" - and self._context.config.substs.get("TARGET_CPU") == "aarch64" - ): - # armasm64 accepts a paucity of options compared to ml/ml64. - pass + elif self._context.config.substs.get("CC_TYPE") == "clang-cl": + if self._context.config.substs.get("TARGET_CPU") == "aarch64": + # armasm64 accepts a paucity of options compared to ml/ml64. + pass + else: + # Unintuitively, -Zi for ml/ml64 is equivalent to -Z7 for cl.exe. + # -Zi for cl.exe has a different purpose, so this is only used here. + debug_flags += ["-Zi"] else: - debug_flags += self._context.config.substs.get( - "MOZ_DEBUG_FLAGS", "" - ).split() + debug_flags += self._context.config.substs.get("MOZ_DEBUG_FLAGS", []) return debug_flags @@ -484,7 +484,7 @@ def _os_ldflags(self): if all( [ self._context.config.substs.get("OS_ARCH") == "WINNT", - not self._context.config.substs.get("GNU_CC"), + self._context.config.substs.get("CC_TYPE") == "clang-cl", not self._context.config.substs.get("MOZ_DEBUG"), ] ): @@ -503,7 +503,7 @@ def _debug_flags(self): if self._context.config.substs.get( "MOZ_DEBUG" ) or self._context.config.substs.get("MOZ_DEBUG_SYMBOLS"): - return self._context.config.substs.get("MOZ_DEBUG_FLAGS", "").split() + return self._context.config.substs.get("MOZ_DEBUG_FLAGS", []) return [] def _warnings_as_errors(self): diff --git a/mozconfigs/mozconfig b/mozconfigs/mozconfig index ce5667b..18ec09a 100644 --- a/mozconfigs/mozconfig +++ b/mozconfigs/mozconfig @@ -23,10 +23,14 @@ ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --disable-elf-hack ac_add_options --enable-lto +ac_add_options --enable-jemalloc ac_add_options --enable-wasm-avx ac_add_options --enable-optimize="-O3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes" ac_add_options --enable-rust-simd ac_add_options --enable-hardening +ac_add_options --disable-dmd +ac_add_options --disable-gpsd +ac_add_options --disable-necko-wifi #ac_add_options --disable-trace-logging mk_add_options MOZILLA_OFFICIAL=1 MOZILLA_OFFICIAL=1 @@ -66,6 +70,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -111,4 +116,5 @@ export CXXFLAGS="-O3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes" export LDFLAGS="-Wl,-O3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes" #export MOZ_LTO_LDFLAGS="-Wl,-mllvm,-polly" export RUSTFLAGS="-C target-feature=+avx -C codegen-units=1" +export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-arm64 b/mozconfigs/mozconfig-arm64 index 120ddd7..9d84918 100644 --- a/mozconfigs/mozconfig-arm64 +++ b/mozconfigs/mozconfig-arm64 @@ -23,9 +23,13 @@ ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --disable-elf-hack ac_add_options --enable-lto +ac_add_options --enable-jemalloc ac_add_options --enable-optimize="-O3 -march=armv8-a+simd -mtune=cortex-a72" ac_add_options --enable-rust-simd ac_add_options --enable-hardening +ac_add_options --disable-dmd +ac_add_options --disable-gpsd +ac_add_options --disable-necko-wifi #ac_add_options --disable-trace-logging mk_add_options MOZILLA_OFFICIAL=1 MOZILLA_OFFICIAL=1 @@ -64,6 +68,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga diff --git a/mozconfigs/mozconfig-avx2 b/mozconfigs/mozconfig-avx2 index f4c66e7..e4295e1 100644 --- a/mozconfigs/mozconfig-avx2 +++ b/mozconfigs/mozconfig-avx2 @@ -23,11 +23,15 @@ ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --disable-elf-hack ac_add_options --enable-lto +ac_add_options --enable-jemalloc ac_add_options --enable-wasm-avx #ac_add_options --enable-avx2 ac_add_options --enable-optimize="-O3 -march=x86-64-v3" ac_add_options --enable-rust-simd ac_add_options --enable-hardening +ac_add_options --disable-dmd +ac_add_options --disable-gpsd +ac_add_options --disable-necko-wifi #ac_add_options --disable-trace-logging mk_add_options MOZILLA_OFFICIAL=1 MOZILLA_OFFICIAL=1 @@ -67,6 +71,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -112,4 +117,5 @@ export CXXFLAGS="-O3 -ffp-contract=fast -march=x86-64-v3" export LDFLAGS="-Wl,-O3 -Wl,-mllvm,-fp-contract=fast -march=x86-64-v3" #export MOZ_LTO_LDFLAGS="-Wl,-mllvm,-polly" export RUSTFLAGS="-C target-cpu=x86-64-v3 -C target-feature=+avx2 -C codegen-units=1" +export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-debug b/mozconfigs/mozconfig-debug index 8eb5069..230dffc 100644 --- a/mozconfigs/mozconfig-debug +++ b/mozconfigs/mozconfig-debug @@ -18,6 +18,9 @@ ac_add_options --enable-wasm-avx ac_add_options --enable-optimize="-O3 -mavx -maes" ac_add_options --enable-rust-simd ac_add_options --enable-hardening +ac_add_options --disable-dmd +ac_add_options --disable-gpsd +ac_add_options --disable-necko-wifi #ac_add_options --disable-trace-logging # Media settings @@ -49,6 +52,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -70,10 +74,10 @@ mk_add_options AUTOCLOBBER=1 export AUTOCLOBBER=1 # Compiler, Linker, and Rust flags -export CFLAGS="-O3 -mavx -maes" -export CPPFLAGS="-O3 -mavx -maes" -export CXXFLAGS="-O3 -mavx -maes" -export LDFLAGS="-Wl,-O3 -mavx -maes" +export CFLAGS="-Og -mavx -maes" +export CPPFLAGS="-Og -mavx -maes" +export CXXFLAGS="-Og -mavx -maes" +export LDFLAGS="-Wl,-O0 -mavx -maes" #export MOZ_LTO_LDFLAGS="-Wl,-mllvm,-polly" export RUSTFLAGS="-C target-feature=+avx" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-macos-arm64 b/mozconfigs/mozconfig-macos-arm64 index 2ff892e..827fab2 100644 --- a/mozconfigs/mozconfig-macos-arm64 +++ b/mozconfigs/mozconfig-macos-arm64 @@ -21,7 +21,8 @@ ac_add_options --disable-tests #ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --enable-lto -ac_add_options --enable-optimize="-O3 -march=armv8.3-a+simd" +ac_add_options --enable-jemalloc +ac_add_options --enable-optimize="-O3 -march=armv8.3-a+simd -mcpu=apple-m1" ac_add_options --enable-rust-simd ac_add_options --enable-hardening #ac_add_options --disable-trace-logging @@ -60,6 +61,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -73,6 +75,9 @@ ac_add_options --with-l10n-base=$PWD/browser/locales/en-US ac_add_options --with-distribution-id=com.alex313031.mercury #-app=/home/alex/bin/Mercury/application.ini +export MOZ_MACBUNDLE_ID=${appId} +export MOZ_MACBUNDLE_NAME="Mercury.app" + # Make flags (set to number of CPU cores) mk_add_options MOZ_MAKE_FLAGS="-j5" @@ -98,5 +103,5 @@ export CPPFLAGS="-O3 -march=armv8.3-a+simd" export CXXFLAGS="-O3 -march=armv8.3-a+simd" export LDFLAGS="-Wl,-O3 -march=armv8.3-a+simd" #export MOZ_LTO_LDFLAGS="-Wl,-mllvm,-polly" -export RUSTFLAGS="-C target-feature=+v8.3a -C codegen-units=1" +export RUSTFLAGS="-C target-feature=+v8.3a -C codegen-units=1 -C target-cpu=apple-m1" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-macos-arm64-cross b/mozconfigs/mozconfig-macos-arm64-cross index 199b448..3c1a878 100644 --- a/mozconfigs/mozconfig-macos-arm64-cross +++ b/mozconfigs/mozconfig-macos-arm64-cross @@ -23,7 +23,8 @@ ac_add_options --disable-tests #ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --enable-lto -ac_add_options --enable-optimize="-O3 -march=armv8.3-a+simd" +ac_add_options --enable-jemalloc +ac_add_options --enable-optimize="-O3 -march=armv8.3-a+simd -mcpu=apple-m1" ac_add_options --enable-rust-simd ac_add_options --enable-hardening #ac_add_options --disable-trace-logging @@ -62,6 +63,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -75,6 +77,9 @@ ac_add_options --with-l10n-base=$PWD/browser/locales/en-US ac_add_options --with-distribution-id=com.alex313031.mercury #-app=/home/alex/bin/Mercury/application.ini +export MOZ_MACBUNDLE_ID=${appId} +export MOZ_MACBUNDLE_NAME="Mercury.app" + # Make flags (set to number of CPU cores) mk_add_options MOZ_MAKE_FLAGS="-j5" @@ -100,5 +105,5 @@ export CPPFLAGS="-O3 -march=armv8.3-a+simd" export CXXFLAGS="-O3 -march=armv8.3-a+simd" export LDFLAGS="-Wl,-O3 -march=armv8.3-a+simd" #export MOZ_LTO_LDFLAGS="-Wl,-mllvm,-polly" -export RUSTFLAGS="-C target-feature=+v8.3a -C codegen-units=1" +export RUSTFLAGS="-C target-feature=+v8.3a -C codegen-units=1 -C target-cpu=apple-m1" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-macos-x64 b/mozconfigs/mozconfig-macos-x64 index c3f673d..6fa847e 100644 --- a/mozconfigs/mozconfig-macos-x64 +++ b/mozconfigs/mozconfig-macos-x64 @@ -21,6 +21,7 @@ ac_add_options --disable-tests #ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --enable-lto +ac_add_options --enable-jemalloc ac_add_options --enable-wasm-avx #ac_add_options --enable-avx2 ac_add_options --enable-optimize="-O3 -march=x86-64-v3" @@ -62,6 +63,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga diff --git a/mozconfigs/mozconfig-macos-x64-cross b/mozconfigs/mozconfig-macos-x64-cross index d32ab15..94577e7 100644 --- a/mozconfigs/mozconfig-macos-x64-cross +++ b/mozconfigs/mozconfig-macos-x64-cross @@ -23,6 +23,7 @@ ac_add_options --disable-tests #ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --enable-lto +ac_add_options --enable-jemalloc ac_add_options --enable-wasm-avx #ac_add_options --enable-avx2 ac_add_options --enable-optimize="-O3 -march=x86-64-v3" @@ -64,6 +65,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga diff --git a/mozconfigs/mozconfig-sse3 b/mozconfigs/mozconfig-sse3 index 046afaa..0e7e97b 100644 --- a/mozconfigs/mozconfig-sse3 +++ b/mozconfigs/mozconfig-sse3 @@ -23,10 +23,14 @@ ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --disable-elf-hack ac_add_options --enable-lto +ac_add_options --enable-jemalloc #ac_add_options --enable-wasm-avx ac_add_options --enable-optimize="-O3 -msse3" ac_add_options --enable-rust-simd ac_add_options --enable-hardening +ac_add_options --disable-dmd +ac_add_options --disable-gpsd +ac_add_options --disable-necko-wifi #ac_add_options --disable-trace-logging mk_add_options MOZILLA_OFFICIAL=1 MOZILLA_OFFICIAL=1 @@ -66,6 +70,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -111,4 +116,5 @@ export CXXFLAGS="-O3 -msse3" export LDFLAGS="-Wl,-O3 -msse3" #export MOZ_LTO_LDFLAGS="-Wl,-mllvm,-polly" export RUSTFLAGS="-C target-feature=+sse3 -C codegen-units=1" +export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-sse4 b/mozconfigs/mozconfig-sse4 index f69644c..7337002 100644 --- a/mozconfigs/mozconfig-sse4 +++ b/mozconfigs/mozconfig-sse4 @@ -23,10 +23,14 @@ ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --disable-elf-hack ac_add_options --enable-lto +ac_add_options --enable-jemalloc #ac_add_options --enable-wasm-avx ac_add_options --enable-optimize="-O3 -msse3 -mssse3 -msse4.1" ac_add_options --enable-rust-simd ac_add_options --enable-hardening +ac_add_options --disable-dmd +ac_add_options --disable-gpsd +ac_add_options --disable-necko-wifi #ac_add_options --disable-trace-logging mk_add_options MOZILLA_OFFICIAL=1 MOZILLA_OFFICIAL=1 @@ -66,6 +70,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -111,4 +116,5 @@ export CXXFLAGS="-O3 -msse3 -mssse3 -msse4.1" export LDFLAGS="-Wl,-O3 -msse3 -mssse3 -msse4.1" #export MOZ_LTO_LDFLAGS="-Wl,-mllvm,-polly" export RUSTFLAGS="-C target-feature=+sse4.1 -C codegen-units=1" +export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-win b/mozconfigs/mozconfig-win index cc68025..287caa8 100644 --- a/mozconfigs/mozconfig-win +++ b/mozconfigs/mozconfig-win @@ -26,6 +26,7 @@ ac_add_options --enable-strip ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --enable-lto +ac_add_options --enable-jemalloc ac_add_options --enable-wasm-avx ac_add_options --enable-optimize="-O2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes -Xclang -O3" ac_add_options --enable-rust-simd @@ -69,6 +70,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -112,6 +114,6 @@ export CFLAGS="-O2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes /clang:-O3 /arch export CPPFLAGS="-O2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes /clang:-O3 /arch:AVX" export CXXFLAGS="-O2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes /clang:-O3 /arch:AVX" export LDFLAGS="-Wl,-O3 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -maes" -POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" +export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" export RUSTFLAGS="-C target-feature=+avx -C codegen-units=1" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-win-avx2 b/mozconfigs/mozconfig-win-avx2 index 3500c8b..35c6cf0 100644 --- a/mozconfigs/mozconfig-win-avx2 +++ b/mozconfigs/mozconfig-win-avx2 @@ -26,6 +26,7 @@ ac_add_options --enable-strip ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --enable-lto +ac_add_options --enable-jemalloc ac_add_options --enable-wasm-avx ac_add_options --enable-optimize="-O2 -march=x86-64-v3 -Xclang -O3" ac_add_options --enable-rust-simd @@ -69,6 +70,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -112,6 +114,6 @@ export CFLAGS="-O2 -march=x86-64-v3 /clang:-O3 /clang:-ffp-contract=fast /arch:A export CPPFLAGS="-O2 -march=x86-64-v3 /clang:-O3 /clang:-ffp-contract=fast /arch:AVX2" export CXXFLAGS="-O2 -march=x86-64-v3 /clang:-O3 /clang:-ffp-contract=fast /arch:AVX2" export LDFLAGS="-Wl,-O3 -march=x86-64-v3" -POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" +export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" export RUSTFLAGS="-C target-cpu=haswell -C target-feature=+avx2 -C codegen-units=1" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-win-avx2-cross b/mozconfigs/mozconfig-win-avx2-cross index 69ccf79..bbe16e3 100644 --- a/mozconfigs/mozconfig-win-avx2-cross +++ b/mozconfigs/mozconfig-win-avx2-cross @@ -33,6 +33,7 @@ ac_add_options --enable-strip ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --enable-lto +ac_add_options --enable-jemalloc ac_add_options --enable-wasm-avx ac_add_options --enable-optimize="/O2 /clang:-O3 -march=x86-64-v3" ac_add_options --enable-rust-simd @@ -76,6 +77,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -115,4 +117,5 @@ export CXXFLAGS="-march=x86-64-v3 /clang:-O3 /clang:-ffp-contract=fast" export LDFLAGS="-Wl,-O3 -march=x86-64-v3" #export MOZ_LTO_LDFLAGS="-Wl,-mllvm,-polly" export RUSTFLAGS="-C target-cpu=haswell -C target-feature=+avx2 -C codegen-units=1" +export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-win-cross b/mozconfigs/mozconfig-win-cross index b566880..c094c9f 100644 --- a/mozconfigs/mozconfig-win-cross +++ b/mozconfigs/mozconfig-win-cross @@ -33,6 +33,7 @@ ac_add_options --enable-strip ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --enable-lto +ac_add_options --enable-jemalloc ac_add_options --enable-wasm-avx ac_add_options --enable-optimize="-mavx -maes /O2 /clang:-O3 /arch:AVX" ac_add_options --enable-rust-simd @@ -76,6 +77,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -115,4 +117,5 @@ export CXXFLAGS="-mavx -maes /O2 /clang:-O3 /arch:AVX" export LDFLAGS="-Wl,-O3 -mavx -maes" #export MOZ_LTO_LDFLAGS="-Wl,-mllvm,-polly" export RUSTFLAGS="-C target-feature=+avx -C codegen-units=1" +export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-win-debug b/mozconfigs/mozconfig-win-debug index 0b10320..c246395 100644 --- a/mozconfigs/mozconfig-win-debug +++ b/mozconfigs/mozconfig-win-debug @@ -54,6 +54,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # Installer export WIN32_REDIST_DIR="/c/Program Files/Microsoft Visual Studio/2022/Community/VC/Redist/MSVC/14.38.33130/x64/Microsoft.VC143.CRT" @@ -78,10 +79,10 @@ mk_add_options AUTOCLOBBER=1 export AUTOCLOBBER=1 # Compiler, Linker, and Rust flags -export CFLAGS="-O3 -mavx -maes /clang:-O3 /arch:AVX" -export CPPFLAGS="-O3 -mavx -maes /clang:-O3 /arch:AVX" -export CXXFLAGS="-O3 -mavx -maes /clang:-O3 /arch:AVX" -export LDFLAGS="-Wl,-O3 -mavx -maes" +export CFLAGS="-mavx -maes /clang:-Og /arch:AVX" +export CPPFLAGS="-mavx -maes /clang:-Og /arch:AVX" +export CXXFLAGS="-mavx -maes /clang:-Og /arch:AVX" +export LDFLAGS="-Wl,-O0 -mavx -maes" #export MOZ_LTO_LDFLAGS="-mllvm:-polly" export RUSTFLAGS="-C target-feature=+avx" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-win-sse3 b/mozconfigs/mozconfig-win-sse3 index a9e0f64..7716220 100644 --- a/mozconfigs/mozconfig-win-sse3 +++ b/mozconfigs/mozconfig-win-sse3 @@ -26,6 +26,7 @@ ac_add_options --enable-strip ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --enable-lto +ac_add_options --enable-jemalloc #ac_add_options --enable-wasm-avx ac_add_options --enable-optimize="-O2 -msse3 -Xclang -O3" ac_add_options --enable-rust-simd @@ -69,6 +70,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -112,6 +114,6 @@ export CFLAGS="-O2 -msse3 /clang:-O3" export CPPFLAGS="-O2 -msse3 /clang:-O3" export CXXFLAGS="-O2 -msse3 /clang:-O3" export LDFLAGS="-Wl,-O3 -msse3" -POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" +export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" export RUSTFLAGS="-C target-feature=+sse3 -C codegen-units=1" export VERBOSE=1 diff --git a/mozconfigs/mozconfig-win-sse4 b/mozconfigs/mozconfig-win-sse4 index 7384123..2e843a1 100644 --- a/mozconfigs/mozconfig-win-sse4 +++ b/mozconfigs/mozconfig-win-sse4 @@ -26,6 +26,7 @@ ac_add_options --enable-strip ac_add_options --enable-install-strip ac_add_options --enable-clang-plugin ac_add_options --enable-lto +ac_add_options --enable-jemalloc #ac_add_options --enable-wasm-avx ac_add_options --enable-optimize="-O2 -msse3 -mssse3 -msse4.1 -Xclang -O3" ac_add_options --enable-rust-simd @@ -69,6 +70,7 @@ export MOZ_CRASHREPORTER=0 export MOZ_DATA_REPORTING=0 export MOZ_REQUIRE_SIGNING= export MOZ_TELEMETRY_REPORTING= +export MOZ_PACKAGE_JSSHELL=1 # API Keys ac_add_options --with-google-location-service-api-keyfile=@TOPSRCDIR@/ga @@ -112,6 +114,6 @@ export CFLAGS="-O2 -msse3 -mssse3 -msse4.1 /clang:-O3" export CPPFLAGS="-O2 -msse3 -mssse3 -msse4.1 /clang:-O3" export CXXFLAGS="-O2 -msse3 -mssse3 -msse4.1 /clang:-O3" export LDFLAGS="-Wl,-O3 -msse3 -mssse3 -msse4.1" -POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" +export POLLY="-mllvm -polly -mllvm -polly-2nd-level-tiling -mllvm -polly-loopfusion-greedy -mllvm -polly-pattern-matching-based-opts -mllvm -polly-position=before-vectorizer -mllvm -polly-vectorizer=stripmine" export RUSTFLAGS="-C target-feature=+sse4.1 -C codegen-units=1" export VERBOSE=1 diff --git a/netwerk/protocol/http/nsHttpHandler.cpp b/netwerk/protocol/http/nsHttpHandler.cpp index a4cae23..b4123f7 100644 --- a/netwerk/protocol/http/nsHttpHandler.cpp +++ b/netwerk/protocol/http/nsHttpHandler.cpp @@ -144,8 +144,8 @@ static nsCString GetDeviceModelId() { // Assumed to be running on the main thread // We need the device property in either case nsAutoCString deviceModelId; - nsCOMPtr infoService = - do_GetService("@mozilla.org/system-info;1"); + nsCOMPtr infoService; + infoService = mozilla::components::SystemInfo::Service(); MOZ_ASSERT(infoService, "Could not find a system info service"); nsAutoString androidDevice; nsresult rv = infoService->GetPropertyAsAString(u"device"_ns, androidDevice); @@ -216,31 +216,48 @@ static nsCString ImageAcceptHeader() { mimeTypes.Append("image/jxl,"); } - mimeTypes.Append("image/webp,*/*"); + mimeTypes.Append("image/webp,"); + + // Default value as specified by fetch standard + // https://fetch.spec.whatwg.org/commit-snapshots/8dd73dbecfefdbef8f432164fb3a5b9785f7f520/#ref-for-header-list-contains%E2%91%A7 + mimeTypes.Append("image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5"); return mimeTypes; } -static nsCString DocumentAcceptHeader(const nsCString& aImageAcceptHeader) { - nsPrintfCString mimeTypes( - "text/html,application/xhtml+xml,application/xml;q=0.9,%s;q=0.8", - aImageAcceptHeader.get()); +static nsCString DocumentAcceptHeader() { + // https://fetch.spec.whatwg.org/#document-accept-header-value + // The value specified by the fetch standard is + // `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8` + // but we also insert all of the image formats before */* + nsCString mimeTypes("text/html,application/xhtml+xml,application/xml;q=0.9,"); - return std::move(mimeTypes); + if (mozilla::StaticPrefs::image_avif_enabled()) { + mimeTypes.Append("image/avif,"); + } + + if (mozilla::StaticPrefs::image_jxl_enabled()) { + mimeTypes.Append("image/jxl,"); + } + + mimeTypes.Append("image/webp,image/png,image/svg+xml,*/*;q=0.8"); + + return mimeTypes; } +Atomic nsHttpHandler::sParentalControlsEnabled(false); + nsHttpHandler::nsHttpHandler() : mIdleTimeout(PR_SecondsToInterval(10)), mSpdyTimeout( PR_SecondsToInterval(StaticPrefs::network_http_http2_timeout())), mResponseTimeout(PR_SecondsToInterval(300)), mImageAcceptHeader(ImageAcceptHeader()), - mDocumentAcceptHeader(DocumentAcceptHeader(ImageAcceptHeader())), + mDocumentAcceptHeader(DocumentAcceptHeader()), mLastUniqueID(NowInSeconds()), mDebugObservations(false), mEnableAltSvc(false), mEnableAltSvcOE(false), - mEnableOriginExtension(false), mSpdyPingThreshold(PR_SecondsToInterval( StaticPrefs::network_http_http2_ping_threshold())), mSpdyPingTimeout(PR_SecondsToInterval( @@ -251,9 +268,11 @@ nsHttpHandler::nsHttpHandler() MOZ_ASSERT(!gHttpHandler, "HTTP handler already created!"); - nsCOMPtr runtime = do_GetService("@mozilla.org/xre/runtime;1"); + nsCOMPtr runtime; + runtime = mozilla::components::XULRuntime::Service(); if (runtime) { runtime->GetProcessID(&mProcessId); + runtime->GetUniqueProcessID(&mUniqueProcessId); } } @@ -312,7 +331,8 @@ nsresult nsHttpHandler::Init() { rv = nsHttp::CreateAtomTable(); if (NS_FAILED(rv)) return rv; - nsCOMPtr service = do_GetService(NS_IOSERVICE_CONTRACTID, &rv); + nsCOMPtr service; + service = mozilla::components::IO::Service(&rv); if (NS_FAILED(rv)) { NS_WARNING("unable to continue without io service"); return rv; @@ -372,8 +392,8 @@ nsresult nsHttpHandler::Init() { mCompatFirefox.AssignLiteral("Firefox/" MOZILLA_UAVERSION); - nsCOMPtr appInfo = - do_GetService("@mozilla.org/xre/app-info;1"); + nsCOMPtr appInfo; + appInfo = mozilla::components::XULRuntime::Service(); mAppName.AssignLiteral(MOZ_APP_UA_NAME); if (mAppName.Length() == 0 && appInfo) { @@ -466,17 +486,51 @@ nsresult nsHttpHandler::Init() { MakeNewRequestTokenBucket(); mWifiTickler = new Tickler(); - if (NS_FAILED(mWifiTickler->Init())) mWifiTickler = nullptr; - - nsCOMPtr pc = - do_CreateInstance("@mozilla.org/parental-controls-service;1"); - if (pc) { - pc->GetParentalControlsEnabled(&mParentalControlEnabled); + if (NS_FAILED(mWifiTickler->Init())) { + mWifiTickler = nullptr; } + UpdateParentalControlsEnabled(false /* wait for completion */); return NS_OK; } +void nsHttpHandler::UpdateParentalControlsEnabled(bool waitForCompletion) { + // Child process does not have privileges to read parentals control state + if (!XRE_IsParentProcess()) { + return; + } + + auto getParentalControlsTask = []() { + nsCOMPtr pc = + do_CreateInstance("@mozilla.org/parental-controls-service;1"); + if (pc) { + bool localEnabled = false; + pc->GetParentalControlsEnabled(&localEnabled); + sParentalControlsEnabled = localEnabled; + + // Cache the state of parental controls via preference + if (!AppShutdown::IsInOrBeyond(ShutdownPhase::AppShutdownConfirmed)) { + Preferences::SetBool( + StaticPrefs::GetPrefName_network_parental_controls_cached_state(), + localEnabled); + } + } + }; + + if (waitForCompletion) { + getParentalControlsTask(); + } else { + // To avoid blocking on determining parental controls state, used the cached + // pref until the runnable completes + sParentalControlsEnabled = + mozilla::StaticPrefs::network_parental_controls_cached_state(); + Unused << NS_DispatchToMainThreadQueue( + NS_NewRunnableFunction("GetParentalControlsEnabled", + std::move(getParentalControlsTask)), + mozilla::EventQueuePriority::Idle); + } +} + const nsCString& nsHttpHandler::Http3QlogDir() { if (StaticPrefs::network_http_http3_enable_qlog()) { return mHttp3QlogDir; @@ -597,7 +651,7 @@ nsresult nsHttpHandler::AddStandardRequestHeaders( if (NS_FAILED(rv)) return rv; // add the "Send Hint" header - if (mSafeHintEnabled || mParentalControlEnabled) { + if (mSafeHintEnabled || sParentalControlsEnabled) { rv = request->SetHeader(nsHttp::Prefer, "safe"_ns, false, nsHttpHeaderArray::eVarietyRequestDefault); if (NS_FAILED(rv)) return rv; @@ -651,8 +705,8 @@ bool nsHttpHandler::IsAcceptableEncoding(const char* enc, bool isSecure) { nsISiteSecurityService* nsHttpHandler::GetSSService() { if (!mSSService) { - nsCOMPtr service = - do_GetService(NS_SSSERVICE_CONTRACTID); + nsCOMPtr service; + service = mozilla::components::SiteSecurity::Service(); mSSService = new nsMainThreadPtrHolder( "nsHttpHandler::mSSService", service); } @@ -715,7 +769,8 @@ nsresult nsHttpHandler::GenerateHostPort(const nsCString& host, int32_t port, } // static -uint8_t nsHttpHandler::UrgencyFromCoSFlags(uint32_t cos) { +uint8_t nsHttpHandler::UrgencyFromCoSFlags(uint32_t cos, + int32_t aSupportsPriority) { uint8_t urgency; if (cos & nsIClassOfService::UrgentStart) { // coming from an user interaction => response should be the highest @@ -739,7 +794,32 @@ uint8_t nsHttpHandler::UrgencyFromCoSFlags(uint32_t cos) { // all others get a lower priority than the main html document urgency = 4; } - return urgency; + + int8_t adjustment = 0; + if (mozilla::StaticPrefs::network_fetchpriority_adjust_urgency()) { + if (aSupportsPriority <= nsISupportsPriority::PRIORITY_HIGHEST) { + adjustment = -2; + } else if (aSupportsPriority <= nsISupportsPriority::PRIORITY_HIGH) { + adjustment = -1; + } else if (aSupportsPriority >= nsISupportsPriority::PRIORITY_LOWEST) { + adjustment = 2; + } else if (aSupportsPriority >= nsISupportsPriority::PRIORITY_LOW) { + adjustment = 1; + } + } + + auto adjustUrgency = [](uint8_t u, int8_t a) -> uint8_t { + int16_t result = static_cast(u) + a; + if (result <= 0) { + return 0; + } + if (result >= 6) { + return 6; + } + return result; + }; + + return adjustUrgency(urgency, adjustment); } //----------------------------------------------------------------------------- @@ -874,16 +954,33 @@ void nsHttpHandler::InitUserAgentComponents() { #endif #ifdef ANDROID - nsCOMPtr infoService = - do_GetService("@mozilla.org/system-info;1"); + nsCOMPtr infoService; + infoService = mozilla::components::SystemInfo::Service(); MOZ_ASSERT(infoService, "Could not find a system info service"); nsresult rv; + // Add the Android version number to the Fennec platform identifier. nsAutoString androidVersion; rv = infoService->GetPropertyAsAString(u"release_version"_ns, androidVersion); - if (NS_SUCCEEDED(rv)) { - mPlatform += " "; + MOZ_ASSERT_IF( + NS_SUCCEEDED(rv), + // Like version "9" + (androidVersion.Length() == 1 && std::isdigit(androidVersion[0])) || + // Or like version "8.1", "10", or "12.1" + (androidVersion.Length() >= 2 && std::isdigit(androidVersion[0]) && + (androidVersion[1] == u'.' || std::isdigit(androidVersion[1])))); + + // Spoof version "Android 10" for Android OS versions < 10 to reduce their + // fingerprintable user information. For Android OS versions >= 10, report + // the real OS version because some enterprise websites only want to permit + // clients with recent OS version (like bug 1876742). Two leading digits + // in the version string means the version number is >= 10. + mPlatform += " "; + if (NS_SUCCEEDED(rv) && androidVersion.Length() >= 2 && + std::isdigit(androidVersion[0]) && std::isdigit(androidVersion[1])) { mPlatform += NS_LossyConvertUTF16toASCII(androidVersion); + } else { + mPlatform.AppendLiteral("10"); } // Add the `Mobile` or `TV` token when running on device. @@ -1350,11 +1447,6 @@ void nsHttpHandler::PrefsChanged(const char* pref) { if (NS_SUCCEEDED(rv)) mEnableAltSvcOE = cVar; } - if (PREF_CHANGED(HTTP_PREF("originextension"))) { - rv = Preferences::GetBool(HTTP_PREF("originextension"), &cVar); - if (NS_SUCCEEDED(rv)) mEnableOriginExtension = cVar; - } - if (PREF_CHANGED(HTTP_PREF("http2.push-allowance"))) { mSpdyPushAllowance = static_cast( clamped(StaticPrefs::network_http_http2_push_allowance(), 1024, @@ -1736,7 +1828,7 @@ void nsHttpHandler::PrefsChanged(const char* pref) { } if (userSetDocumentAcceptHeader.IsEmpty()) { - mDocumentAcceptHeader.Assign(DocumentAcceptHeader(mImageAcceptHeader)); + mDocumentAcceptHeader.Assign(DocumentAcceptHeader()); } else { mDocumentAcceptHeader.Assign(userSetDocumentAcceptHeader); } @@ -2204,12 +2296,8 @@ nsresult nsHttpHandler::SpeculativeConnectInternal( originAttributes = std::move(aOriginAttributes.ref()); } else if (aPrincipal) { originAttributes = aPrincipal->OriginAttributesRef(); - StoragePrincipalHelper::UpdateOriginAttributesForNetworkState( - aURI, originAttributes); } else if (loadContext) { loadContext->GetOriginAttributes(originAttributes); - StoragePrincipalHelper::UpdateOriginAttributesForNetworkState( - aURI, originAttributes); } nsCOMPtr clone; @@ -2222,6 +2310,15 @@ nsresult nsHttpHandler::SpeculativeConnectInternal( } } + if (!aOriginAttributes) { + // We must update the originAttributes with the network state first party + // domain **after** we upgrade aURI to https. + // Otherwise the speculative connection will be keyed by a http URL + // and end up not being used. + StoragePrincipalHelper::UpdateOriginAttributesForNetworkState( + aURI, originAttributes); + } + nsAutoCString scheme; nsresult rv = aURI->GetScheme(scheme); if (NS_FAILED(rv)) return rv; @@ -2254,7 +2351,7 @@ nsresult nsHttpHandler::SpeculativeConnectInternal( new nsHttpConnectionInfo(host, port, ""_ns, username, nullptr, originAttributes, aURI->SchemeIs("https")); ci->SetAnonymous(anonymous); - if (originAttributes.mPrivateBrowsingId > 0) { + if (originAttributes.IsPrivateBrowsing()) { ci->SetPrivate(true); } @@ -2464,11 +2561,10 @@ void nsHttpHandler::ShutdownConnectionManager() { nsresult nsHttpHandler::NewChannelId(uint64_t& channelId) { channelId = // channelId is sometimes passed to JavaScript code (e.g. devtools), - // and since on Linux PID_MAX_LIMIT is 2^22 we cannot - // shift PID more than 31 bits left. Otherwise resulting values - // will be exceed safe JavaScript integer range. - ((static_cast(mProcessId) << 31) & 0xFFFFFFFF80000000LL) | - mNextChannelId++; + // values should not exceed safe JavaScript integer range (2^53 – 1). + // Since the uniqueProcessId starts at 0, this should be safe to use + // unless we create more than 2^22 processes. + ((mUniqueProcessId << 31) & 0xFFFFFFFF80000000LL) | mNextChannelId++; return NS_OK; } @@ -2743,17 +2839,16 @@ void nsHttpHandler::MaybeAddAltSvcForTesting( } } -bool nsHttpHandler::UseHTTPSRRAsAltSvcEnabled() const { - return StaticPrefs::network_dns_use_https_rr_as_altsvc(); -} - bool nsHttpHandler::EchConfigEnabled(bool aIsHttp3) const { + if (sParentalControlsEnabled) { + return false; + } + if (!aIsHttp3) { return StaticPrefs::network_dns_echconfig_enabled(); } - return StaticPrefs::network_dns_echconfig_enabled() && - StaticPrefs::network_dns_http3_echconfig_enabled(); + return StaticPrefs::network_dns_http3_echconfig_enabled(); } bool nsHttpHandler::FallbackToOriginIfConfigsAreECHAndAllFailed() const { diff --git a/policies/policies.json b/policies/policies.json index 583f9eb..a436211 100644 --- a/policies/policies.json +++ b/policies/policies.json @@ -3,7 +3,7 @@ "HardwareAcceleration": true, "Extensions": { "Install": [ - "https://addons.mozilla.org/firefox/downloads/file/4121906/ublock_origin-1.57.2.xpi" + "https://addons.mozilla.org/firefox/downloads/file/4328681/ublock_origin-1.59.0.xpi" ], "Uninstall": [ "bing@search.mozilla.org", diff --git a/toolkit/moz.configure b/toolkit/moz.configure index c02981c..80d85e3 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -4,6 +4,100 @@ # 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/. +# App-specific project settings + + +project_flag( + env="MOZ_APP_ID", + nargs=1, + help='used for application.ini\'s "ID" field, and crash reporter server url', +) + + +@depends("MOZ_APP_ID", build_project) +def check_moz_app_id(moz_app_id, build_project): + if not moz_app_id: + die(f"No value for MOZ_APP_ID in project '{build_project}'") + + +project_flag( + env="MOZ_APP_VENDOR", + nargs=1, + help='used for application.ini\'s "Vendor" field, which also impacts profile location and user-visible fields', +) + +project_flag( + env="MOZ_APP_UA_NAME", + default="", + nargs=1, + help="application name in the User Agent string", +) + +project_flag( + env="MOZ_DEVTOOLS", + default="server", + choices=("all", "server"), + nargs=1, + help="which devtools version should be built", +) + + +option( + env="MOZ_STUB_INSTALLER", + help="produce a stub installer", +) +set_config("MOZ_STUB_INSTALLER", True, when="MOZ_STUB_INSTALLER") + + +project_flag( + env="MOZ_PROFILE_MIGRATOR", + help="enable profile migrator", +) + +project_flag( + env="BROWSER_CHROME_URL", + default="", + nargs=1, + set_as_define=True, + help="markup for a single browser window", +) +set_define( + "BROWSER_CHROME_URL_QUOTED", + depends("BROWSER_CHROME_URL")(lambda v: f'"{v[0]}"' if v else ""), +) + +# External builds (specifically Ubuntu) may drop the hg repo information, so we allow to +# explicitly set the repository and changeset information in. +option(env="MOZ_SOURCE_REPO", nargs=1, help="project source repository") +set_config("MOZ_SOURCE_REPO", depends_if("MOZ_SOURCE_REPO")(lambda src: src[0])) +option(env="MOZ_SOURCE_CHANGESET", nargs=1, help="source changeset") +set_config("MOZ_SOURCE_CHANGESET", depends_if("MOZ_SOURCE_CHANGESET")(lambda v: v[0])) + +option( + env="MOZ_INCLUDE_SOURCE_INFO", + # Build revisions should always be present in official builds + default=mozilla_official, + help="include build repository informations", +) +set_config("MOZ_INCLUDE_SOURCE_INFO", True, when="MOZ_INCLUDE_SOURCE_INFO") + +option( + "--with-distribution-id", + nargs=1, + default="org.mozilla", + help="Set distribution-specific id", +) +set_config("MOZ_DISTRIBUTION_ID", depends("--with-distribution-id")(lambda v: v[0])) +add_old_configure_assignment( + "MOZ_DISTRIBUTION_ID", depends("--with-distribution-id")(lambda v: v[0]) +) + + +@depends("MOZ_APP_VENDOR", build_project) +def check_moz_app_vendor(moz_app_vendor, build_project): + if not moz_app_vendor: + die(f"No value for MOZ_APP_VENDOR in project '{build_project}'") + # Set the MOZ_CONFIGURE_OPTIONS variable with all the options that # were passed somehow (environment, command line, mozconfig) @@ -114,6 +208,16 @@ set_config("MOZ_GECKO_PROFILER", gecko_profiler_define) set_define("MOZ_GECKO_PROFILER", gecko_profiler_define) +# Enable perfetto on Android if gecko profiling is enabled and only for +# nightly builds. Linux support requires at least linux-headers-3.18 for +set_config( + "MOZ_PERFETTO", gecko_profiler_define, when=target_is_android & milestone.is_nightly +) +set_define( + "MOZ_PERFETTO", gecko_profiler_define, when=target_is_android & milestone.is_nightly +) + + # Whether code to parse ELF binaries should be compiled for the Gecko profiler # (for symbol table dumping). @depends(gecko_profiler, target) @@ -319,19 +423,30 @@ def imply_wasapi(values, target): set_config("MOZ_AAUDIO", imply_aaudio, when="--enable-audio-backends") -imply_option("--enable-alsa", imply_alsa, reason="--enable-audio-backends") +imply_option( + "--enable-alsa", imply_alsa, reason="--enable-audio-backends", when=use_pkg_config +) set_config("MOZ_AUDIOUNIT_RUST", imply_audiounit, when="--enable-audio-backends") -imply_option("--enable-jack", imply_jack, reason="--enable-audio-backends") +imply_option( + "--enable-jack", imply_jack, reason="--enable-audio-backends", when=use_pkg_config +) set_config("MOZ_OPENSL", imply_opensl, when="--enable-audio-backends") set_config("MOZ_OSS", imply_oss, when="--enable-audio-backends") -imply_option("--enable-pulseaudio", imply_pulseaudio, reason="--enable-audio-backends") +imply_option( + "--enable-pulseaudio", + imply_pulseaudio, + reason="--enable-audio-backends", + when=use_pkg_config, +) -imply_option("--enable-sndio", imply_sndio, reason="--enable-audio-backends") +imply_option( + "--enable-sndio", imply_sndio, reason="--enable-audio-backends", when=use_pkg_config +) set_config("MOZ_SUNAUDIO", imply_sunaudio, when="--enable-audio-backends") @@ -339,10 +454,20 @@ set_config("MOZ_WASAPI", imply_wasapi, when="--enable-audio-backends") # ALSA cubeb backend # ============================================================== -option("--enable-alsa", env="MOZ_ALSA", help="Enable ALSA audio backend.") +option( + "--enable-alsa", + env="MOZ_ALSA", + help="Enable ALSA audio backend.", + when=use_pkg_config, +) + +@depends("--enable-alsa", when=use_pkg_config) +def enable_alsa_option(enable_alsa): + return enable_alsa -@depends("--enable-alsa", midir_linux_support) + +@depends(enable_alsa_option, midir_linux_support) def enable_alsa_or_midir_linux_support(alsa_enabled, midir_linux_support): return alsa_enabled or midir_linux_support @@ -354,7 +479,12 @@ set_define("MOZ_ALSA", True, when="--enable-alsa") # JACK cubeb backend # ============================================================== -system_lib_option("--enable-jack", env="MOZ_JACK", help="Enable JACK audio backend.") +system_lib_option( + "--enable-jack", + env="MOZ_JACK", + help="Enable JACK audio backend.", + when=use_pkg_config, +) jack = pkg_check_modules("MOZ_JACK", "jack", when="--enable-jack") @@ -366,6 +496,7 @@ option( "--enable-pulseaudio", env="MOZ_PULSEAUDIO", help="{Enable|Disable} PulseAudio audio backend.", + when=use_pkg_config, ) pulseaudio = pkg_check_modules("MOZ_PULSEAUDIO", "libpulse", when="--enable-pulseaudio") @@ -375,7 +506,12 @@ set_define("MOZ_PULSEAUDIO", depends_if(pulseaudio)(lambda _: True)) # sndio cubeb backend # ============================================================== -system_lib_option("--enable-sndio", env="MOZ_SNDIO", help="Enable sndio audio backend.") +system_lib_option( + "--enable-sndio", + env="MOZ_SNDIO", + help="Enable sndio audio backend.", + when=use_pkg_config, +) sndio = pkg_check_modules("MOZ_SNDIO", "sndio", when="--enable-sndio") @@ -961,11 +1097,49 @@ project_flag( project_flag("MOZ_SERVICES_SYNC", help="Build Sync Services if required") project_flag( - "MOZ_ANDROID_HISTORY", - help="Enable Android History instead of Places", + "MOZ_GECKOVIEW_HISTORY", + help="Enable Geckoview History instead of Places", set_as_define=True, ) + +# Child Process Name for IPC +# ============================================================== +@depends(toolkit, bin_suffix(target)) +def moz_child_process_name(toolkit, bin_suffix): + if toolkit != "android": + return f"plugin-container{bin_suffix}" + else: + # We want to let Android unpack the file at install time, but it only + # does so if the file is named libsomething.so. The lib/ path is also + # required because the unpacked file will be under the lib/ subdirectory + # and will need to be executed from that path. + return "libplugin-container.so" + + +set_config("MOZ_CHILD_PROCESS_NAME", moz_child_process_name) + +with only_when(target_is_osx): + set_config("MOZ_CHILD_PROCESS_BUNDLE", "plugin-container.app/Contents/MacOS/") + set_config( + "MOZ_CHILD_PROCESS_BUNDLEID", + depends("--with-distribution-id")(lambda v: f"{v[0]}.plugincontainer"), + ) + set_config("MOZ_CHILD_PROCESS_BUNDLENAME", "plugin-container.app") + +# Profile Management +# ============================================================== +# Selectable profiles are temporarily gated behind a build flag +# while we build and stabilize the backend (bug 1893315). + +option( + env="MOZ_SELECTABLE_PROFILES", + help="Enable experimental and unstable profile groups", +) + +set_define("MOZ_SELECTABLE_PROFILES", True, when="MOZ_SELECTABLE_PROFILES") +set_config("MOZ_SELECTABLE_PROFILES", True, when="MOZ_SELECTABLE_PROFILES") + project_flag( "MOZ_DEDICATED_PROFILES", help="Enable dedicated profiles per install", @@ -979,12 +1153,12 @@ project_flag( ) -@depends("MOZ_PLACES", "MOZ_ANDROID_HISTORY") -def check_places_and_android_history(places, android_history): - if places and android_history: - die("Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.") - if not places and not android_history: - die("One of MOZ_ANDROID_HISTORY or MOZ_PLACES must be set.") +@depends("MOZ_PLACES", "MOZ_GECKOVIEW_HISTORY") +def check_places_and_geckoview_history(places, geckoview_history): + if places and geckoview_history: + die("Cannot use MOZ_GECKOVIEW_HISTORY alongside MOZ_PLACES.") + if not places and not geckoview_history: + die("One of MOZ_GECKOVIEW_HISTORY or MOZ_PLACES must be set.") option( @@ -1006,10 +1180,15 @@ set_define("MOZ_TELEMETRY_ON_BY_DEFAULT", True, when=telemetry_on_by_default) # gpsd support # ============================================================== -system_lib_option("--enable-gpsd", env="MOZ_GPSD", help="Enable gpsd support") +system_lib_option( + "--enable-gpsd", + env="MOZ_GPSD", + help="Enable gpsd support", + when=use_pkg_config, +) -@depends("--enable-gpsd") +@depends("--enable-gpsd", when=use_pkg_config) def gpsd(value): return bool(value) @@ -1168,7 +1347,9 @@ set_config( ) system_lib_option( - "--with-system-webp", help="Use system libwebp (located with pkgconfig)" + "--with-system-webp", + help="Use system libwebp (located with pkgconfig)", + when=use_pkg_config, ) system_webp = pkg_check_modules( @@ -1394,7 +1575,6 @@ option( help="{Enable|Disable} support for RAW media", ) -set_config("MOZ_RAW", depends_if("--enable-raw")(lambda _: True)) set_define("MOZ_RAW", depends_if("--enable-raw")(lambda _: True)) @@ -1423,16 +1603,32 @@ def x11_libs(webrtc): return libs -x11_headers = pkg_check_modules( +x11 = pkg_check_modules( "MOZ_X11", x11_libs, allow_missing=toolkit_gtk_x11_optional, when=toolkit_gtk_x11, + config=False, # set after the OpenBSD hook below ) -set_config("MOZ_X11", True, when=x11_headers) -set_define("MOZ_X11", True, when=x11_headers) +@depends(x11, target_is_openbsd) +def moz_x11_libs(x11, target_is_openbsd): + if not x11: + return [] + if target_is_openbsd: + rpath = tuple( + f"-Wl,-rpath-link,{flag[2:]}" for flag in x11.libs if flag.startswith("-L") + ) + else: + rpath = () + return x11.libs + rpath + + +set_config("MOZ_X11_CFLAGS", x11.cflags) +set_config("MOZ_X11_LIBS", moz_x11_libs) +set_config("MOZ_X11", True, when=x11) +set_define("MOZ_X11", True, when=x11) pkg_check_modules( "MOZ_X11_SM", @@ -1541,7 +1737,6 @@ with only_when("--enable-compile-environment"): @checking("for -z pack-relative-relocs option to ld", bool) @imports(_from="__builtin__", _import="FileNotFoundError") @imports("os") - @imports(_from="tempfile", _import="mkstemp") @imports("textwrap") def has_pack_relative_relocs( c_compiler, @@ -1549,10 +1744,7 @@ with only_when("--enable-compile-environment"): linker_ldflags, readelf, ): - try: - fd, path = mkstemp(prefix="conftest.") - os.close(fd) - + with create_temporary_file(suffix=".out") as path: pack_rel_relocs = ["-Wl,-z,pack-relative-relocs"] if ( try_invoke_compiler( @@ -1597,11 +1789,6 @@ with only_when("--enable-compile-environment"): return pack_rel_relocs else: return pack_rel_relocs - finally: - try: - os.remove(path) - except FileNotFoundError: - pass @depends( has_pack_relative_relocs, @@ -1627,8 +1814,6 @@ with only_when("--enable-compile-environment"): if may_use_pack_relative_relocs: return flags - add_old_configure_assignment("PACK_REL_RELOC_FLAGS", pack_relative_relocs_flags) - @depends( select_linker, pack_relative_relocs_flags, @@ -2129,9 +2314,15 @@ with only_when(compile_environment): with only_when(compile_environment): system_lib_option( - "--with-system-libvpx", help="Use system libvpx (located with pkgconfig)" + "--with-system-libvpx", + help="Use system libvpx (located with pkgconfig)", + when=use_pkg_config, ) + @depends("--with-system-libvpx", when=use_pkg_config) + def with_system_libvpx_option(with_system_libvpx): + return with_system_libvpx + with only_when("--with-system-libvpx"): vpx = pkg_check_modules("MOZ_LIBVPX", "vpx >= 1.10.0") @@ -2156,7 +2347,7 @@ with only_when(compile_environment): set_config("MOZ_SYSTEM_LIBVPX", True) - @depends("--with-system-libvpx", target) + @depends(with_system_libvpx_option, target) def in_tree_vpx(system_libvpx, target): if system_libvpx: return @@ -2359,6 +2550,8 @@ with only_when(compile_environment): & jpeg_arm_neon_vld1q_u8_x4, ) + set_config("MOZ_SYSTEM_JPEG", True, when="--with-system-jpeg") + # PNG # === @@ -2367,9 +2560,10 @@ with only_when(compile_environment): "--with-system-png", nargs="?", help="Use system libpng", + when=use_pkg_config, ) - @depends("--with-system-png") + @depends("--with-system-png", when=use_pkg_config) def deprecated_system_png_path(value): if len(value) == 1: die( @@ -3067,9 +3261,10 @@ with only_when(compile_environment): "--with-system-libevent", nargs="?", help="Use system libevent", + when=use_pkg_config, ) - @depends("--with-system-libevent") + @depends("--with-system-libevent", when=use_pkg_config) def deprecated_system_libevent_path(value): if len(value) == 1: die( @@ -3112,17 +3307,6 @@ with only_when(compile_environment): when=depends(target)(lambda t: t.os == "GNU" and t.kernel == "Linux"), ) - set_config( - "MOZ_CRASHREPORTER_INJECTOR", - True, - when=depends(target)(lambda t: t.os == "WINNT" and t.bitness == 32), - ) - set_define( - "MOZ_CRASHREPORTER_INJECTOR", - True, - when=depends(target)(lambda t: t.os == "WINNT" and t.bitness == 32), - ) - # If we have any service that uploads data (and requires data submission # policy alert), set MOZ_DATA_REPORTING. @@ -3162,9 +3346,13 @@ with only_when(toolkit_gtk): # DBus # ============================================================== with only_when(toolkit_gtk): - option("--disable-dbus", help="Disable dbus support") + option("--disable-dbus", help="Disable dbus support", when=use_pkg_config) - with only_when("--enable-dbus"): + @depends("--enable-dbus", when=use_pkg_config) + def enable_dbus_option(enable_dbus): + return enable_dbus + + with only_when(enable_dbus_option): pkg_check_modules("MOZ_DBUS", "dbus-1 >= 0.60") set_config("MOZ_ENABLE_DBUS", True) @@ -3188,8 +3376,9 @@ set_define("NECKO_WIFI", True, when="--enable-necko-wifi") @depends( depends("--enable-necko-wifi", when=necko_wifi_when)(lambda x: x), - depends("--enable-dbus", when=toolkit_gtk)(lambda x: x), - when=depends(target)(lambda t: t.os == "GNU" and t.kernel == "Linux"), + depends(enable_dbus_option, when=toolkit_gtk)(lambda x: x), + when=use_pkg_config + & depends(target)(lambda t: t.os == "GNU" and t.kernel == "Linux"), ) def necko_wifi_dbus(necko_wifi, dbus): if necko_wifi and not dbus: @@ -3228,7 +3417,11 @@ set_define("MOZ_LAYERS_HAVE_LOG", True, when="--enable-dump-painting") # libproxy support # ============================================================== with only_when(toolkit_gtk): - system_lib_option("--enable-libproxy", help="Enable libproxy support") + system_lib_option( + "--enable-libproxy", + help="Enable libproxy support", + when=use_pkg_config, + ) with only_when("--enable-libproxy"): pkg_check_modules("MOZ_LIBPROXY", "libproxy-1.0") @@ -3276,6 +3469,47 @@ set_define( when=depends("--enable-parental-controls")(lambda x: not x), ) +# Automation renaming +# ============================================================== + +with only_when("MOZ_AUTOMATION"): + option(env="MOZ_SIMPLE_PACKAGE_NAME", nargs=1, help="Package name override") + set_config( + "MOZ_SIMPLE_PACKAGE_NAME", depends_if("MOZ_SIMPLE_PACKAGE_NAME")(lambda x: x[0]) + ) + option(env="MOZ_PKG_SPECIAL", nargs=1, help="Name of special moz flavor") + set_config("MOZ_PKG_SPECIAL", depends_if("MOZ_PKG_SPECIAL")(lambda x: x[0])) + + +# OSX Packaging +# ============================================================== + +with only_when(target_is_osx): + option( + "--with-macbundlename-prefix", + nargs=1, + help="prefix for the mac bundle name", + ) + + @depends_if("--with-macbundlename-prefix") + def mac_bundle_name(value): + return value[0] + + add_old_configure_assignment("MOZ_MACBUNDLE_NAME_PREFIX", mac_bundle_name) + + option(env="DMG_TOOL", nargs=1, help="Path to the dmg tool") + set_config("DMG_TOOL", depends_if("DMG_TOOL")(lambda x: x[0])) + + +# JS Packaging +# ============================================================== + +option( + env="MOZ_PACKAGE_JSSHELL", + help="whether the installer bundles the JS shell", +) +set_config("MOZ_PACKAGE_JSSHELL", depends_if("MOZ_PACKAGE_JSSHELL")(lambda x: bool(x))) + # Sandboxing support # ============================================================== @@ -3321,17 +3555,23 @@ set_define("ENABLE_SYSTEM_EXTENSION_DIRS", True, when="--enable-system-extension # ============================================================== with only_when(compile_environment): system_lib_option( - "--enable-system-pixman", help="Use system pixman (located with pkgconfig)" + "--enable-system-pixman", + help="Use system pixman (located with pkgconfig)", + when=use_pkg_config, ) - @depends("--enable-system-pixman") + @depends("--enable-system-pixman", when=use_pkg_config) + def enable_system_pixman_option(enable_system_pixman): + return enable_system_pixman + + @depends(enable_system_pixman_option) def in_tree_pixman(pixman): return not pixman set_config("MOZ_TREE_PIXMAN", True, when=in_tree_pixman) set_define("MOZ_TREE_PIXMAN", True, when=in_tree_pixman) - pkg_check_modules("MOZ_PIXMAN", "pixman-1 >= 0.36.0", when="--enable-system-pixman") + pkg_check_modules("MOZ_PIXMAN", "pixman-1 >= 0.40.0", when="--enable-system-pixman") # Set MOZ_PIXMAN_CFLAGS to an explicit empty value when --enable-system-pixman is *not* used, # for layout/style/extra-bindgen-flags set_config("MOZ_PIXMAN_CFLAGS", [], when=in_tree_pixman) @@ -3437,9 +3677,12 @@ with only_when(target_has_linux_kernel & compile_environment): set_config("MOZ_LINKER", True, when="MOZ_LINKER") set_define("MOZ_LINKER", True, when="MOZ_LINKER") - add_old_configure_assignment("MOZ_LINKER", True, when="MOZ_LINKER") - moz_linker = depends(when="MOZ_LINKER")(lambda: True) + # gold emits wrong sysv-style elf hash tables when building both sysv and + # GNU style tables. https://sourceware.org/bugzilla/show_bug.cgi?id=13597 + # Since the linker only understands the sysv ones, no need to build the + # GNU style tables anyways. + check_and_add_linker_flag("-Wl,--hash-style=sysv", when="MOZ_LINKER") # 32-bits ethtool_cmd.speed diff --git a/trunk.sh b/version.sh similarity index 95% rename from trunk.sh rename to version.sh index ef1794b..31e2da5 100755 --- a/trunk.sh +++ b/version.sh @@ -39,7 +39,7 @@ printf "${bold}${GRE}Script to Rebase/Sync Mozilla repo.${c0}\n" && printf "\n" && printf "${YEL}Rebasing/Syncing with mozilla-unified Mercurial repository...${c0}\n" && -MERCURY_BRANCH="release" +MERCURY_BRANCH="c6f0209c79239408bef9b3c98e9c729dcf20ec0c" export MERCURY_BRANCH && cd ${HG_SRC_DIR} &&