Modified: trunk/Tools/DumpRenderTree/TestOptions.cpp (274051 => 274052)
--- trunk/Tools/DumpRenderTree/TestOptions.cpp 2021-03-07 05:35:25 UTC (rev 274051)
+++ trunk/Tools/DumpRenderTree/TestOptions.cpp 2021-03-07 17:41:50 UTC (rev 274052)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2016-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2021 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -63,6 +63,65 @@
static TestFeatures features;
if (features.boolWebPreferenceFeatures.empty()) {
features.boolWebPreferenceFeatures = {
+#if PLATFORM(COCOA)
+ // These are non-experimental WebPreference values that must always be set as they
+ // differ from the default set in the WebPreferences*.yaml configuration.
+ { "AllowsInlineMediaPlayback", true },
+ { "CanvasUsesAcceleratedDrawing", true },
+ { "ColorFilterEnabled", true },
+ { "CustomPasteboardDataEnabled", true },
+ { "DOMPasteAllowed", true },
+ { "DeveloperExtrasEnabled", true },
+ { "DirectoryUploadEnabled", true },
+ { "DownloadAttributeEnabled", true },
+ { "EncryptedMediaAPIEnabled", true },
+ { "FullScreenEnabled", true },
+ { "GamepadsEnabled", true },
+ { "HiddenPageCSSAnimationSuspensionEnabled", false },
+ { "InlineMediaPlaybackRequiresPlaysInlineAttribute", false },
+ { "JavaEnabled", false },
+ { "_javascript_CanAccessClipboard", true },
+ { "_javascript_CanOpenWindowsAutomatically", true },
+ { "LargeImageAsyncDecodingEnabled", false },
+ { "LinkPreloadEnabled", true },
+ { "MediaCapabilitiesEnabled", true },
+ { "MediaDataLoadsAutomatically", true },
+ { "MediaDevicesEnabled", true },
+ { "MediaPreloadingEnabled", true },
+ { "MockScrollbarsEnabled", true },
+ { "NeedsStorageAccessFromFileURLsQuirk", false },
+ { "OfflineWebApplicationCacheEnabled", true },
+ { "RequiresUserGestureForAudioPlayback", false },
+ { "RequiresUserGestureForMediaPlayback", false },
+ { "RequiresUserGestureForVideoPlayback", false },
+ { "ShouldPrintBackgrounds", true },
+ { "ShrinksStandaloneImagesToFit", true },
+ { "SubpixelAntialiasedLayerTextEnabled", false },
+ { "TextAreasAreResizable", true },
+ { "TextAutosizingEnabled", false },
+ { "UsesBackForwardCache", false },
+ { "WebAudioEnabled", true },
+ { "WebSQLEnabled", true },
+ { "XSSAuditorEnabled", false },
+
+ // FIXME: These experimental features are currently the only ones not enabled for WebKitLegacy, we
+ // should either enable them or stop exposing them (as we do with with preferences like HTTP3Enabled).
+ // All other experimental features are automatically enabled regardless of their specified defaults.
+ { "AspectRatioOfImgFromWidthAndHeightEnabled", false },
+ { "AsyncClipboardAPIEnabled", false },
+ { "CSSOMViewSmoothScrollingEnabled", false },
+ { "ContactPickerAPIEnabled", false },
+ { "CoreMathMLEnabled", false },
+ { "GenericCueAPIEnabled", false },
+ { "IntersectionObserverEnabled", false },
+ { "IsLoggedInAPIEnabled", false },
+ { "LazyIframeLoadingEnabled", false },
+ { "LazyImageLoadingEnabled", false },
+ { "RequestIdleCallbackEnabled", false },
+ { "ResizeObserverEnabled", false },
+ { "WebAuthenticationEnabled", false },
+ { "WebGPUEnabled", false },
+#elif PLATFORM(WIN)
// These are WebPreference values that must always be set as they may
// differ from the default set in the WebPreferences*.yaml configuration.
{ "AcceleratedDrawingEnabled", false },
@@ -108,10 +167,24 @@
{ "UsesBackForwardCache", false },
{ "WebGPUEnabled", false },
{ "XSSAuditorEnabled", false },
+#endif
};
+#if PLATFORM(WIN)
features.uint32WebPreferenceFeatures = {
{ "MinimumFontSize", 0 },
};
+#endif
+#if PLATFORM(COCOA)
+ features.stringWebPreferenceFeatures = {
+ { "CursiveFontFamily", "Apple Chancery" },
+ { "FantasyFontFamily", "Papyrus" },
+ { "FixedFontFamily", "Courier" },
+ { "PictographFontFamily", "Apple Color Emoji" },
+ { "SansSerifFontFamily", "Helvetica" },
+ { "SerifFontFamily", "Times" },
+ { "StandardFontFamily", "Times" },
+ };
+#endif
}
return features;
}
Modified: trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm (274051 => 274052)
--- trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2021-03-07 05:35:25 UTC (rev 274051)
+++ trunk/Tools/DumpRenderTree/mac/DumpRenderTree.mm 2021-03-07 17:41:50 UTC (rev 274052)
@@ -856,114 +856,45 @@
return [@"~/Library/Application Support/DumpRenderTree" stringByExpandingTildeInPath];
}
-// Called before each test.
-static void resetWebPreferencesToConsistentValues(WebPreferences *preferences)
+static void setWebPreferencesForTestOptions(WebPreferences *preferences, const WTR::TestOptions& options)
{
- [preferences _resetForTesting];
+ [preferences _batchUpdatePreferencesInBlock:^(WebPreferences *preferences) {
+ [preferences _resetForTesting];
- for (WebFeature *feature in [WebPreferences _experimentalFeatures])
- [preferences _setEnabled:YES forFeature:feature];
+ for (WebFeature *feature in [WebPreferences _experimentalFeatures])
+ [preferences _setEnabled:YES forFeature:feature];
- // FIXME: These experimental features are currently the only ones not enabled for WebKitLegacy, we
- // should either enable them or stop exposing them (as we do with with preferences like HTTP3Enabled).
- [preferences _setBoolPreferenceForTestingWithValue:NO forKey:@"WebKitGenericCueAPIEnabled"];
- [preferences _setBoolPreferenceForTestingWithValue:NO forKey:@"WebKitIsLoggedInAPIEnabled"];
- [preferences _setBoolPreferenceForTestingWithValue:NO forKey:@"WebKitLazyIframeLoadingEnabled"];
- [preferences _setBoolPreferenceForTestingWithValue:NO forKey:@"WebKitLazyImageLoadingEnabled"];
- [preferences _setBoolPreferenceForTestingWithValue:NO forKey:@"WebKitWebAuthenticationEnabled"];
+ if (persistentUserStyleSheetLocation()) {
+ preferences.userStyleSheetLocation = [NSURL URLWithString:(__bridge NSString *)persistentUserStyleSheetLocation().get()];
+ preferences.userStyleSheetEnabled = YES;
+ } else
+ preferences.userStyleSheetEnabled = NO;
- if (persistentUserStyleSheetLocation()) {
- [preferences setUserStyleSheetLocation:[NSURL URLWithString:(__bridge NSString *)persistentUserStyleSheetLocation().get()]];
- [preferences setUserStyleSheetEnabled:YES];
- } else
- [preferences setUserStyleSheetEnabled:NO];
+ preferences.acceleratedDrawingEnabled = useAcceleratedDrawing;
+ preferences.editableLinkBehavior = WebKitEditableLinkOnlyLiveWithShiftKey;
+ preferences.frameFlattening = WebKitFrameFlatteningDisabled;
+ preferences.cacheModel = WebCacheModelDocumentBrowser;
-#if PLATFORM(IOS_FAMILY)
- // Enable the tracker before creating the first WebView will
- // cause initialization to use the correct database paths.
- [preferences setStorageTrackerEnabled:YES];
-#else
- [preferences setMockScrollbarsEnabled:YES];
- [preferences setShouldPrintBackgrounds:YES];
- [preferences setTextAreasAreResizable:YES];
-#endif
+ preferences.privateBrowsingEnabled = options.useEphemeralSession();
- [preferences _setTextAutosizingEnabled:NO];
- [preferences setAcceleratedCompositingEnabled:YES];
- [preferences setAcceleratedDrawingEnabled:useAcceleratedDrawing];
- [preferences setAsynchronousSpellCheckingEnabled:NO];
- [preferences setAudioPlaybackRequiresUserGesture:NO];
- [preferences setCacheModel:WebCacheModelDocumentBrowser];
- [preferences setCanvasUsesAcceleratedDrawing:YES];
- [preferences setColorFilterEnabled:YES];
- [preferences setCursiveFontFamily:@"Apple Chancery"];
- [preferences setCustomPasteboardDataEnabled:YES];
- [preferences setDataTransferItemsEnabled:YES];
- [preferences setDefaultFixedFontSize:13];
- [preferences setDefaultFontSize:16];
- [preferences setDefaultTextEncodingName:@"ISO-8859-1"];
- [preferences setDirectoryUploadEnabled:YES];
- [preferences setDownloadAttributeEnabled:YES];
- [preferences setEditableLinkBehavior:WebKitEditableLinkOnlyLiveWithShiftKey];
- [preferences setEncryptedMediaAPIEnabled:YES];
- [preferences setFantasyFontFamily:@"Papyrus"];
- [preferences setFixedFontFamily:@"Courier"];
- [preferences setFrameFlattening:WebKitFrameFlatteningDisabled];
- [preferences setGamepadsEnabled:YES];
- [preferences setHiddenPageCSSAnimationSuspensionEnabled:NO];
- [preferences setHiddenPageDOMTimerThrottlingEnabled:NO];
- [preferences setInvisibleAutoplayNotPermitted:NO];
- [preferences setJavaEnabled:NO];
- [preferences setJavaScriptRuntimeFlags:WebKitJavaScriptRuntimeFlagsAllEnabled];
- [preferences setLargeImageAsyncDecodingEnabled:NO];
- [preferences setLinkPreloadEnabled:YES];
- [preferences setLoadsSiteIconsIgnoringImageLoadingPreference:NO];
- [preferences setMediaCapabilitiesEnabled:YES];
- [preferences setMediaDataLoadsAutomatically:YES];
- [preferences setMediaDevicesEnabled:YES];
- [preferences setMediaPlaybackAllowsInline:YES];
- [preferences setMediaPlaybackRequiresUserGesture:NO];
- [preferences setMediaPreloadingEnabled:YES];
- [preferences setMediaSourceEnabled:YES];
- [preferences setMetaRefreshEnabled:YES];
- [preferences setModernMediaControlsEnabled:YES];
- [preferences setOfflineWebApplicationCacheEnabled:YES];
- [preferences setPictographFontFamily:@"Apple Color Emoji"];
- [preferences setSansSerifFontFamily:@"Helvetica"];
- [preferences setSelectionAcrossShadowBoundariesEnabled:YES];
- [preferences setSerifFontFamily:@"Times"];
- [preferences setSourceBufferChangeTypeEnabled:YES];
- [preferences setStandardFontFamily:@"Times"];
- [preferences setSubpixelAntialiasedLayerTextEnabled:NO];
- [preferences setVideoPlaybackRequiresUserGesture:NO];
- [preferences setWebAudioEnabled:YES];
- [preferences setWebSQLEnabled:YES];
+ for (const auto& [key, value] : options.boolWebPreferenceFeatures())
+ [preferences _setBoolPreferenceForTestingWithValue:value forKey:toNS(WTR::TestOptions::toWebKitLegacyPreferenceKey(key)).get()];
- [WebPreferences _clearNetworkLoaderSession];
- [WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain];
-}
+ for (const auto& [key, value] : options.doubleWebPreferenceFeatures())
+ [preferences _setDoublePreferenceForTestingWithValue:value forKey:toNS(WTR::TestOptions::toWebKitLegacyPreferenceKey(key)).get()];
-template<typename T> T webPreferenceFeatureValue(const std::string& key, const std::unordered_map<std::string, T>& map)
-{
- auto it = map.find(key);
- ASSERT(it != map.end());
- return it->second;
-}
+ for (const auto& [key, value] : options.uint32WebPreferenceFeatures())
+ [preferences _setUInt32PreferenceForTestingWithValue:value forKey:toNS(WTR::TestOptions::toWebKitLegacyPreferenceKey(key)).get()];
-static void setWebPreferencesForTestOptions(WebPreferences *preferences, const WTR::TestOptions& options)
-{
- [preferences _batchUpdatePreferencesInBlock:^(WebPreferences *preferences) {
- resetWebPreferencesToConsistentValues(preferences);
+ for (const auto& [key, value] : options.stringWebPreferenceFeatures())
+ [preferences _setStringPreferenceForTestingWithValue:toNS(value).get() forKey:toNS(WTR::TestOptions::toWebKitLegacyPreferenceKey(key)).get()];
- preferences.privateBrowsingEnabled = options.useEphemeralSession();
+ // FIXME: Tests currently expect this to always be false in WebKitLegacy testing - https://bugs.webkit.org/show_bug.cgi?id=222864.
+ [preferences _setBoolPreferenceForTestingWithValue:NO forKey:@"WebKitLayoutFormattingContextEnabled"];
+ }];
- // FIXME: Remove these once there is a viable mechanism for reseting WebPreferences between tests,
- // at which point, we will not need to manually reset every supported preference for each test.
- for (const auto& key : options.supportedBoolWebPreferenceFeatures())
- [preferences _setBoolPreferenceForTestingWithValue:webPreferenceFeatureValue(key, options.boolWebPreferenceFeatures()) forKey:toNS(WTR::TestOptions::toWebKitLegacyPreferenceKey(key)).get()];
- for (const auto& key : options.supportedUInt32WebPreferenceFeatures())
- [preferences _setUInt32PreferenceForTestingWithValue:webPreferenceFeatureValue(key, options.uint32WebPreferenceFeatures()) forKey:toNS(WTR::TestOptions::toWebKitLegacyPreferenceKey(key)).get()];
- }];
+ [WebPreferences _clearNetworkLoaderSession];
+ [WebPreferences _setCurrentNetworkLoaderSessionCookieAcceptPolicy:NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain];
}
// Called once on DumpRenderTree startup.
@@ -987,9 +918,6 @@
@"AppleOtherHighlightColor":@"0.500000 0.500000 0.500000",
@"AppleLanguages": @[ @"en" ],
WebKitEnableFullDocumentTeardownPreferenceKey: @YES,
- WebKitFullScreenEnabledPreferenceKey: @YES,
- WebKitAllowsInlineMediaPlaybackPreferenceKey: @YES,
- WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey: @NO,
@"UseWebKitWebInspector": @YES,
#if !PLATFORM(IOS_FAMILY)
@"NSPreferredSpellServerLanguage": @"en_US",
@@ -1158,7 +1086,7 @@
static void prepareConsistentTestingEnvironment()
{
-#if !PLATFORM(IOS_FAMILY)
+#if PLATFORM(MAC)
poseAsClass("DumpRenderTreePasteboard", "NSPasteboard");
poseAsClass("DumpRenderTreeEvent", "NSEvent");
#else
@@ -1173,7 +1101,7 @@
[WebPreferences _switchNetworkLoaderToNewTestingSession];
-#if !PLATFORM(IOS_FAMILY)
+#if PLATFORM(MAC)
adjustFonts();
registerMockScrollbars();
@@ -1181,6 +1109,9 @@
[[WebPreferences standardPreferences] setMockScrollbarsEnabled:YES];
#else
activateFontsIOS();
+
+ // Enable the tracker before creating the first WebView will cause initialization to use the correct database paths.
+ [[WebPreferences standardPreferences] setStorageTrackerEnabled:YES];
#endif
allocateGlobalControllers();