diff --git a/arm/build/config/compiler/BUILD.gn b/arm/build/config/compiler/BUILD.gn index 85d8f8e3..103a090b 100644 --- a/arm/build/config/compiler/BUILD.gn +++ b/arm/build/config/compiler/BUILD.gn @@ -2232,6 +2232,9 @@ config("no_chromium_code") { # third-party libraries. "-Wno-c++11-narrowing", ] + if (is_full_optimization_build) { + cflags += [ "-Xclang", "-O3" ] + } if (!is_nacl) { cflags += [ # Disabled for similar reasons as -Wunused-variable. diff --git a/infra/thor_ver_linux/wrapper-avx2 b/other/thor_ver_linux/wrapper-avx2 similarity index 100% rename from infra/thor_ver_linux/wrapper-avx2 rename to other/thor_ver_linux/wrapper-avx2 diff --git a/infra/thor_ver_linux/wrapper-avx512 b/other/thor_ver_linux/wrapper-avx512 similarity index 100% rename from infra/thor_ver_linux/wrapper-avx512 rename to other/thor_ver_linux/wrapper-avx512 diff --git a/other/thor_ver_linux/wrapper-raspi b/other/thor_ver_linux/wrapper-raspi new file mode 100644 index 00000000..5497e34f --- /dev/null +++ b/other/thor_ver_linux/wrapper-raspi @@ -0,0 +1,130 @@ +#!/bin/bash +# +# Copyright 2024 The Chromium Authors, the AUR, and Alex313031 +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +# Let the wrapped binary know that it has been run through the wrapper. +export CHROME_WRAPPER="`readlink -f "$0"`" + +HERE="`dirname "$CHROME_WRAPPER"`" + +# We include some xdg utilities next to the binary, and we want to prefer them +# over the system versions when we know the system versions are very old. We +# detect whether the system xdg utilities are sufficiently new to be likely to +# work for us by looking for xdg-settings. If we find it, we leave $PATH alone, +# so that the system xdg utilities (including any distro patches) will be used. +if ! command -v xdg-settings &> /dev/null; then + # Old xdg utilities. Prepend $HERE to $PATH to use ours instead. + export PATH="$HERE:$PATH" +else + # Use system xdg utilities. But first create mimeapps.list if it doesn't + # exist; some systems have bugs in xdg-mime that make it fail without it. + xdg_app_dir="${XDG_DATA_HOME:-$HOME/.local/share/applications}" + mkdir -p "$xdg_app_dir" + [ -f "$xdg_app_dir/mimeapps.list" ] || touch "$xdg_app_dir/mimeapps.list" +fi + +# Always use our versions of ffmpeg libs. +# This also makes RPMs find the compatibly-named library symlinks. +if [[ -n "$LD_LIBRARY_PATH" ]]; then + LD_LIBRARY_PATH="$HERE/lib:$LD_LIBRARY_PATH" +else + LD_LIBRARY_PATH="$HERE/lib" +fi +export LD_LIBRARY_PATH + +# Clean up old crash reports (see https://bugs.debian.org/1015931) +# after 30 days. +find "$HOME/.config/thorium/Crash Reports/pending/" -mtime +30 \ + \( -name "*.meta" -o -name "*.dmp" \) -exec rm \{\} \; + +# APPNAME for GTK. +APPNAME=thorium + +# Set DESKTOP variable +# DESKTOP="thorium-browser" + +# Set XDG Title variable +TITLE="Thorium Browser" + +# Set the correct file name for the desktop file +export CHROME_DESKTOP="thorium-browser.desktop" + +# Set CHROME_VERSION_EXTRA text, which is displayed in the About dialog on chrome://help +# DIST=`cat /etc/debian_version` +export CHROME_VERSION_EXTRA="@@CHANNEL@@, built on Ubuntu (arm64)" + +# We don't want bug-buddy intercepting our crashes. http://crbug.com/24120 +export GNOME_DISABLE_CRASH_DIALOG=SET_BY_THORIUM + +# Set config home. +XDG_CONFIG_HOME=${XDG_CONFIG_HOME:-~/.config} + +usage () { + echo "thorium-browser [-h|--help] [--temp-profile] [options] [URL]" + echo + echo " -h, -help, or --help This help screen" + echo " --temp-profile Start with a new and temporary profile" + echo " --safe-mode Disable all chrome://flags flags" + echo + echo " Other supported options are:" + MANWIDTH=80 man thorium-browser | sed -e '1,/OPTIONS/d; /ENVIRONMENT/,$d' + echo " See 'man thorium-browser' for more details" +} + +want_temp_profile=0 +is_safe_mode=0 +while [ $# -gt 0 ]; do + case "$1" in + -h | --h | -help | --help ) + usage + exit 0 ;; + --temp-profile ) + want_temp_profile=1 + shift ;; + --safe-mode ) + is_safe_mode=1 + shift ;; + -- ) # Stop option processing + shift + break ;; + * ) # Else + break ;; + esac +done + +# Allow users to override command-line options with a file. +if [[ -f $XDG_CONFIG_HOME/thorium/thorium-flags.conf ]]; then + CHROME_USER_FLAGS="$(cat $XDG_CONFIG_HOME/thorium/thorium-flags.conf)" +fi + +# Sanitize std{in,out,err} because they'll be shared with untrusted child +# processes (http://crbug.com/376567). +exec < /dev/null +exec > >(exec cat) +exec 2> >(exec cat >&2) + +if [ $want_temp_profile -eq 1 ] ; then + TEMP_PROFILE=`mktemp -d` + echo "Using temporary profile: $TEMP_PROFILE" + PROFILE="$TEMP_PROFILE" + CACHE="$TEMP_PROFILE/cache" + export PROFILE + export CACHE + CHROME_USER_FLAGS="$CHROME_USER_FLAGS --user-data-dir=$TEMP_PROFILE --disk-cache-dir=$CACHE" +else + PROFILE="$XDG_CONFIG_HOME/thorium" + CACHE="$XDG_CONFIG_HOME/thorium" + export PROFILE + export CACHE + CHROME_USER_FLAGS="$CHROME_USER_FLAGS" +fi + +if [ $is_safe_mode -eq 1 ] ; then + CHROME_USER_FLAGS="$CHROME_USER_FLAGS --no-experiments" +fi + +# Launch Thorium +# Note: exec -a below is a bashism. +exec -a "$0" "$HERE/@@PROGNAME@@" "$CHROME_USER_FLAGS" "$@" diff --git a/infra/thor_ver_linux/wrapper-sse2 b/other/thor_ver_linux/wrapper-sse2 similarity index 100% rename from infra/thor_ver_linux/wrapper-sse2 rename to other/thor_ver_linux/wrapper-sse2 diff --git a/infra/thor_ver_linux/wrapper-sse3 b/other/thor_ver_linux/wrapper-sse3 similarity index 100% rename from infra/thor_ver_linux/wrapper-sse3 rename to other/thor_ver_linux/wrapper-sse3 diff --git a/infra/thor_ver_linux/wrapper-sse4 b/other/thor_ver_linux/wrapper-sse4 similarity index 100% rename from infra/thor_ver_linux/wrapper-sse4 rename to other/thor_ver_linux/wrapper-sse4 diff --git a/other/thorium-2024-ui.patch b/other/thorium-2024-ui.patch index 00ee6ee4..7ebe086b 100644 --- a/other/thorium-2024-ui.patch +++ b/other/thorium-2024-ui.patch @@ -1651,7 +1651,7 @@ new file mode 100644 index 0000000000000..04703d70ecf9b --- /dev/null +++ b/chrome/browser/ui/views/frame/window_caption_util.cc -@@ -0,0 +1,24 @@ +@@ -0,0 +1,26 @@ +// Copyright 2024 The Chromium Authors and Alex313031 +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. @@ -1670,8 +1670,10 @@ index 0000000000000..04703d70ecf9b + base::CommandLine::ForCurrentProcess()->HasSwitch("remove-tabsearch-button"); + static const bool disable_caption_button = + base::CommandLine::ForCurrentProcess()->HasSwitch("disable-caption-button"); ++ static const bool left_aligned_tab_search_button = ++ base::CommandLine::ForCurrentProcess()->HasSwitch("left-aligned-tab-search-button"); + return features::IsThorium2024() && browser->is_type_normal() && -+ !remove_tabsearch_button && !disable_caption_button; ++ !remove_tabsearch_button && !disable_caption_button && !left_aligned_tab_search_button; +#else + return false; +#endif // BUILDFLAG(IS_WIN) diff --git a/setup.sh b/setup.sh index 9d0c51cc..25792dc4 100755 --- a/setup.sh +++ b/setup.sh @@ -173,6 +173,7 @@ copyRaspi () { cp -r -v arm/build/* ${CR_SRC_DIR}/build/ && cp -r -v arm/third_party/* ${CR_SRC_DIR}/third_party/ && cp -r -v arm/raspi/* ${CR_SRC_DIR}/ && + cp -v other/thor_ver_linux/wrapper-raspi ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && cp -v pak_src/binaries/pak_arm64 ${CR_SRC_DIR}/out/thorium/pak && #./infra/fix_libaom.sh && printf "\n" && @@ -211,7 +212,7 @@ copyAVX512 () { printf "${YEL}Copying AVX-512 build files...${c0}\n" && cp -r -v other/AVX2/third_party/* ${CR_SRC_DIR}/third_party/ && cp -v other/AVX512/thor_ver ${CR_SRC_DIR}/out/thorium/ && - cp -v infra/thor_ver_linux/wrapper-avx512 ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && + cp -v other/thor_ver_linux/wrapper-avx512 ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && [ -f ${CR_SRC_DIR}/third_party/ffmpeg/ffmpeg_hevc_ac3.patch ] || patchAC3; printf "\n" } @@ -225,7 +226,7 @@ copyAVX2 () { printf "${YEL}Copying AVX2 build files...${c0}\n" && cp -r -v other/AVX2/third_party/* ${CR_SRC_DIR}/third_party/ && cp -v other/AVX2/thor_ver ${CR_SRC_DIR}/out/thorium/ && - cp -v infra/thor_ver_linux/wrapper-avx2 ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && + cp -v other/thor_ver_linux/wrapper-avx2 ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && [ -f ${CR_SRC_DIR}/third_party/ffmpeg/ffmpeg_hevc_ac3.patch ] || patchAC3; printf "\n" } @@ -238,7 +239,7 @@ copySSE4 () { printf "\n" && printf "${YEL}Copying SSE4.1 build files...${c0}\n" && cp -v other/SSE4.1/thor_ver ${CR_SRC_DIR}/out/thorium/ && - cp -v infra/thor_ver_linux/wrapper-sse4 ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && + cp -v other/thor_ver_linux/wrapper-sse4 ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && [ -f ${CR_SRC_DIR}/third_party/ffmpeg/ffmpeg_hevc_ac3.patch ] || patchAC3; printf "\n" } @@ -251,7 +252,7 @@ copySSE3 () { printf "\n" && printf "${YEL}Copying SSE3 build files...${c0}\n" && cp -v other/SSE3/thor_ver ${CR_SRC_DIR}/out/thorium/ && - cp -v infra/thor_ver_linux/wrapper-sse3 ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && + cp -v other/thor_ver_linux/wrapper-sse3 ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && cd ${CR_SRC_DIR} && python3 tools/update_pgo_profiles.py --target=win32 update --gs-url-base=chromium-optimization-profiles/pgo_profiles && cd ~/thorium && @@ -267,7 +268,7 @@ copySSE2 () { printf "\n" && printf "${YEL}Copying SSE2 (32-bit) build files...${c0}\n" && cp -v other/SSE2/thor_ver ${CR_SRC_DIR}/out/thorium/ && - cp -v infra/thor_ver_linux/wrapper-sse2 ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && + cp -v other/thor_ver_linux/wrapper-sse2 ${CR_SRC_DIR}/chrome/installer/linux/common/wrapper && cd ${CR_SRC_DIR} && python3 tools/update_pgo_profiles.py --target=win32 update --gs-url-base=chromium-optimization-profiles/pgo_profiles && cd ~/thorium && diff --git a/src/build/config/compiler/BUILD.gn b/src/build/config/compiler/BUILD.gn index 5d072b6b..a1b04b57 100644 --- a/src/build/config/compiler/BUILD.gn +++ b/src/build/config/compiler/BUILD.gn @@ -2331,6 +2331,9 @@ config("no_chromium_code") { # third-party libraries. "-Wno-c++11-narrowing", ] + if (is_full_optimization_build) { + cflags += [ "-Xclang", "-O3" ] + } if (!is_nacl) { cflags += [ # Disabled for similar reasons as -Wunused-variable. diff --git a/src/chrome/browser/ui/ui_features.cc b/src/chrome/browser/ui/ui_features.cc index 0deedcbe..88a3f6e4 100644 --- a/src/chrome/browser/ui/ui_features.cc +++ b/src/chrome/browser/ui/ui_features.cc @@ -104,11 +104,6 @@ BASE_FEATURE(kAccessCodeCastUI, base::FEATURE_ENABLED_BY_DEFAULT); #endif -// Enables showing the EV certificate details in the Page Info bubble. -BASE_FEATURE(kEvDetailsInPageInfo, - "EvDetailsInPageInfo", - base::FEATURE_ENABLED_BY_DEFAULT); - #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) // Enables the feature to remove the last confirmation dialog when relaunching // to update Chrome. @@ -118,11 +113,6 @@ BASE_FEATURE(kFewerUpdateConfirmations, #endif #if !BUILDFLAG(IS_ANDROID) && BUILDFLAG(GOOGLE_CHROME_BRANDING) -// Enables showing the "Get the most out of Chrome" section in settings. -BASE_FEATURE(kGetTheMostOutOfChrome, - "GetTheMostOutOfChrome", - base::FEATURE_DISABLED_BY_DEFAULT); - // This feature controls whether the user can be shown the Chrome for iOS promo // when saving or updating passwords. BASE_FEATURE(kIOSPromoRefreshedPasswordBubble, @@ -187,6 +177,7 @@ BASE_FEATURE(kLightweightExtensionOverrideConfirmations, BASE_FEATURE(kPreloadTopChromeWebUI, "PreloadTopChromeWebUI", base::FEATURE_DISABLED_BY_DEFAULT); + const char kPreloadTopChromeWebUIModeName[] = "preload-mode"; const char kPreloadTopChromeWebUIModePreloadOnWarmupName[] = "preload-on-warmup"; @@ -203,16 +194,26 @@ const base::FeatureParam kPreloadTopChromeWebUIMode{ &kPreloadTopChromeWebUI, kPreloadTopChromeWebUIModeName, PreloadTopChromeWebUIMode::kPreloadOnMakeContents, &kPreloadTopChromeWebUIModeOptions}; + const char kPreloadTopChromeWebUISmartPreloadName[] = "smart-preload"; const base::FeatureParam kPreloadTopChromeWebUISmartPreload{ &kPreloadTopChromeWebUI, kPreloadTopChromeWebUISmartPreloadName, false}; +const char kPreloadTopChromeWebUIDelayPreloadName[] = "delay-preload"; +const base::FeatureParam kPreloadTopChromeWebUIDelayPreload{ + &kPreloadTopChromeWebUI, kPreloadTopChromeWebUIDelayPreloadName, false}; + +const char kPreloadTopChromeWebUIExcludeOriginsName[] = "exclude-origins"; +const base::FeatureParam kPreloadTopChromeWebUIExcludeOrigins{ + &kPreloadTopChromeWebUI, kPreloadTopChromeWebUIExcludeOriginsName, ""}; + // Enables exiting browser fullscreen (users putting the browser itself into the // fullscreen mode via the browser UI or shortcuts) with press-and-hold Esc. #if !BUILDFLAG(IS_ANDROID) BASE_FEATURE(kPressAndHoldEscToExitBrowserFullscreen, "PressAndHoldEscToExitBrowserFullscreen", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT +); #endif // Enable responsive toolbar. Toolbar buttons overflow to a chevron button when @@ -266,6 +267,10 @@ BASE_FEATURE(kSidePanelResizing, "SidePanelResizing", base::FEATURE_DISABLED_BY_DEFAULT); +BASE_FEATURE(kTabDuplicateMetrics, + "TabDuplicateMetrics", + base::FEATURE_ENABLED_BY_DEFAULT); + // Enables buttons when scrolling the tabstrip https://crbug.com/951078 BASE_FEATURE(kTabScrollingButtonPosition, "TabScrollingButtonPosition", @@ -301,12 +306,20 @@ const char kTabHoverCardAdditionalMaxWidthDelay[] = BASE_FEATURE(kTabOrganization, "TabOrganization", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); bool IsTabOrganization() { return base::FeatureList::IsEnabled(features::kTabOrganization); } +BASE_FEATURE(kTabstripDeclutter, + "TabstripDeclutter", + base::FEATURE_DISABLED_BY_DEFAULT); + +bool IsTabstripDeclutterEnabled() { + return base::FeatureList::IsEnabled(features::kTabstripDeclutter); +} + BASE_FEATURE(kMultiTabOrganization, "MultiTabOrganization", base::FEATURE_DISABLED_BY_DEFAULT); @@ -323,6 +336,14 @@ BASE_FEATURE(kTabReorganizationDivider, "TabReorganizationDivider", base::FEATURE_DISABLED_BY_DEFAULT); +BASE_FEATURE(kTabOrganizationModelStrategy, + "TabOrganizationModelStrategy", + base::FEATURE_DISABLED_BY_DEFAULT); + +BASE_FEATURE(kTabOrganizationEnableNudgeForEnterprise, + "TabOrganizationEnableNudgeForEnterprise", + base::FEATURE_DISABLED_BY_DEFAULT); + const base::FeatureParam kTabOrganizationTriggerPeriod{ &kTabOrganization, "trigger_period", base::Hours(6)}; @@ -338,6 +359,7 @@ const base::FeatureParam kTabOrganizationTriggerSensitivityThreshold{ const base::FeatureParam KTabOrganizationTriggerDemoMode{ &kTabOrganization, "trigger_demo_mode", false}; +// Alex313031: Investigate BASE_FEATURE(kTabSearchChevronIcon, "TabSearchChevronIcon", base::FEATURE_ENABLED_BY_DEFAULT); @@ -347,8 +369,6 @@ BASE_FEATURE(kTabSearchFeedback, "TabSearchFeedback", base::FEATURE_DISABLED_BY_DEFAULT); - - // Controls feature parameters for Tab Search's `Recently Closed` entries. BASE_FEATURE(kTabSearchRecentlyClosed, "TabSearchRecentlyClosed", @@ -401,19 +421,19 @@ BASE_FEATURE(kEnterpriseProfileBadging, "EnterpriseProfileBadging", base::FEATURE_ENABLED_BY_DEFAULT); -// Enables the management button on the toolbar. +// Enables the management button on the toolbar for all managed browsers. BASE_FEATURE(kManagementToolbarButton, "ManagementToolbarButton", base::FEATURE_DISABLED_BY_DEFAULT); -BASE_FEATURE(kEnterpriseUpdatedProfileCreationScreen, - "EnterpriseUpdatedProfileCreationScreen", +// Enables the management button on the toolbar by default for browser managed +// by trusted sources. +BASE_FEATURE(kManagementToolbarButtonForTrustedManagementSources, + "ManagementToolbarButtonForTrustedManagementSources", base::FEATURE_DISABLED_BY_DEFAULT); -// This enables enables persistence of a WebContents in a 1-to-1 association -// with the current Profile for WebUI bubbles. See https://crbug.com/1177048. -BASE_FEATURE(kWebUIBubblePerProfilePersistence, - "WebUIBubblePerProfilePersistence", +BASE_FEATURE(kEnterpriseUpdatedProfileCreationScreen, + "EnterpriseUpdatedProfileCreationScreen", base::FEATURE_DISABLED_BY_DEFAULT); // Enables a web-based tab strip. See https://crbug.com/989131. Note this @@ -423,7 +443,8 @@ BASE_FEATURE(kWebUITabStrip, #if BUILDFLAG(IS_CHROMEOS) base::FEATURE_ENABLED_BY_DEFAULT #else - base::FEATURE_ENABLED_BY_DEFAULT +// Test on and off + base::FEATURE_DISABLED_BY_DEFAULT #endif ); @@ -444,10 +465,6 @@ BASE_FEATURE(kViewsFirstRunDialog, "ViewsFirstRunDialog", base::FEATURE_DISABLED_BY_DEFAULT); -BASE_FEATURE(kViewsTaskManager, - "ViewsTaskManager", - base::FEATURE_DISABLED_BY_DEFAULT); - BASE_FEATURE(kViewsJSAppModalDialog, "ViewsJSAppModalDialog", base::FEATURE_DISABLED_BY_DEFAULT); @@ -465,4 +482,10 @@ BASE_FEATURE(kUsePortalAccentColor, base::FEATURE_ENABLED_BY_DEFAULT); #endif +BASE_FEATURE(kCompactMode, "CompactMode", base::FEATURE_DISABLED_BY_DEFAULT); + +BASE_FEATURE(kPageSpecificDataDialogRelatedInstalledAppsSection, + "PageSpecificDataDialogRelatedInstalledAppsSection", + base::FEATURE_DISABLED_BY_DEFAULT); + } // namespace features diff --git a/src/chrome/browser/ui/views/toolbar/reload_button.cc b/src/chrome/browser/ui/views/toolbar/reload_button.cc index fcf3cbcf..b03929e4 100644 --- a/src/chrome/browser/ui/views/toolbar/reload_button.cc +++ b/src/chrome/browser/ui/views/toolbar/reload_button.cc @@ -41,9 +41,11 @@ ReloadButton::ReloadButton(CommandUpdater* command_updater) CreateMenuModel(), nullptr), command_updater_(command_updater), - reload_icon_(base::CommandLine::ForCurrentProcess()->HasSwitch("disable-thorium-icons") - ? vector_icons::kReloadChromeRefreshIcon - : vector_icons::kReloadChromeRefreshThoriumIcon), + static const bool disable_thorium_icons = + base::CommandLine::ForCurrentProcess()->HasSwitch("disable-thorium-icons"); + reload_icon_(disable_thorium_icons + ? vector_icons::kReloadChromeRefreshIcon + : vector_icons::kReloadChromeRefreshThoriumIcon), reload_touch_icon_(kReloadTouchIcon), stop_icon_(kNavigateStopChromeRefreshIcon), stop_touch_icon_(kNavigateStopTouchIcon), diff --git a/src/chrome/install_static/chromium_install_modes.cc b/src/chrome/install_static/chromium_install_modes.cc index 2ef4de39..db28fcf6 100644 --- a/src/chrome/install_static/chromium_install_modes.cc +++ b/src/chrome/install_static/chromium_install_modes.cc @@ -71,6 +71,10 @@ const InstallConstants kInstallModes[] = { .app_icon_resource_index = icon_resources::kApplicationIndex, // App icon resource index. .app_icon_resource_id = IDR_MAINFRAME, // App icon resource id. + .html_doc_icon_resource_index = + icon_resources::kHtmlDocIndex, // HTML doc icon resource index. + .pdf_doc_icon_resource_index = + icon_resources::kPDFDocIndex, // PDF doc icon resource index. .sandbox_sid_prefix = L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-" L"924012148-", // App container sid prefix for sandbox. diff --git a/src/components/dom_distiller/core/dom_distiller_features.cc b/src/components/dom_distiller/core/dom_distiller_features.cc index fe7b1ab7..08017d38 100644 --- a/src/components/dom_distiller/core/dom_distiller_features.cc +++ b/src/components/dom_distiller/core/dom_distiller_features.cc @@ -13,16 +13,17 @@ namespace dom_distiller { -BASE_FEATURE(kReaderMode, "ReaderMode", base::FEATURE_ENABLED_BY_DEFAULT); +static const bool kReaderModeDesktop = + base::CommandLine::ForCurrentProcess()->HasSwitch("reader-mode"); bool IsDomDistillerEnabled() { - return true; + return base::CommandLine::ForCurrentProcess()->HasSwitch( + switches::kEnableDomDistiller) || kReaderModeDesktop; } bool ShouldStartDistillabilityService() { return base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableDistillabilityService) || - base::FeatureList::IsEnabled(kReaderMode); + switches::kEnableDistillabilityService) || kReaderModeDesktop; } } // namespace dom_distiller diff --git a/src/net/cert/x509_util.cc b/src/net/cert/x509_util.cc index 5f3c4d2b..71eb63ab 100644 --- a/src/net/cert/x509_util.cc +++ b/src/net/cert/x509_util.cc @@ -2,11 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifdef UNSAFE_BUFFERS_BUILD -// TODO(crbug.com/40284755): Remove this and spanify to fix the errors. -#pragma allow_unsafe_buffers -#endif - #include "net/cert/x509_util.h" #include @@ -188,7 +183,7 @@ bssl::ParsedCertificateList ParseAllValidCerts( std::shared_ptr cert = bssl::ParsedCertificate::Create( bssl::UpRef(x509_cert->cert_buffer()), - net::x509_util::DefaultParseCertificateOptions(), NULL); + net::x509_util::DefaultParseCertificateOptions(), nullptr); if (cert) { parsed_certs.push_back(std::move(cert)); } @@ -272,15 +267,16 @@ bool GetTLSServerEndPointChannelBinding(const X509Certificate& certificate, if (!digest_evp_md) return false; - uint8_t digest[EVP_MAX_MD_SIZE]; + std::array digest; unsigned int out_size; if (!EVP_Digest(der_encoded_certificate.data(), - der_encoded_certificate.size(), digest, &out_size, - digest_evp_md, nullptr)) + der_encoded_certificate.size(), digest.data(), &out_size, + digest_evp_md, nullptr)) { return false; + } token->assign(kChannelBindingPrefix); - token->append(digest, digest + out_size); + token->append(base::as_string_view(digest).substr(0, out_size)); return true; } @@ -440,9 +436,7 @@ bssl::UniquePtr CreateCryptoBuffer( } bssl::UniquePtr CreateCryptoBuffer(std::string_view data) { - return bssl::UniquePtr( - CRYPTO_BUFFER_new(reinterpret_cast(data.data()), - data.size(), GetBufferPool())); + return CreateCryptoBuffer(base::as_byte_span(data)); } bssl::UniquePtr CreateCryptoBufferFromStaticDataUnsafe( @@ -456,19 +450,18 @@ bool CryptoBufferEqual(const CRYPTO_BUFFER* a, const CRYPTO_BUFFER* b) { DCHECK(a && b); if (a == b) return true; - return CRYPTO_BUFFER_len(a) == CRYPTO_BUFFER_len(b) && - memcmp(CRYPTO_BUFFER_data(a), CRYPTO_BUFFER_data(b), - CRYPTO_BUFFER_len(a)) == 0; + return CryptoBufferAsSpan(a) == CryptoBufferAsSpan(b); } std::string_view CryptoBufferAsStringPiece(const CRYPTO_BUFFER* buffer) { - return std::string_view( - reinterpret_cast(CRYPTO_BUFFER_data(buffer)), - CRYPTO_BUFFER_len(buffer)); + return base::as_string_view(CryptoBufferAsSpan(buffer)); } base::span CryptoBufferAsSpan(const CRYPTO_BUFFER* buffer) { - return base::make_span(CRYPTO_BUFFER_data(buffer), CRYPTO_BUFFER_len(buffer)); + // SAFETY: CRYPTO_BUFFER_data(buffer) returns a pointer to data that is + // CRYPTO_BUFFER_len(buffer) bytes in length. + return UNSAFE_BUFFERS( + base::make_span(CRYPTO_BUFFER_data(buffer), CRYPTO_BUFFER_len(buffer))); } scoped_refptr CreateX509CertificateFromBuffers( @@ -570,8 +563,7 @@ bool HasRsaPkcs1Sha1Signature(const CRYPTO_BUFFER* cert_buffer) { bssl::der::Input tbs_certificate_tlv; bssl::der::Input signature_algorithm_tlv; bssl::der::BitString signature_value; - if (!bssl::ParseCertificate(bssl::der::Input(CRYPTO_BUFFER_data(cert_buffer), - CRYPTO_BUFFER_len(cert_buffer)), + if (!bssl::ParseCertificate(bssl::der::Input(CryptoBufferAsSpan(cert_buffer)), &tbs_certificate_tlv, &signature_algorithm_tlv, &signature_value, /*out_errors=*/nullptr)) { return false; diff --git a/src/sandbox/linux/BUILD.gn b/src/sandbox/linux/BUILD.gn index df980f47..fd52129b 100644 --- a/src/sandbox/linux/BUILD.gn +++ b/src/sandbox/linux/BUILD.gn @@ -303,7 +303,7 @@ if (is_linux || is_chromeos) { # These files have a suspicious comparison. # TODO fix this and re-enable this warning. - "-Wno-sign-compare", + # "-Wno-sign-compare", "-O3", "-fPIE", ] diff --git a/src/third_party/blink/common/features.cc b/src/third_party/blink/common/features.cc index 59c52b09..7e828f06 100644 --- a/src/third_party/blink/common/features.cc +++ b/src/third_party/blink/common/features.cc @@ -8,6 +8,7 @@ #include "base/feature_list.h" #include "base/features.h" #include "base/time/time.h" +#include "build/android_buildflags.h" #include "build/build_config.h" #include "build/chromecast_buildflags.h" #include "build/chromeos_buildflags.h" @@ -17,8 +18,7 @@ #include "third_party/blink/public/common/interest_group/ad_auction_constants.h" #include "third_party/blink/public/common/switches.h" -namespace blink { -namespace features { +namespace blink::features { // ----------------------------------------------------------------------------- // Feature definitions and associated constants (feature params, et cetera) @@ -41,8 +41,11 @@ BASE_FEATURE(kAdAuctionReportingWithMacroApi, BASE_FEATURE(kAdAuctionSignals, "AdAuctionSignals", base::FEATURE_ENABLED_BY_DEFAULT); -const base::FeatureParam kAdAuctionSignalsMaxSizeBytes{ - &kAdAuctionSignals, "ad-auction-signals-max-size-bytes", 10000}; +BASE_FEATURE_PARAM(int, + kAdAuctionSignalsMaxSizeBytes, + &kAdAuctionSignals, + "ad-auction-signals-max-size-bytes", + 10000); // See https://github.com/WICG/turtledove/blob/main/FLEDGE.md // Changes default Permissions Policy for features join-ad-interest-group and @@ -81,20 +84,24 @@ BASE_FEATURE(kAlignFontDisplayAutoTimeoutWithLCPGoal, // The amount of time allowed for 'display: auto' web fonts to load without // intervention, counted from navigation start. -const base::FeatureParam - kAlignFontDisplayAutoTimeoutWithLCPGoalTimeoutParam{ - &kAlignFontDisplayAutoTimeoutWithLCPGoal, "lcp-limit-in-ms", 2000}; +BASE_FEATURE_PARAM(int, + kAlignFontDisplayAutoTimeoutWithLCPGoalTimeoutParam, + &kAlignFontDisplayAutoTimeoutWithLCPGoal, + "lcp-limit-in-ms", + 2000); const base::FeatureParam::Option align_font_display_auto_timeout_with_lcp_goal_modes[] = { {AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToFailurePeriod, "failure"}, {AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToSwapPeriod, "swap"}}; -const base::FeatureParam - kAlignFontDisplayAutoTimeoutWithLCPGoalModeParam{ - &kAlignFontDisplayAutoTimeoutWithLCPGoal, "intervention-mode", - AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToSwapPeriod, - &align_font_display_auto_timeout_with_lcp_goal_modes}; +BASE_FEATURE_ENUM_PARAM( + AlignFontDisplayAutoTimeoutWithLCPGoalMode, + kAlignFontDisplayAutoTimeoutWithLCPGoalModeParam, + &kAlignFontDisplayAutoTimeoutWithLCPGoal, + "intervention-mode", + AlignFontDisplayAutoTimeoutWithLCPGoalMode::kToSwapPeriod, + &align_font_display_auto_timeout_with_lcp_goal_modes); BASE_FEATURE(kAllowDatapipeDrainedAsBytesConsumerInBFCache, "AllowDatapipeDrainedAsBytesConsumerInBFCache", @@ -133,11 +140,6 @@ BASE_FEATURE(kAnchorElementInteraction, "AnchorElementInteraction", base::FEATURE_ENABLED_BY_DEFAULT); -// Enable anchor element mouse motion estimator. -BASE_FEATURE(kAnchorElementMouseMotionEstimator, - "AnchorElementMouseMotionEstimator", - base::FEATURE_ENABLED_BY_DEFAULT); - BASE_FEATURE(kAndroidExtendedKeyboardShortcuts, "AndroidExtendedKeyboardShortcuts", base::FEATURE_ENABLED_BY_DEFAULT); @@ -164,21 +166,6 @@ BASE_FEATURE(kAudioWorkletThreadPool, "AudioWorkletThreadPool", base::FEATURE_ENABLED_BY_DEFAULT); -// When enabled, extraction of unassociated listed elements includes elements -// inside Shadow DOM. -BASE_FEATURE(kAutofillIncludeShadowDomInUnassociatedListedElements, - "AutofillIncludeShadowDomInUnassociatedListedElements", - base::FEATURE_ENABLED_BY_DEFAULT); - -// When enabled, Autofill extracts all top level shadow DOM form elements of a -// document. Additionally, the shadow-tree-including form control elements of a -// form `f` include all descendants that are form controls - even those whose -// closest shadow-tree-including form ancestor is a different form `f2` (which -// itself is a descendant of `f`). -BASE_FEATURE(kAutofillIncludeFormElementsInShadowDom, - "AutofillIncludeFormElementsInShadowDom", - base::FEATURE_ENABLED_BY_DEFAULT); - // If disabled (default for many years), autofilling triggers KeyDown and // KeyUp events that do not send any key codes. If enabled, these events // contain the "Unidentified" key. @@ -186,84 +173,16 @@ BASE_FEATURE(kAutofillSendUnidentifiedKeyAfterFill, "AutofillSendUnidentifiedKeyAfterFill", base::FEATURE_DISABLED_BY_DEFAULT); -// Apply lazy-loading to ad frames which have embeds likely impacting Core Web -// Vitals. -BASE_FEATURE(kAutomaticLazyFrameLoadingToAds, - "AutomaticLazyFrameLoadingToAds", - base::FEATURE_ENABLED_BY_DEFAULT); - // https://crbug.com/1472970 BASE_FEATURE(kAutoSpeculationRules, "AutoSpeculationRules", base::FEATURE_DISABLED_BY_DEFAULT); -const base::FeatureParam kAutoSpeculationRulesConfig{ - &kAutoSpeculationRules, "config", "{}"}; const base::FeatureParam kAutoSpeculationRulesHoldback{ &kAutoSpeculationRules, "holdback", false}; -// The timeout value that forces loading iframes that are lazy loaded by -// LazyAds. After this timeout, the frame loading is triggered even when the -// intersection observer does not trigger iframe loading. -const base::FeatureParam kTimeoutMillisForLazyAds( - &features::kAutomaticLazyFrameLoadingToAds, - "timeout", - 0); - -// Skip applying LazyAds for the first "skip_frame_count" frames in the -// document, and apply LazyAds the rest if they are eligible. -const base::FeatureParam kSkipFrameCountForLazyAds( - &features::kAutomaticLazyFrameLoadingToAds, - "skip_frame_count", - 0); - -// Apply lazy-loading to frames which have embeds likely impacting Core Web -// Vitals. -BASE_FEATURE(kAutomaticLazyFrameLoadingToEmbeds, - "AutomaticLazyFrameLoadingToEmbeds", - base::FEATURE_ENABLED_BY_DEFAULT); - -// The timeout value that forces loading iframes that are lazy loaded by -// LazyEmbeds. After this timeout, the frame loading is triggered even when the -// intersection observer does not trigger iframe loading. -const base::FeatureParam kTimeoutMillisForLazyEmbeds( - &features::kAutomaticLazyFrameLoadingToEmbeds, - "timeout", - 0); - -// Skip applying LazyEmbeds for the first "skip_frame_count" frames in the -// document, and apply LazyEmbeds the rest if they are eligible. -const base::FeatureParam kSkipFrameCountForLazyEmbeds( - &features::kAutomaticLazyFrameLoadingToEmbeds, - "skip_frame_count", - 0); - -// Define the allowed websites to use LazyEmbeds. The allowed websites need to -// be defined separately from kAutomaticLazyFrameLoadingToEmbeds because we want -// to gather Blink.AutomaticLazyLoadFrame.LazyEmbedFrameCount UKM data even when -// kAutomaticLazyFrameLoadingToEmbeds is disabled. -BASE_FEATURE(kAutomaticLazyFrameLoadingToEmbedUrls, - "AutomaticLazyFrameLoadingToEmbedUrls", - base::FEATURE_ENABLED_BY_DEFAULT); - -// Define the strategy for LazyEmbeds to decide which frames we apply -// lazy-loading or not. If the loading strategy is kAllowList, the detection -// logic is based on the allowlist that kAutomaticLazyFrameLoadingToEmbedUrls -// passes to the client. If the strategy is kNonAds, the detection logic is -// based on the Ad Tagging in chromium. -const base::FeatureParam:: - Option kAutomaticLazyFrameLoadingToEmbedLoadingStrategies[] = { - {AutomaticLazyFrameLoadingToEmbedLoadingStrategy::kAllowList, - "allow_list"}, - {AutomaticLazyFrameLoadingToEmbedLoadingStrategy::kNonAds, "non_ads"}}; -const base::FeatureParam - kAutomaticLazyFrameLoadingToEmbedLoadingStrategyParam{ - &kAutomaticLazyFrameLoadingToEmbedUrls, "strategy", - AutomaticLazyFrameLoadingToEmbedLoadingStrategy::kAllowList, - &kAutomaticLazyFrameLoadingToEmbedLoadingStrategies}; - BASE_FEATURE(kAvifGainmapHdrImages, "AvifGainmapHdrImages", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); BASE_FEATURE(kAvoidForcedLayoutOnInitialEmptyDocumentInSubframe, "AvoidForcedLayoutOnInitialEmptyDocumentInSubframe", @@ -283,13 +202,22 @@ BASE_FEATURE(kBackForwardCacheWithKeepaliveRequest, // more details. BASE_FEATURE(kBackgroundResourceFetch, "BackgroundResourceFetch", - base::FEATURE_DISABLED_BY_DEFAULT); -const base::FeatureParam kBackgroundFontResponseProcessor{ - &kBackgroundResourceFetch, "background-font-response-processor", true}; -const base::FeatureParam kBackgroundScriptResponseProcessor{ - &kBackgroundResourceFetch, "background-script-response-processor", true}; -const base::FeatureParam kBackgroundCodeCacheDecoderStart{ - &kBackgroundResourceFetch, "background-code-cache-decoder-start", true}; + base::FEATURE_ENABLED_BY_DEFAULT); +BASE_FEATURE_PARAM(bool, + kBackgroundFontResponseProcessor, + &kBackgroundResourceFetch, + "background-font-response-processor", + true); +BASE_FEATURE_PARAM(bool, + kBackgroundScriptResponseProcessor, + &kBackgroundResourceFetch, + "background-script-response-processor", + true); +BASE_FEATURE_PARAM(bool, + kBackgroundCodeCacheDecoderStart, + &kBackgroundResourceFetch, + "background-code-cache-decoder-start", + true); // Redefine the oklab and oklch spaces to have gamut mapping baked into them. // https://crbug.com/1508329 @@ -319,16 +247,25 @@ BASE_FEATURE(kBoostImagePriority, base::FEATURE_ENABLED_BY_DEFAULT); // The number of images to bopost the priority of before returning // to the default (low) priority. -const base::FeatureParam kBoostImagePriorityImageCount{ - &kBoostImagePriority, "image_count", 5}; +BASE_FEATURE_PARAM(int, + kBoostImagePriorityImageCount, + &kBoostImagePriority, + "image_count", + 5); // Maximum size of an image (in px^2) to be considered "small". // Small images, where dimensions are specified in the markup, are not boosted. -const base::FeatureParam kBoostImagePriorityImageSize{&kBoostImagePriority, - "image_size", 10000}; +BASE_FEATURE_PARAM(int, + kBoostImagePriorityImageSize, + &kBoostImagePriority, + "image_size", + 10000); // Number of medium-priority requests to allow in tight-mode independent of the // total number of outstanding requests. -const base::FeatureParam kBoostImagePriorityTightMediumLimit{ - &kBoostImagePriority, "tight_medium_limit", 2}; +BASE_FEATURE_PARAM(int, + kBoostImagePriorityTightMediumLimit, + &kBoostImagePriority, + "tight_medium_limit", + 2); // Boost the priority of certain loading tasks (https://crbug.com/1470003). BASE_FEATURE(kBoostImageSetLoadingTaskPriority, @@ -377,64 +314,93 @@ BASE_FEATURE(kBrowsingTopicsDocumentAPI, BASE_FEATURE(kBrowsingTopicsParameters, "BrowsingTopicsParameters", base::FEATURE_DISABLED_BY_DEFAULT); +// The periodic topics calculation interval. +BASE_FEATURE_PARAM(base::TimeDelta, + kBrowsingTopicsTimePeriodPerEpoch, + &kBrowsingTopicsParameters, + "time_period_per_epoch", + base::Days(7)); // The number of epochs from where to calculate the topics to give to a // requesting contexts. -const base::FeatureParam kBrowsingTopicsNumberOfEpochsToExpose{ - &kBrowsingTopicsParameters, "number_of_epochs_to_expose", 3}; -// The periodic topics calculation interval. -const base::FeatureParam kBrowsingTopicsTimePeriodPerEpoch{ - &kBrowsingTopicsParameters, "time_period_per_epoch", base::Days(7)}; +BASE_FEATURE_PARAM(int, + kBrowsingTopicsNumberOfEpochsToExpose, + &kBrowsingTopicsParameters, + "number_of_epochs_to_expose", + 3); // The number of top topics to derive and to keep for each epoch (week). -const base::FeatureParam kBrowsingTopicsNumberOfTopTopicsPerEpoch{ - &kBrowsingTopicsParameters, "number_of_top_topics_per_epoch", 5}; +BASE_FEATURE_PARAM(int, + kBrowsingTopicsNumberOfTopTopicsPerEpoch, + &kBrowsingTopicsParameters, + "number_of_top_topics_per_epoch", + 5); // The probability (in percent number) to return the random topic to a site. The // "random topic" is per-site, and is selected from the full taxonomy uniformly // at random, and each site has a // `kBrowsingTopicsUseRandomTopicProbabilityPercent`% chance to see their random // topic instead of one of the top topics. -const base::FeatureParam kBrowsingTopicsUseRandomTopicProbabilityPercent{ - &kBrowsingTopicsParameters, "use_random_topic_probability_percent", 5}; +BASE_FEATURE_PARAM(int, + kBrowsingTopicsUseRandomTopicProbabilityPercent, + &kBrowsingTopicsParameters, + "use_random_topic_probability_percent", + 5); // Maximum duration between when a epoch is calculated and when a site starts // using that new epoch's topics. The time chosen is a per-site random point in // time between [calculation time, calculation time + max duration). -const base::FeatureParam - kBrowsingTopicsMaxEpochIntroductionDelay{&kBrowsingTopicsParameters, - "max_epoch_introduction_delay", - base::Days(2)}; +BASE_FEATURE_PARAM(base::TimeDelta, + kBrowsingTopicsMaxEpochIntroductionDelay, + &kBrowsingTopicsParameters, + "max_epoch_introduction_delay", + base::Days(2)); +// The duration an epoch is retained before deletion. +BASE_FEATURE_PARAM(base::TimeDelta, + kBrowsingTopicsEpochRetentionDuration, + &kBrowsingTopicsParameters, + "epoch_retention_duration", + base::Days(28)); // How many epochs (weeks) of API usage data (i.e. topics observations) will be // based off for the filtering of topics for a calling context. -const base::FeatureParam - kBrowsingTopicsNumberOfEpochsOfObservationDataToUseForFiltering{ - &kBrowsingTopicsParameters, - "number_of_epochs_of_observation_data_to_use_for_filtering", 3}; +BASE_FEATURE_PARAM( + int, + kBrowsingTopicsNumberOfEpochsOfObservationDataToUseForFiltering, + &kBrowsingTopicsParameters, + "number_of_epochs_of_observation_data_to_use_for_filtering", + 3); // The max number of observed-by context domains to keep for each top topic // during the epoch topics calculation. The final number of domains associated // with each topic may be larger than this threshold, because that set of // domains will also include all domains associated with the topic's descendant // topics. The intent is to cap the in-use memory. -const base::FeatureParam - kBrowsingTopicsMaxNumberOfApiUsageContextDomainsToKeepPerTopic{ - &kBrowsingTopicsParameters, - "max_number_of_api_usage_context_domains_to_keep_per_topic", 1000}; +BASE_FEATURE_PARAM( + int, + kBrowsingTopicsMaxNumberOfApiUsageContextDomainsToKeepPerTopic, + &kBrowsingTopicsParameters, + "max_number_of_api_usage_context_domains_to_keep_per_topic", + 1000); // The max number of entries allowed to be retrieved from the // `BrowsingTopicsSiteDataStorage` database for each query for the API usage // contexts. The query will occur once per epoch (week) at topics calculation // time. The intent is to cap the peak memory usage. -const base::FeatureParam - kBrowsingTopicsMaxNumberOfApiUsageContextEntriesToLoadPerEpoch{ - &kBrowsingTopicsParameters, - "max_number_of_api_usage_context_entries_to_load_per_epoch", 100000}; +BASE_FEATURE_PARAM( + int, + kBrowsingTopicsMaxNumberOfApiUsageContextEntriesToLoadPerEpoch, + &kBrowsingTopicsParameters, + "max_number_of_api_usage_context_entries_to_load_per_epoch", + 100000); // The max number of API usage context domains allowed to be stored per page // load. -const base::FeatureParam - kBrowsingTopicsMaxNumberOfApiUsageContextDomainsToStorePerPageLoad{ - &kBrowsingTopicsParameters, - "max_number_of_api_usage_context_domains_to_store_per_page_load", 30}; +BASE_FEATURE_PARAM( + int, + kBrowsingTopicsMaxNumberOfApiUsageContextDomainsToStorePerPageLoad, + &kBrowsingTopicsParameters, + "max_number_of_api_usage_context_domains_to_store_per_page_load", + 30); // The taxonomy version. This only affects the topics classification that occurs // during this browser session, and doesn't affect the pre-existing epochs. -const base::FeatureParam kBrowsingTopicsTaxonomyVersion{ - &kBrowsingTopicsParameters, "taxonomy_version", - kBrowsingTopicsTaxonomyVersionDefault}; +BASE_FEATURE_PARAM(int, + kBrowsingTopicsTaxonomyVersion, + &kBrowsingTopicsParameters, + "taxonomy_version", + kBrowsingTopicsTaxonomyVersionDefault); // Comma separated Topic IDs to be blocked. Descendant topics of each blocked // topic will be blocked as well. const base::FeatureParam kBrowsingTopicsDisabledTopicsList{ @@ -446,8 +412,11 @@ const base::FeatureParam kBrowsingTopicsPrioritizedTopicsList{ "57,86,126,149,172,180,196,207,239,254,263,272,289,299,332"}; // When a topics calculation times out for the first time, the duration to wait // before starting a new one. -const base::FeatureParam kBrowsingTopicsFirstTimeoutRetryDelay{ - &kBrowsingTopicsParameters, "first_timeout_retry_delay", base::Minutes(1)}; +BASE_FEATURE_PARAM(base::TimeDelta, + kBrowsingTopicsFirstTimeoutRetryDelay, + &kBrowsingTopicsParameters, + "first_timeout_retry_delay", + base::Minutes(1)); // Suppresses console errors for CORS problems which report an associated // inspector issue anyway. @@ -460,11 +429,17 @@ BASE_FEATURE(kCORSErrorsIssueOnly, BASE_FEATURE(kCacheCodeOnIdle, "CacheCodeOnIdle", base::FEATURE_ENABLED_BY_DEFAULT); -const base::FeatureParam kCacheCodeOnIdleDelayParam{&kCacheCodeOnIdle, - "delay-in-ms", 1}; +BASE_FEATURE_PARAM(int, + kCacheCodeOnIdleDelayParam, + &kCacheCodeOnIdle, + "delay-in-ms", + 1); // Apply CacheCodeOnIdle only for service workers (https://crbug.com/1410082). -const base::FeatureParam kCacheCodeOnIdleDelayServiceWorkerOnlyParam{ - &kCacheCodeOnIdle, "service-worker-only", true}; +BASE_FEATURE_PARAM(bool, + kCacheCodeOnIdleDelayServiceWorkerOnlyParam, + &kCacheCodeOnIdle, + "service-worker-only", + true); // When enabled allows the header name used in the blink // CacheStorageCodeCacheHint runtime feature to be modified. This runtime @@ -584,7 +559,7 @@ BASE_FEATURE(kCompressParkableStrings, // foreground, and increase aging tick intervals. BASE_FEATURE(kLessAggressiveParkableString, "LessAggressiveParkableString", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); // Limits maximum capacity of disk data allocator per renderer process. // DiskDataAllocator and its clients(ParkableString, ParkableImage) will try @@ -622,6 +597,41 @@ BASE_FEATURE(kDefaultViewportIsDeviceWidth, "DefaultViewportIsDeviceWidth", base::FEATURE_ENABLED_BY_DEFAULT); +BASE_FEATURE(kDeferRendererTasksAfterInput, + "DeferRendererTasksAfterInput", + base::FEATURE_DISABLED_BY_DEFAULT); + +const char kDeferRendererTasksAfterInputPolicyParamName[] = "policy"; +const char kDeferRendererTasksAfterInputMinimalTypesPolicyName[] = + "minimal-types"; +const char + kDeferRendererTasksAfterInputNonUserBlockingDeferrableTypesPolicyName[] = + "non-user-blocking-deferrable-types"; +const char kDeferRendererTasksAfterInputNonUserBlockingTypesPolicyName[] = + "non-user-blocking-types"; +const char kDeferRendererTasksAfterInputAllDeferrableTypesPolicyName[] = + "all-deferrable-types"; +const char kDeferRendererTasksAfterInputAllTypesPolicyName[] = "all-types"; + +const base::FeatureParam::Option kTaskDeferralOptions[] = { + {TaskDeferralPolicy::kMinimalTypes, + kDeferRendererTasksAfterInputMinimalTypesPolicyName}, + {TaskDeferralPolicy::kNonUserBlockingDeferrableTypes, + kDeferRendererTasksAfterInputNonUserBlockingDeferrableTypesPolicyName}, + {TaskDeferralPolicy::kNonUserBlockingTypes, + kDeferRendererTasksAfterInputNonUserBlockingTypesPolicyName}, + {TaskDeferralPolicy::kAllDeferrableTypes, + kDeferRendererTasksAfterInputAllDeferrableTypesPolicyName}, + {TaskDeferralPolicy::kAllTypes, + kDeferRendererTasksAfterInputAllTypesPolicyName}}; + +BASE_FEATURE_ENUM_PARAM(TaskDeferralPolicy, + kTaskDeferralPolicyParam, + &kDeferRendererTasksAfterInput, + kDeferRendererTasksAfterInputPolicyParamName, + TaskDeferralPolicy::kAllDeferrableTypes, + &kTaskDeferralOptions); + BASE_FEATURE(kDelayAsyncScriptExecution, "DelayAsyncScriptExecution", base::FEATURE_DISABLED_BY_DEFAULT); @@ -637,11 +647,12 @@ const base::FeatureParam::Option "till_first_lcp_candidate"}, }; -const base::FeatureParam - kDelayAsyncScriptExecutionDelayParam{ - &kDelayAsyncScriptExecution, "delay_async_exec_delay_type", - DelayAsyncScriptDelayType::kFinishedParsing, - &delay_async_script_execution_delay_types}; +BASE_FEATURE_ENUM_PARAM(DelayAsyncScriptDelayType, + kDelayAsyncScriptExecutionDelayParam, + &kDelayAsyncScriptExecution, + "delay_async_exec_delay_type", + DelayAsyncScriptDelayType::kFinishedParsing, + &delay_async_script_execution_delay_types); const base::FeatureParam::Option delay_async_script_target_types[] = { @@ -652,39 +663,52 @@ const base::FeatureParam::Option {DelayAsyncScriptTarget::kCrossSiteWithAllowListReportOnly, "cross_site_with_allow_list_report_only"}, }; -const base::FeatureParam kDelayAsyncScriptTargetParam{ - &kDelayAsyncScriptExecution, "delay_async_exec_target", - DelayAsyncScriptTarget::kAll, &delay_async_script_target_types}; +BASE_FEATURE_ENUM_PARAM(DelayAsyncScriptTarget, + kDelayAsyncScriptTargetParam, + &kDelayAsyncScriptExecution, + "delay_async_exec_target", + DelayAsyncScriptTarget::kAll, + &delay_async_script_target_types); // kDelayAsyncScriptExecution will delay executing async script at max // |delay_async_exec_delay_limit|. -const base::FeatureParam - kDelayAsyncScriptExecutionDelayLimitParam{&kDelayAsyncScriptExecution, - "delay_async_exec_delay_limit", - base::Seconds(0)}; +BASE_FEATURE_PARAM(base::TimeDelta, + kDelayAsyncScriptExecutionDelayLimitParam, + &kDelayAsyncScriptExecution, + "delay_async_exec_delay_limit", + base::Seconds(0)); // kDelayAsyncScriptExecution will be disabled after document elapsed more than // |delay_async_exec_feature_limit|. Zero value means no limit. // This is to avoid unnecessary async script delay after LCP (for // kEachLcpCandidate or kEachPaint). Because we can't determine the LCP timing // while loading, we use timeout instead. -const base::FeatureParam - kDelayAsyncScriptExecutionFeatureLimitParam{ - &kDelayAsyncScriptExecution, "delay_async_exec_feature_limit", - base::Seconds(0)}; +BASE_FEATURE_PARAM(base::TimeDelta, + kDelayAsyncScriptExecutionFeatureLimitParam, + &kDelayAsyncScriptExecution, + "delay_async_exec_feature_limit", + base::Seconds(0)); const base::FeatureParam kDelayAsyncScriptAllowList{ &kDelayAsyncScriptExecution, "delay_async_exec_allow_list", ""}; -const base::FeatureParam kDelayAsyncScriptExecutionDelayByDefaultParam{ - &kDelayAsyncScriptExecution, "delay_async_exec_delay_by_default", true}; +BASE_FEATURE_PARAM(bool, + kDelayAsyncScriptExecutionDelayByDefaultParam, + &kDelayAsyncScriptExecution, + "delay_async_exec_delay_by_default", + true); -const base::FeatureParam kDelayAsyncScriptExecutionMainFrameOnlyParam{ - &kDelayAsyncScriptExecution, "delay_async_exec_main_frame_only", false}; +BASE_FEATURE_PARAM(bool, + kDelayAsyncScriptExecutionMainFrameOnlyParam, + &kDelayAsyncScriptExecution, + "delay_async_exec_main_frame_only", + false); -const base::FeatureParam kDelayAsyncScriptExecutionWhenLcpFoundInHtml{ - &kDelayAsyncScriptExecution, "delay_async_exec_when_lcp_found_in_html", - false}; +BASE_FEATURE_PARAM(bool, + kDelayAsyncScriptExecutionWhenLcpFoundInHtml, + &kDelayAsyncScriptExecution, + "delay_async_exec_when_lcp_found_in_html", + false); // kDelayAsyncScriptExecution will change evaluation schedule for the // specified target. @@ -694,24 +718,28 @@ const base::FeatureParam::Option {AsyncScriptExperimentalSchedulingTarget::kNonAds, "non_ads"}, {AsyncScriptExperimentalSchedulingTarget::kBoth, "both"}, }; -const base::FeatureParam - kDelayAsyncScriptExecutionTargetParam{ - &kDelayAsyncScriptExecution, "delay_async_exec_target", - AsyncScriptExperimentalSchedulingTarget::kBoth, - &async_script_experimental_scheduling_targets}; +BASE_FEATURE_ENUM_PARAM(AsyncScriptExperimentalSchedulingTarget, + kDelayAsyncScriptExecutionTargetParam, + &kDelayAsyncScriptExecution, + "delay_async_exec_target", + AsyncScriptExperimentalSchedulingTarget::kBoth, + &async_script_experimental_scheduling_targets); -const base::FeatureParam - kDelayAsyncScriptExecutionOptOutLowFetchPriorityHintParam{ - &kDelayAsyncScriptExecution, - "delay_async_exec_opt_out_low_fetch_priority_hint", false}; -const base::FeatureParam - kDelayAsyncScriptExecutionOptOutAutoFetchPriorityHintParam{ - &kDelayAsyncScriptExecution, - "delay_async_exec_opt_out_auto_fetch_priority_hint", false}; -const base::FeatureParam - kDelayAsyncScriptExecutionOptOutHighFetchPriorityHintParam{ - &kDelayAsyncScriptExecution, - "delay_async_exec_opt_out_high_fetch_priority_hint", false}; +BASE_FEATURE_PARAM(bool, + kDelayAsyncScriptExecutionOptOutLowFetchPriorityHintParam, + &kDelayAsyncScriptExecution, + "delay_async_exec_opt_out_low_fetch_priority_hint", + false); +BASE_FEATURE_PARAM(bool, + kDelayAsyncScriptExecutionOptOutAutoFetchPriorityHintParam, + &kDelayAsyncScriptExecution, + "delay_async_exec_opt_out_auto_fetch_priority_hint", + false); +BASE_FEATURE_PARAM(bool, + kDelayAsyncScriptExecutionOptOutHighFetchPriorityHintParam, + &kDelayAsyncScriptExecution, + "delay_async_exec_opt_out_high_fetch_priority_hint", + false); BASE_FEATURE(kDelayLowPriorityRequestsAccordingToNetworkState, "DelayLowPriorityRequestsAccordingToNetworkState", @@ -721,9 +749,11 @@ const base::FeatureParam kMaxNumOfThrottleableRequestsInTightMode{ &kDelayLowPriorityRequestsAccordingToNetworkState, "MaxNumOfThrottleableRequestsInTightMode", 5}; -const base::FeatureParam kHttpRttThreshold{ - &kDelayLowPriorityRequestsAccordingToNetworkState, "HttpRttThreshold", - base::Milliseconds(450)}; +BASE_FEATURE_PARAM(base::TimeDelta, + kHttpRttThreshold, + &kDelayLowPriorityRequestsAccordingToNetworkState, + "HttpRttThreshold", + base::Milliseconds(450)); const base::FeatureParam kCostReductionOfMultiplexedRequests{ &kDelayLowPriorityRequestsAccordingToNetworkState, @@ -767,12 +797,6 @@ BASE_FEATURE(kEstablishGpuChannelAsync, #endif ); -// Exposes Event Timing keyboard InteractionId of composition and keypress -// events. -BASE_FEATURE(kEventTimingKeypressAndCompositionInteractionId, - "EventTimingKeypressAndCompositionInteractionId", - base::FEATURE_ENABLED_BY_DEFAULT); - // Enables unload handler deprecation via Permissions-Policy. // https://crbug.com/1324111 BASE_FEATURE(kDeprecateUnload, @@ -797,17 +821,11 @@ BASE_FEATURE(kDeprecateUnloadByAllowList, const base::FeatureParam kDeprecateUnloadAllowlist{ &kDeprecateUnloadByAllowList, "allowlist", ""}; -// Enable reporting the modal dialog start time as an alternative end time for -// duration measurement in performance event timing. -BASE_FEATURE(kEventTimingFallbackToModalDialogStart, - "EventTimingFallbackToModalDialogStart", - base::FEATURE_ENABLED_BY_DEFAULT); - // Enable not reporting orphan pointerup (pointerup not accompanied by // pointerdown) as an interaction in performance event timing. BASE_FEATURE(kEventTimingHandleOrphanPointerup, "EventTimingHandleOrphanPointerup", - base::FEATURE_DISABLED_BY_DEFAULT); + base::FEATURE_ENABLED_BY_DEFAULT); // Controls whether LCP calculations should exclude low-entropy images. If // enabled, then the associated parameter sets the cutoff, expressed as the @@ -827,45 +845,12 @@ const base::FeatureParam kMinimumEntropyForLCP{ // trials. BASE_FEATURE(kFencedFrames, "FencedFrames", base::FEATURE_ENABLED_BY_DEFAULT); -// Enable the new fenced frame-related features in M120. (These are -// conditionally dependent on other fenced frame-related feature flags being -// enabled.) -// Part 1: -// * Extra format for ad size macro substitution: -// ${AD_WIDTH} and ${AD_HEIGHT}, on top of the previous -// {%AD_WIDTH%} and {%AD_HEIGHT%}. -// * Input validation (no disallowed URI component characters) in -// registerAdMacro keys and values. -// * Send automatic beacons to all registered destinations without requiring -// event data to be in place. -BASE_FEATURE(kFencedFramesM120FeaturesPart1, - "FencedFramesM120FeaturesPart1", - base::FEATURE_ENABLED_BY_DEFAULT); - -// Enable the new fenced frame-related features in M120. (These are -// conditionally dependent on other fenced frame-related feature flags being -// enabled.) -// Part 2: -// * Support leaving interest group from ad components. -// * Split off the `reserved.top_navigation` automatic beacon type into -// `reserved.top_navigation_start` and `reserved.top_navigation_commit. -BASE_FEATURE(kFencedFramesM120FeaturesPart2, - "FencedFramesM120FeaturesPart2", - base::FEATURE_ENABLED_BY_DEFAULT); - // Relax the attestation requirement of post-impression beacons from Protected // Audience only to either Protected Audience or Attribution Reporting. BASE_FEATURE(kFencedFramesReportingAttestationsChanges, "FencedFramesReportingAttestationsChanges", base::FEATURE_DISABLED_BY_DEFAULT); -// Enable allowing cross-origin subframes to send automatic beacons. This -// requires opt-in both from the cross-origin subframe as well as the document -// that sets the automatic beacon data. -BASE_FEATURE(kFencedFramesCrossOriginAutomaticBeacons, - "FencedFramesCrossOriginAutomaticBeacons", - base::FEATURE_ENABLED_BY_DEFAULT); - // Enable sending event-level reports through reportEvent() in cross-origin // subframes. This requires opt-in both from the cross-origin subframe that is // sending the beacon as well as the document that contains information about @@ -899,6 +884,13 @@ BASE_FEATURE(kFencedFramesReportEventHeaderChanges, "FencedFramesReportEventHeaderChanges", base::FEATURE_DISABLED_BY_DEFAULT); +// Enables a bug fix that allows a 'src' allowlist in the |allow| parameter of a +// or