// Copyright 2022 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/common/features.h" #include "base/feature_list.h" #include "base/metrics/field_trial_params.h" #include "base/time/time.h" #include "third_party/blink/public/common/features.h" namespace features { // Please keep features in alphabetical order. #if BUILDFLAG(IS_ANDROID) // When enabled, fires CONTENT_CHANGE_TYPE_CONTENT_INVALID events to Android // when aria-invalid is true. // TODO(crbug.com/500812737): Remove killswitch after stability period. BASE_FEATURE(kAccessibilityAriaInvalidAndErrorMessage, base::FEATURE_ENABLED_BY_DEFAULT); #endif // BUILDFLAG(IS_ANDROID) // When enabled, Android events will include more metadata about the incoming // events. BASE_FEATURE(kAccessibilityExpandEventMetadata, base::FEATURE_DISABLED_BY_DEFAULT); // When enabled, the full accessibility tree will be exposed for non-atomic // text fields, such as contenteditables. BASE_FEATURE(kAccessibilityExposeNonAtomicTextFieldChildren, base::FEATURE_DISABLED_BY_DEFAULT); // Enables content-initiated, main frame navigations to data URLs. // TODO(meacer): Remove when the deprecation is complete. // https://www.chromestatus.com/feature/5669602927312896 BASE_FEATURE(kAllowContentInitiatedDataUrlNavigations, base::FEATURE_DISABLED_BY_DEFAULT); // Enables desktop-style scrollbars. BASE_FEATURE(kAndroidDesktopStyleScrollbars, base::FEATURE_DISABLED_BY_DEFAULT); // Allows Blink to request fonts from the Android Downloadable Fonts API through // the service implemented on the Java side. BASE_FEATURE(kAndroidDownloadableFontsMatching, base::FEATURE_ENABLED_BY_DEFAULT); #if BUILDFLAG(IS_WIN) // Flag guard for Windows Arabic Indic digit input solution. // crbug.com/440381284 BASE_FEATURE(kArabicIndicDigitInput, base::FEATURE_ENABLED_BY_DEFAULT); #endif // BUILDFLAG(IS_WIN) // If enabled, runs beforeunload handlers asynchronously when the user // hasn't interacted with the frame. (See: https://crbug.com/475716933) BASE_FEATURE(kAsyncBeforeUnload, base::FEATURE_DISABLED_BY_DEFAULT); BASE_FEATURE_PARAM(base::TimeDelta, kAsyncBeforeUnloadTimeout, &kAsyncBeforeUnload, "AsyncBeforeUnloadTimeout", base::Milliseconds(500)); // Synchronously continuing with navigation can lead to trying to start another // navigation synchronously while the first navigation is still being processed // on the stack. This results in re-entrancy which is unsafe and triggers a // CHECK. // // Embedders like Android WebView cannot guarantee that re-entrancy would never // occur - in particular, there are existing Android WebView apps that do the // problematic sync navigation. Hence Android WebView entirely disables this // feature via // ContentBrowserClient::SupportsAvoidUnnecessaryBeforeUnloadCheckSync(). // // The eventual goal of this feature flag is to make it possible to continue // navigation synchronously for some platforms // (See: https://crbug.com/396998476). // // There are several modes that are described in the // AvoidUnnecessaryBeforeUnloadCheckSyncMode enum in the header file. // // The eventual state is to utilize kWithoutSendBeforeUnload mode, as it offers // the highest performance. However, kWithoutSendBeforeUnload mode causes a // metrics skew due to the current inaccurate measurement timing of navigation // start (refer to crbug.com/385170155). Therefore, kWithSendBeforeUnload mode // is the current default. We would like to update to use // kWithoutSendBeforeUnload mode once crbug.com/385170155 is resolved. BASE_FEATURE(kAvoidUnnecessaryBeforeUnloadCheckSync, base::FEATURE_ENABLED_BY_DEFAULT); constexpr base::FeatureParam::Option kAvoidUnnecessaryBeforeUnloadCheckSyncModeOption[] = { {AvoidUnnecessaryBeforeUnloadCheckSyncMode::kWithSendBeforeUnload, "WithSendBeforeUnload"}, {AvoidUnnecessaryBeforeUnloadCheckSyncMode::kWithoutSendBeforeUnload, "WithoutSendBeforeUnload"}, }; BASE_FEATURE_ENUM_PARAM( AvoidUnnecessaryBeforeUnloadCheckSyncMode, kAvoidUnnecessaryBeforeUnloadCheckSyncMode, &kAvoidUnnecessaryBeforeUnloadCheckSync, AvoidUnnecessaryBeforeUnloadCheckSyncMode::kWithSendBeforeUnload, &kAvoidUnnecessaryBeforeUnloadCheckSyncModeOption); // Enables controlling the time to live for pages in the BackForwardCache. // The time to live is defined by the param 'time_to_live_seconds'; if this // param is not specified then this feature is ignored and the default is used. BASE_FEATURE(kBackForwardCacheTimeToLiveControl, base::FEATURE_DISABLED_BY_DEFAULT); // When enabled, the browser will schedule before unload tasks that continue // navigation network responses in a kHigh priority queue. // TODO(b/281094330): Run experiment on ChromeOS. Experiment was not run on // ChromeOS due to try bot issue. BASE_FEATURE(kBeforeUnloadBrowserResponseQueue, #if BUILDFLAG(IS_CHROMEOS) base::FEATURE_DISABLED_BY_DEFAULT #else base::FEATURE_ENABLED_BY_DEFAULT #endif ); #if BUILDFLAG(IS_ANDROID) // Whether to hide paste popup on GestureScrollBegin or GestureScrollUpdate. BASE_FEATURE(kHidePastePopupOnGSB, base::FEATURE_ENABLED_BY_DEFAULT); #endif #if BUILDFLAG(IS_MAC) // If enabled, handle more cache misses by falling back to the selection. BASE_FEATURE(kCachedFirstRectMoreSelectionFallbacks, base::FEATURE_DISABLED_BY_DEFAULT); // If true, whenever the cache lookup falls back to the selection, allow the // fallback even if the requested range is outside the selection. BASE_FEATURE(kCachedFirstRectAllowRangeOutsideSelection, base::FEATURE_DISABLED_BY_DEFAULT); // If true, whenever the cache lookup falls back to the selection, return an // empty result instead of an error when there's no valid selection. BASE_FEATURE(kCachedFirstRectAllowInvalidSelection, base::FEATURE_DISABLED_BY_DEFAULT); BASE_FEATURE(kCancelCompositionWhenWindowLosesFocus, base::FEATURE_ENABLED_BY_DEFAULT); #endif // BUILDFLAG(IS_MAC) // When enabled, CDP method Page.captureScreenshot will increment // the LocalSurfaceId instead of waiting for ForceRedraw to complete. // This should avoid a possible stall due to frames not being presented. BASE_FEATURE(kCDPScreenshotNewSurface, base::FEATURE_DISABLED_BY_DEFAULT); // When enabled, code cache does not use a browsing_data filter for deletions. BASE_FEATURE(kCodeCacheDeletionWithoutFilter, base::FEATURE_ENABLED_BY_DEFAULT); // Turn on a bug fix for crbug.com/456537756, ensuring that the callback passed // to RenderWidgetHostView::CopyFromSurface() is always called. BASE_FEATURE(kCopyFromSurfaceAlwaysCallCallback, base::FEATURE_ENABLED_BY_DEFAULT); // Enables support for the `Critical-CH` response header. // https://github.com/WICG/client-hints-infrastructure/blob/master/reliability.md#critical-ch BASE_FEATURE(kCriticalClientHint, base::FEATURE_ENABLED_BY_DEFAULT); // This feature controls whether Dev Tools supports debugging Device Bound // Sessions. BASE_FEATURE(kDeviceBoundSessionsDevTools, base::FEATURE_ENABLED_BY_DEFAULT); // This feature enables the fix for double releases of // WorkerOrWorkletDevToolsAgentHost to prevent UAF. BASE_FEATURE(kWorkerOrWorkletAgentDoubleReleaseFix, base::FEATURE_ENABLED_BY_DEFAULT); // This feature gates the entry to ServiceWorkerDevToolsAgentHost to ensure // it is only accessible when DevTools is actually attached. BASE_FEATURE(kServiceWorkerDevToolsWorkerReadyCheck, base::FEATURE_ENABLED_BY_DEFAULT); // This feature gates the entry to SharedWorkerDevToolsAgentHost to ensure // it is only accessible when DevTools is actually attached. BASE_FEATURE(kSharedWorkerDevToolsWorkerReadyCheck, base::FEATURE_ENABLED_BY_DEFAULT); #if BUILDFLAG(IS_ANDROID) // Disables the auto_resize_output_surface feature in the Viz process. // This prevents visual artifacts (blue gutters) during window resizing on // large form factor devices. BASE_FEATURE(kDisableAutoResizeOutputSurface, base::FEATURE_ENABLED_BY_DEFAULT); #endif // Enable DocumentIsolationPolicy even if the platform does not support full // SiteIsolation. BASE_FEATURE(kDocumentIsolationPolicyWithoutSiteIsolation, base::FEATURE_ENABLED_BY_DEFAULT); // Enable document policy negotiation mechanism. BASE_FEATURE(kDocumentPolicyNegotiation, base::FEATURE_DISABLED_BY_DEFAULT); // When enabled `EditContext::updateSelection` calls from async selectionchange // handlers sync the selection to the browser. // See https://crbug.com/516839844 BASE_FEATURE(kEditContextSelectionSync, base::FEATURE_ENABLED_BY_DEFAULT); // When enabled, the renderer is killed if a renderer process provides // an Origin header on a navigation request. BASE_FEATURE(kKillOnUnexpectedOriginHeader, base::FEATURE_ENABLED_BY_DEFAULT); // Requires documents embedded via