New SPI to export a dictionary of runtime features
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Apr 2016 01:46:48 +0000 (01:46 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Apr 2016 01:46:48 +0000 (01:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=156645
<rdar://problem/23621666>

Reviewed by Darin Adler.

Source/WebKit2:

Add a new type of Preference for experimental features so that we
can dynamically toggle them from a WebKit2 host. These are special
keys that are tied to runtime flags. The host process can ask WebKit
for the list of keys, each with a small description, in order to
display UI.

- Add HumanReadableName and HumanReadableDescription parameters to our
  macros, which are used when building a ExperimentalFeature.
  These are both empty strings for the existing preferences. At some
  point we should probably move all this to code generation rather
  than macros, so that we don't have to carry around unused parameters.

- I've included two sample experimental features: WebGL2 and ShadowDOM.
  They are not actually hooked up to the runtime settings yet, but its
  pretty clear how that will happen. Note that these are new preferences
  that have an "Experimental" prefix. This is so toggling an experimental
  feature to off won't cause the feature to not work once it becomes
  stable enough to enable by default. In other words, when it moves
  out of the experimental stage, the experimental feature flag will be
  removed, and you'll no longer check for values with that key.

- The ExperimentalFeature object is what the host process
  will read in order to show some UI. It contains the human readable info,
  as well as the actual key that can be used to query and toggle the
  experimental feature.

* Shared/API/APIObject.h: Add the ExperimentalFeature.

* Shared/Cocoa/APIObject.mm:
(API::Object::newObject): Exposes a wrapper around a _WKExperimentalFeature ObjC type.

* Shared/WebPreferencesDefinitions.h: Change all the existing macros to take the new
parameters, and add the initial experimental keys.

* Shared/WebPreferencesKeys.cpp: Add new parameters to existing macros.
* Shared/WebPreferencesKeys.h: Ditto.
* Shared/WebPreferencesStore.cpp: Ditto.
(WebKit::defaults):

* UIProcess/API/APIExperimentalFeature.cpp: The API side of the ExperimentalFeature.
(API::ExperimentalFeature::create):
(API::ExperimentalFeature::ExperimentalFeature):
(API::ExperimentalFeature::~ExperimentalFeature):
* UIProcess/API/APIExperimentalFeature.h:

* UIProcess/API/Cocoa/WKPreferences.mm: The actual implementation of the SPI.
(+[WKPreferences _experimentalFeatures]): Create and return a list of feature descriptors.
(-[WKPreferences _isEnabledForFeature:]): Get the value.
(-[WKPreferences _setEnabled:forFeature:]): Set the value.
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

* UIProcess/API/Cocoa/_WKExperimentalFeature.h: The ObjC version.
* UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
(-[_WKExperimentalFeature dealloc]):
(-[_WKExperimentalFeature description]):
(-[_WKExperimentalFeature name]):
(-[_WKExperimentalFeature key]):
(-[_WKExperimentalFeature details]):
(-[_WKExperimentalFeature _apiObject]):
* UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h: Implementation of the wrapper.
(WebKit::wrapper):

* UIProcess/WebPreferences.cpp: The C++ implementation that provides the data for the ObjC API.
(WebKit::globalExperimentalFeatures):
(WebKit::WebPreferences::ExperimentalFeatures):
(WebKit::WebPreferences::isEnabledForFeature):
(WebKit::WebPreferences::setEnabledForFeature):
* UIProcess/WebPreferences.h:

* UIProcess/mac/WebPreferencesMac.mm: Update some macros.
(WebKit::WebPreferences::platformInitializeStore):
* WebProcess/WebPage/WebPage.cpp: Ditto
(WebKit::WebPage::updatePreferences):

* WebKit2.xcodeproj/project.pbxproj: Add the new files.

Tools:

Test the experimental features SPI on WKPreferences.

* TestWebKitAPI/Tests/WebKit2Cocoa/Preferences.mm:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199700 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/API/APIObject.h
Source/WebKit2/Shared/Cocoa/APIObject.mm
Source/WebKit2/Shared/WebPreferencesDefinitions.h
Source/WebKit2/Shared/WebPreferencesKeys.cpp
Source/WebKit2/Shared/WebPreferencesKeys.h
Source/WebKit2/Shared/WebPreferencesStore.cpp
Source/WebKit2/UIProcess/API/APIExperimentalFeature.cpp [new file with mode: 0644]
Source/WebKit2/UIProcess/API/APIExperimentalFeature.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/C/WKAPICast.h
Source/WebKit2/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit2/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Source/WebKit2/UIProcess/API/Cocoa/_WKExperimentalFeature.h [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/_WKExperimentalFeature.mm [new file with mode: 0644]
Source/WebKit2/UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h [new file with mode: 0644]
Source/WebKit2/UIProcess/WebPreferences.cpp
Source/WebKit2/UIProcess/WebPreferences.h
Source/WebKit2/UIProcess/mac/WebPreferencesMac.mm
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Preferences.mm

index 482a4e5..9ce2a5f 100644 (file)
@@ -1,3 +1,87 @@
+2016-04-18  Dean Jackson  <dino@apple.com>
+
+        New SPI to export a dictionary of runtime features
+        https://bugs.webkit.org/show_bug.cgi?id=156645
+        <rdar://problem/23621666>
+
+        Reviewed by Darin Adler.
+
+        Add a new type of Preference for experimental features so that we
+        can dynamically toggle them from a WebKit2 host. These are special
+        keys that are tied to runtime flags. The host process can ask WebKit
+        for the list of keys, each with a small description, in order to
+        display UI.
+
+        - Add HumanReadableName and HumanReadableDescription parameters to our
+          macros, which are used when building a ExperimentalFeature.
+          These are both empty strings for the existing preferences. At some
+          point we should probably move all this to code generation rather
+          than macros, so that we don't have to carry around unused parameters.
+
+        - I've included two sample experimental features: WebGL2 and ShadowDOM.
+          They are not actually hooked up to the runtime settings yet, but its
+          pretty clear how that will happen. Note that these are new preferences
+          that have an "Experimental" prefix. This is so toggling an experimental
+          feature to off won't cause the feature to not work once it becomes
+          stable enough to enable by default. In other words, when it moves
+          out of the experimental stage, the experimental feature flag will be
+          removed, and you'll no longer check for values with that key.
+
+        - The ExperimentalFeature object is what the host process
+          will read in order to show some UI. It contains the human readable info,
+          as well as the actual key that can be used to query and toggle the
+          experimental feature.
+
+        * Shared/API/APIObject.h: Add the ExperimentalFeature.
+
+        * Shared/Cocoa/APIObject.mm:
+        (API::Object::newObject): Exposes a wrapper around a _WKExperimentalFeature ObjC type.
+
+        * Shared/WebPreferencesDefinitions.h: Change all the existing macros to take the new
+        parameters, and add the initial experimental keys.
+
+        * Shared/WebPreferencesKeys.cpp: Add new parameters to existing macros.
+        * Shared/WebPreferencesKeys.h: Ditto.
+        * Shared/WebPreferencesStore.cpp: Ditto.
+        (WebKit::defaults):
+
+        * UIProcess/API/APIExperimentalFeature.cpp: The API side of the ExperimentalFeature.
+        (API::ExperimentalFeature::create):
+        (API::ExperimentalFeature::ExperimentalFeature):
+        (API::ExperimentalFeature::~ExperimentalFeature):
+        * UIProcess/API/APIExperimentalFeature.h:
+
+        * UIProcess/API/Cocoa/WKPreferences.mm: The actual implementation of the SPI.
+        (+[WKPreferences _experimentalFeatures]): Create and return a list of feature descriptors.
+        (-[WKPreferences _isEnabledForFeature:]): Get the value.
+        (-[WKPreferences _setEnabled:forFeature:]): Set the value.
+        * UIProcess/API/Cocoa/WKPreferencesPrivate.h:
+
+        * UIProcess/API/Cocoa/_WKExperimentalFeature.h: The ObjC version.
+        * UIProcess/API/Cocoa/_WKExperimentalFeature.mm:
+        (-[_WKExperimentalFeature dealloc]):
+        (-[_WKExperimentalFeature description]):
+        (-[_WKExperimentalFeature name]):
+        (-[_WKExperimentalFeature key]):
+        (-[_WKExperimentalFeature details]):
+        (-[_WKExperimentalFeature _apiObject]):
+        * UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h: Implementation of the wrapper.
+        (WebKit::wrapper):
+
+        * UIProcess/WebPreferences.cpp: The C++ implementation that provides the data for the ObjC API.
+        (WebKit::globalExperimentalFeatures):
+        (WebKit::WebPreferences::ExperimentalFeatures):
+        (WebKit::WebPreferences::isEnabledForFeature):
+        (WebKit::WebPreferences::setEnabledForFeature):
+        * UIProcess/WebPreferences.h:
+
+        * UIProcess/mac/WebPreferencesMac.mm: Update some macros.
+        (WebKit::WebPreferences::platformInitializeStore):
+        * WebProcess/WebPage/WebPage.cpp: Ditto
+        (WebKit::WebPage::updatePreferences):
+
+        * WebKit2.xcodeproj/project.pbxproj: Add the new files.
+
 2016-04-18  Tim Horton  <timothy_horton@apple.com>
 
         Swipe view gesture should be reversed in right-to-left contexts
index 7f9f760..ddef3c3 100644 (file)
@@ -107,6 +107,7 @@ public:
         ColorPickerResultListener,
         CookieManager,
         Download,
+        ExperimentalFeature,
         FormSubmissionListener,
         Frame,
         FrameInfo,
index 157189e..51b19aa 100644 (file)
@@ -64,6 +64,7 @@
 #import "WKWindowFeaturesInternal.h"
 #import "_WKAutomationSessionInternal.h"
 #import "_WKDownloadInternal.h"
+#import "_WKExperimentalFeatureInternal.h"
 #import "_WKFrameHandleInternal.h"
 #import "_WKHitTestResultInternal.h"
 #import "_WKProcessPoolConfigurationInternal.h"
@@ -150,6 +151,10 @@ void* Object::newObject(size_t size, Type type)
         wrapper = [_WKDownload alloc];
         break;
 
+    case Type::ExperimentalFeature:
+        wrapper = [_WKExperimentalFeature alloc];
+        break;
+
     case Type::Error:
         wrapper = NSAllocateObject([WKNSError self], size, nullptr);
         break;
index d4d20ab..36ed83c 100644 (file)
 #define DEFAULT_CANVAS_USES_ACCELERATED_DRAWING true
 #endif
 
-// macro(KeyUpper, KeyLower, TypeNameUpper, TypeName, DefaultValue)
+// macro(KeyUpper, KeyLower, TypeNameUpper, TypeName, DefaultValue, HumanReadableName, HumanReadableDescription)
 
 #define FOR_EACH_WEBKIT_BOOL_PREFERENCE(macro) \
-    macro(JavaScriptEnabled, javaScriptEnabled, Bool, bool, true) \
-    macro(JavaScriptMarkupEnabled, javaScriptMarkupEnabled, Bool, bool, true) \
-    macro(LoadsImagesAutomatically, loadsImagesAutomatically, Bool, bool, true) \
-    macro(LoadsSiteIconsIgnoringImageLoadingPreference, loadsSiteIconsIgnoringImageLoadingPreference, Bool, bool, false) \
-    macro(PluginsEnabled, pluginsEnabled, Bool, bool, false) \
-    macro(JavaEnabled, javaEnabled, Bool, bool, false) \
-    macro(JavaEnabledForLocalFiles, javaEnabledForLocalFiles, Bool, bool, false) \
-    macro(OfflineWebApplicationCacheEnabled, offlineWebApplicationCacheEnabled, Bool, bool, false) \
-    macro(LocalStorageEnabled, localStorageEnabled, Bool, bool, true) \
-    macro(DatabasesEnabled, databasesEnabled, Bool, bool, true) \
-    macro(XSSAuditorEnabled, xssAuditorEnabled, Bool, bool, true) \
-    macro(FrameFlatteningEnabled, frameFlatteningEnabled, Bool, bool, DEFAULT_FRAME_FLATTENING_ENABLED) \
-    macro(PrivateBrowsingEnabled, privateBrowsingEnabled, Bool, bool, false) \
-    macro(TextAreasAreResizable, textAreasAreResizable, Bool, bool, DEFAULT_TEXT_AREAS_ARE_RESIZABLE) \
-    macro(JavaScriptCanOpenWindowsAutomatically, javaScriptCanOpenWindowsAutomatically, Bool, bool, DEFAULT_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY) \
-    macro(HyperlinkAuditingEnabled, hyperlinkAuditingEnabled, Bool, bool, true) \
-    macro(NeedsSiteSpecificQuirks, needsSiteSpecificQuirks, Bool, bool, false) \
-    macro(AcceleratedCompositingEnabled, acceleratedCompositingEnabled, Bool, bool, true) \
-    macro(ForceCompositingMode, forceCompositingMode, Bool, bool, false) \
-    macro(CanvasUsesAcceleratedDrawing, canvasUsesAcceleratedDrawing, Bool, bool, DEFAULT_CANVAS_USES_ACCELERATED_DRAWING) \
-    macro(WebGLEnabled, webGLEnabled, Bool, bool, true) \
-    macro(ForceSoftwareWebGLRendering, forceSoftwareWebGLRendering, Bool, bool, false) \
-    macro(Accelerated2dCanvasEnabled, accelerated2dCanvasEnabled, Bool, bool, false) \
-    macro(CSSAnimationTriggersEnabled, cssAnimationTriggersEnabled, Bool, bool, true) \
-    macro(WebAnimationsEnabled, webAnimationsEnabled, Bool, bool, false) \
-    macro(CSSRegionsEnabled, cssRegionsEnabled, Bool, bool, true) \
-    macro(CSSCompositingEnabled, cssCompositingEnabled, Bool, bool, true) \
-    macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false) \
-    macro(TabsToLinks, tabsToLinks, Bool, bool, DEFAULT_WEBKIT_TABSTOLINKS_ENABLED) \
-    macro(DNSPrefetchingEnabled, dnsPrefetchingEnabled, Bool, bool, false) \
-    macro(DOMTimersThrottlingEnabled, domTimersThrottlingEnabled, Bool, bool, true) \
-    macro(WebArchiveDebugModeEnabled, webArchiveDebugModeEnabled, Bool, bool, false) \
-    macro(LocalFileContentSniffingEnabled, localFileContentSniffingEnabled, Bool, bool, false) \
-    macro(UsesPageCache, usesPageCache, Bool, bool, true) \
-    macro(PageCacheSupportsPlugins, pageCacheSupportsPlugins, Bool, bool, true) \
-    macro(AuthorAndUserStylesEnabled, authorAndUserStylesEnabled, Bool, bool, true) \
-    macro(PaginateDuringLayoutEnabled, paginateDuringLayoutEnabled, Bool, bool, false) \
-    macro(DOMPasteAllowed, domPasteAllowed, Bool, bool, false) \
-    macro(JavaScriptCanAccessClipboard, javaScriptCanAccessClipboard, Bool, bool, false) \
-    macro(ShouldPrintBackgrounds, shouldPrintBackgrounds, Bool, bool, DEFAULT_SHOULD_PRINT_BACKGROUNDS) \
-    macro(FullScreenEnabled, fullScreenEnabled, Bool, bool, false) \
-    macro(AsynchronousSpellCheckingEnabled, asynchronousSpellCheckingEnabled, Bool, bool, false) \
-    macro(WebSecurityEnabled, webSecurityEnabled, Bool, bool, true) \
-    macro(AllowUniversalAccessFromFileURLs, allowUniversalAccessFromFileURLs, Bool, bool, false) \
-    macro(AllowFileAccessFromFileURLs, allowFileAccessFromFileURLs, Bool, bool, false) \
-    macro(AVFoundationEnabled, isAVFoundationEnabled, Bool, bool, true) \
-    macro(AVFoundationNSURLSessionEnabled, isAVFoundationNSURLSessionEnabled, Bool, bool, true) \
-    macro(RequiresUserGestureForMediaPlayback, requiresUserGestureForMediaPlayback, Bool, bool, DEFAULT_REQUIRES_USER_GESTURE_FOR_MEDIA_PLAYBACK) \
-    macro(RequiresUserGestureForVideoPlayback, requiresUserGestureForVideoPlayback, Bool, bool, false) \
-    macro(RequiresUserGestureForAudioPlayback, requiresUserGestureForAudioPlayback, Bool, bool, false) \
-    macro(MainContentUserGestureOverrideEnabled, mainContentUserGestureOverrideEnabled, Bool, bool, false) \
-    macro(AllowsInlineMediaPlayback, allowsInlineMediaPlayback, Bool, bool, DEFAULT_ALLOWS_INLINE_MEDIA_PLAYBACK) \
-    macro(InlineMediaPlaybackRequiresPlaysInlineAttribute, inlineMediaPlaybackRequiresPlaysInlineAttribute, Bool, bool, DEFAULT_INLINE_MEDIA_PLAYBACK_REQUIRES_PLAYS_INLINE_ATTRIBUTE) \
-    macro(InvisibleAutoplayNotPermitted, invisibleAutoplayNotPermitted, Bool, bool, DEFAULT_INVISIBLE_AUTOPLAY_NOT_PERMITTED) \
-    macro(MediaDataLoadsAutomatically, mediaDataLoadsAutomatically, Bool, bool, DEFAULT_MEDIA_DATA_LOADS_AUTOMATICALLY) \
-    macro(AllowsPictureInPictureMediaPlayback, allowsPictureInPictureMediaPlayback, Bool, bool, true) \
-    macro(AllowsAirPlayForMediaPlayback, allowsAirPlayForMediaPlayback, Bool, bool, true) \
-    macro(MediaControlsScaleWithPageZoom, mediaControlsScaleWithPageZoom, Bool, bool, DEFAULT_MEDIA_CONTROLS_SCALE_WITH_PAGE_ZOOM) \
-    macro(InspectorStartsAttached, inspectorStartsAttached, Bool, bool, true) \
-    macro(ShowsToolTipOverTruncatedText, showsToolTipOverTruncatedText, Bool, bool, false) \
-    macro(MockScrollbarsEnabled, mockScrollbarsEnabled, Bool, bool, false) \
-    macro(WebAudioEnabled, webAudioEnabled, Bool, bool, true) \
-    macro(AttachmentElementEnabled, attachmentElementEnabled, Bool, bool, false) \
-    macro(SuppressesIncrementalRendering, suppressesIncrementalRendering, Bool, bool, false) \
-    macro(BackspaceKeyNavigationEnabled, backspaceKeyNavigationEnabled, Bool, bool, DEFAULT_BACKSPACE_KEY_NAVIGATION_ENABLED) \
-    macro(CaretBrowsingEnabled, caretBrowsingEnabled, Bool, bool, false) \
-    macro(ShouldDisplaySubtitles, shouldDisplaySubtitles, Bool, bool, false) \
-    macro(ShouldDisplayCaptions, shouldDisplayCaptions, Bool, bool, false) \
-    macro(ShouldDisplayTextDescriptions, shouldDisplayTextDescriptions, Bool, bool, false) \
-    macro(NotificationsEnabled, notificationsEnabled, Bool, bool, true) \
-    macro(ShouldRespectImageOrientation, shouldRespectImageOrientation, Bool, bool, DEFAULT_SHOULD_RESPECT_IMAGE_ORIENTATION) \
-    macro(WantsBalancedSetDefersLoadingBehavior, wantsBalancedSetDefersLoadingBehavior, Bool, bool, false) \
-    macro(RequestAnimationFrameEnabled, requestAnimationFrameEnabled, Bool, bool, true) \
-    macro(DiagnosticLoggingEnabled, diagnosticLoggingEnabled, Bool, bool, false) \
-    macro(AsynchronousPluginInitializationEnabled, asynchronousPluginInitializationEnabled, Bool, bool, false) \
-    macro(AsynchronousPluginInitializationEnabledForAllPlugins, asynchronousPluginInitializationEnabledForAllPlugins, Bool, bool, false) \
-    macro(ArtificialPluginInitializationDelayEnabled, artificialPluginInitializationDelayEnabled, Bool, bool, false) \
-    macro(TabToLinksEnabled, tabToLinksEnabled, Bool, bool, false) \
-    macro(InteractiveFormValidationEnabled, interactiveFormValidationEnabled, Bool, bool, false) \
-    macro(ScrollingPerformanceLoggingEnabled, scrollingPerformanceLoggingEnabled, Bool, bool, false) \
-    macro(ScrollAnimatorEnabled, scrollAnimatorEnabled, Bool, bool, DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED) \
-    macro(ForceUpdateScrollbarsOnMainThreadForPerformanceTesting, forceUpdateScrollbarsOnMainThreadForPerformanceTesting, Bool, bool, false) \
-    macro(CookieEnabled, cookieEnabled, Bool, bool, true) \
-    macro(PlugInSnapshottingEnabled, plugInSnapshottingEnabled, Bool, bool, false) \
-    macro(SnapshotAllPlugIns, snapshotAllPlugIns, Bool, bool, false) \
-    macro(AutostartOriginPlugInSnapshottingEnabled, autostartOriginPlugInSnapshottingEnabled, Bool, bool, true) \
-    macro(PrimaryPlugInSnapshotDetectionEnabled, primaryPlugInSnapshotDetectionEnabled, Bool, bool, true) \
-    macro(PDFPluginEnabled, pdfPluginEnabled, Bool, bool, DEFAULT_PDFPLUGIN_ENABLED) \
-    macro(UsesEncodingDetector, usesEncodingDetector, Bool, bool, false) \
-    macro(TextAutosizingEnabled, textAutosizingEnabled, Bool, bool, false) \
-    macro(AggressiveTileRetentionEnabled, aggressiveTileRetentionEnabled, Bool, bool, false) \
-    macro(TemporaryTileCohortRetentionEnabled, temporaryTileCohortRetentionEnabled, Bool, bool, DEFAULT_TEMPORARY_TILE_COHORT_RETENTION_ENABLED) \
-    macro(QTKitEnabled, isQTKitEnabled, Bool, bool, WebCore::Settings::isQTKitEnabled()) \
-    macro(PageVisibilityBasedProcessSuppressionEnabled, pageVisibilityBasedProcessSuppressionEnabled, Bool, bool, true) \
-    macro(SmartInsertDeleteEnabled, smartInsertDeleteEnabled, Bool, bool, true) \
-    macro(SelectTrailingWhitespaceEnabled, selectTrailingWhitespaceEnabled, Bool, bool, false) \
-    macro(ShowsURLsInToolTipsEnabled, showsURLsInToolTipsEnabled, Bool, bool, false) \
-    macro(AcceleratedCompositingForOverflowScrollEnabled, acceleratedCompositingForOverflowScrollEnabled, Bool, bool, false) \
-    macro(HiddenPageDOMTimerThrottlingEnabled, hiddenPageDOMTimerThrottlingEnabled, Bool, bool, DEFAULT_HIDDEN_PAGE_DOM_TIMER_THROTTLING_ENABLED) \
-    macro(HiddenPageDOMTimerThrottlingAutoIncreases, hiddenPageDOMTimerThrottlingAutoIncreases, Bool, bool, false) \
-    macro(HiddenPageCSSAnimationSuspensionEnabled, hiddenPageCSSAnimationSuspensionEnabled, Bool, bool, DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED) \
-    macro(LowPowerVideoAudioBufferSizeEnabled, lowPowerVideoAudioBufferSizeEnabled, Bool, bool, false) \
-    macro(ThreadedScrollingEnabled, threadedScrollingEnabled, Bool, bool, true) \
-    macro(SimpleLineLayoutEnabled, simpleLineLayoutEnabled, Bool, bool, true) \
-    macro(SubpixelCSSOMElementMetricsEnabled, subpixelCSSOMElementMetricsEnabled, Bool, bool, false) \
-    macro(UseGiantTiles, useGiantTiles, Bool, bool, false) \
-    macro(MediaStreamEnabled, mediaStreamEnabled, Bool, bool, false) \
-    macro(UseLegacyTextAlignPositionedElementBehavior, useLegacyTextAlignPositionedElementBehavior, Bool, bool, false) \
-    macro(SpatialNavigationEnabled, spatialNavigationEnabled, Bool, bool, false) \
-    macro(MediaSourceEnabled, mediaSourceEnabled, Bool, bool, true) \
-    macro(ViewGestureDebuggingEnabled, viewGestureDebuggingEnabled, Bool, bool, false) \
-    macro(ShouldConvertPositionStyleOnCopy, shouldConvertPositionStyleOnCopy, Bool, bool, false) \
-    macro(Standalone, standalone, Bool, bool, false) \
-    macro(TelephoneNumberParsingEnabled, telephoneNumberParsingEnabled, Bool, bool, false) \
-    macro(AllowMultiElementImplicitSubmission, allowMultiElementImplicitSubmission, Bool, bool, false) \
-    macro(AlwaysUseAcceleratedOverflowScroll, alwaysUseAcceleratedOverflowScroll, Bool, bool, false) \
-    macro(PasswordEchoEnabled, passwordEchoEnabled, Bool, bool, DEFAULT_PASSWORD_ECHO_ENABLED) \
-    macro(ImageControlsEnabled, imageControlsEnabled, Bool, bool, false) \
-    macro(EnableInheritURIQueryComponent, enableInheritURIQueryComponent, Bool, bool, false) \
-    macro(ServiceControlsEnabled, serviceControlsEnabled, Bool, bool, false) \
-    macro(GamepadsEnabled, gamepadsEnabled, Bool, bool, false) \
-    macro(NewBlockInsideInlineModelEnabled, newBlockInsideInlineModelEnabled, Bool, bool, false) \
-    macro(HTTPEquivEnabled, httpEquivEnabled, Bool, bool, true) \
-    macro(MockCaptureDevicesEnabled, mockCaptureDevicesEnabled, Bool, bool, false) \
-    macro(ShadowDOMEnabled, shadowDOMEnabled, Bool, bool, true) \
-    macro(CustomElementsEnabled, customElementsEnabled, Bool, bool, false) \
-    macro(FetchAPIEnabled, fetchAPIEnabled, Bool, bool, false) \
-    macro(WebGL2Enabled, webGL2Enabled, Bool, bool, false) \
-    macro(DownloadAttributeEnabled, downloadAttributeEnabled, Bool, bool, false) \
+    macro(JavaScriptEnabled, javaScriptEnabled, Bool, bool, true, "", "") \
+    macro(JavaScriptMarkupEnabled, javaScriptMarkupEnabled, Bool, bool, true, "", "") \
+    macro(LoadsImagesAutomatically, loadsImagesAutomatically, Bool, bool, true, "", "") \
+    macro(LoadsSiteIconsIgnoringImageLoadingPreference, loadsSiteIconsIgnoringImageLoadingPreference, Bool, bool, false, "", "") \
+    macro(PluginsEnabled, pluginsEnabled, Bool, bool, false, "", "") \
+    macro(JavaEnabled, javaEnabled, Bool, bool, false, "", "") \
+    macro(JavaEnabledForLocalFiles, javaEnabledForLocalFiles, Bool, bool, false, "", "") \
+    macro(OfflineWebApplicationCacheEnabled, offlineWebApplicationCacheEnabled, Bool, bool, false, "", "") \
+    macro(LocalStorageEnabled, localStorageEnabled, Bool, bool, true, "", "") \
+    macro(DatabasesEnabled, databasesEnabled, Bool, bool, true, "", "") \
+    macro(XSSAuditorEnabled, xssAuditorEnabled, Bool, bool, true, "", "") \
+    macro(FrameFlatteningEnabled, frameFlatteningEnabled, Bool, bool, DEFAULT_FRAME_FLATTENING_ENABLED, "", "") \
+    macro(PrivateBrowsingEnabled, privateBrowsingEnabled, Bool, bool, false, "", "") \
+    macro(TextAreasAreResizable, textAreasAreResizable, Bool, bool, DEFAULT_TEXT_AREAS_ARE_RESIZABLE, "", "") \
+    macro(JavaScriptCanOpenWindowsAutomatically, javaScriptCanOpenWindowsAutomatically, Bool, bool, DEFAULT_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY, "", "") \
+    macro(HyperlinkAuditingEnabled, hyperlinkAuditingEnabled, Bool, bool, true, "", "") \
+    macro(NeedsSiteSpecificQuirks, needsSiteSpecificQuirks, Bool, bool, false, "", "") \
+    macro(AcceleratedCompositingEnabled, acceleratedCompositingEnabled, Bool, bool, true, "", "") \
+    macro(ForceCompositingMode, forceCompositingMode, Bool, bool, false, "", "") \
+    macro(CanvasUsesAcceleratedDrawing, canvasUsesAcceleratedDrawing, Bool, bool, DEFAULT_CANVAS_USES_ACCELERATED_DRAWING, "", "") \
+    macro(WebGLEnabled, webGLEnabled, Bool, bool, true, "", "") \
+    macro(ForceSoftwareWebGLRendering, forceSoftwareWebGLRendering, Bool, bool, false, "", "") \
+    macro(Accelerated2dCanvasEnabled, accelerated2dCanvasEnabled, Bool, bool, false, "", "") \
+    macro(CSSAnimationTriggersEnabled, cssAnimationTriggersEnabled, Bool, bool, true, "", "") \
+    macro(WebAnimationsEnabled, webAnimationsEnabled, Bool, bool, false, "", "") \
+    macro(CSSRegionsEnabled, cssRegionsEnabled, Bool, bool, true, "", "") \
+    macro(CSSCompositingEnabled, cssCompositingEnabled, Bool, bool, true, "", "") \
+    macro(ForceFTPDirectoryListings, forceFTPDirectoryListings, Bool, bool, false, "", "") \
+    macro(TabsToLinks, tabsToLinks, Bool, bool, DEFAULT_WEBKIT_TABSTOLINKS_ENABLED, "", "") \
+    macro(DNSPrefetchingEnabled, dnsPrefetchingEnabled, Bool, bool, false, "", "") \
+    macro(DOMTimersThrottlingEnabled, domTimersThrottlingEnabled, Bool, bool, true, "", "") \
+    macro(WebArchiveDebugModeEnabled, webArchiveDebugModeEnabled, Bool, bool, false, "", "") \
+    macro(LocalFileContentSniffingEnabled, localFileContentSniffingEnabled, Bool, bool, false, "", "") \
+    macro(UsesPageCache, usesPageCache, Bool, bool, true, "", "") \
+    macro(PageCacheSupportsPlugins, pageCacheSupportsPlugins, Bool, bool, true, "", "") \
+    macro(AuthorAndUserStylesEnabled, authorAndUserStylesEnabled, Bool, bool, true, "", "") \
+    macro(PaginateDuringLayoutEnabled, paginateDuringLayoutEnabled, Bool, bool, false, "", "") \
+    macro(DOMPasteAllowed, domPasteAllowed, Bool, bool, false, "", "") \
+    macro(JavaScriptCanAccessClipboard, javaScriptCanAccessClipboard, Bool, bool, false, "", "") \
+    macro(ShouldPrintBackgrounds, shouldPrintBackgrounds, Bool, bool, DEFAULT_SHOULD_PRINT_BACKGROUNDS, "", "") \
+    macro(FullScreenEnabled, fullScreenEnabled, Bool, bool, false, "", "") \
+    macro(AsynchronousSpellCheckingEnabled, asynchronousSpellCheckingEnabled, Bool, bool, false, "", "") \
+    macro(WebSecurityEnabled, webSecurityEnabled, Bool, bool, true, "", "") \
+    macro(AllowUniversalAccessFromFileURLs, allowUniversalAccessFromFileURLs, Bool, bool, false, "", "") \
+    macro(AllowFileAccessFromFileURLs, allowFileAccessFromFileURLs, Bool, bool, false, "", "") \
+    macro(AVFoundationEnabled, isAVFoundationEnabled, Bool, bool, true, "", "") \
+    macro(AVFoundationNSURLSessionEnabled, isAVFoundationNSURLSessionEnabled, Bool, bool, true, "", "") \
+    macro(RequiresUserGestureForMediaPlayback, requiresUserGestureForMediaPlayback, Bool, bool, DEFAULT_REQUIRES_USER_GESTURE_FOR_MEDIA_PLAYBACK, "", "") \
+    macro(RequiresUserGestureForVideoPlayback, requiresUserGestureForVideoPlayback, Bool, bool, false, "", "") \
+    macro(RequiresUserGestureForAudioPlayback, requiresUserGestureForAudioPlayback, Bool, bool, false, "", "") \
+    macro(MainContentUserGestureOverrideEnabled, mainContentUserGestureOverrideEnabled, Bool, bool, false, "", "") \
+    macro(AllowsInlineMediaPlayback, allowsInlineMediaPlayback, Bool, bool, DEFAULT_ALLOWS_INLINE_MEDIA_PLAYBACK, "", "") \
+    macro(InlineMediaPlaybackRequiresPlaysInlineAttribute, inlineMediaPlaybackRequiresPlaysInlineAttribute, Bool, bool, DEFAULT_INLINE_MEDIA_PLAYBACK_REQUIRES_PLAYS_INLINE_ATTRIBUTE, "", "") \
+    macro(InvisibleAutoplayNotPermitted, invisibleAutoplayNotPermitted, Bool, bool, DEFAULT_INVISIBLE_AUTOPLAY_NOT_PERMITTED, "", "") \
+    macro(MediaDataLoadsAutomatically, mediaDataLoadsAutomatically, Bool, bool, DEFAULT_MEDIA_DATA_LOADS_AUTOMATICALLY, "", "") \
+    macro(AllowsPictureInPictureMediaPlayback, allowsPictureInPictureMediaPlayback, Bool, bool, true, "", "") \
+    macro(AllowsAirPlayForMediaPlayback, allowsAirPlayForMediaPlayback, Bool, bool, true, "", "") \
+    macro(MediaControlsScaleWithPageZoom, mediaControlsScaleWithPageZoom, Bool, bool, DEFAULT_MEDIA_CONTROLS_SCALE_WITH_PAGE_ZOOM, "", "") \
+    macro(InspectorStartsAttached, inspectorStartsAttached, Bool, bool, true, "", "") \
+    macro(ShowsToolTipOverTruncatedText, showsToolTipOverTruncatedText, Bool, bool, false, "", "") \
+    macro(MockScrollbarsEnabled, mockScrollbarsEnabled, Bool, bool, false, "", "") \
+    macro(WebAudioEnabled, webAudioEnabled, Bool, bool, true, "", "") \
+    macro(AttachmentElementEnabled, attachmentElementEnabled, Bool, bool, false, "", "") \
+    macro(SuppressesIncrementalRendering, suppressesIncrementalRendering, Bool, bool, false, "", "") \
+    macro(BackspaceKeyNavigationEnabled, backspaceKeyNavigationEnabled, Bool, bool, DEFAULT_BACKSPACE_KEY_NAVIGATION_ENABLED, "", "") \
+    macro(CaretBrowsingEnabled, caretBrowsingEnabled, Bool, bool, false, "", "") \
+    macro(ShouldDisplaySubtitles, shouldDisplaySubtitles, Bool, bool, false, "", "") \
+    macro(ShouldDisplayCaptions, shouldDisplayCaptions, Bool, bool, false, "", "") \
+    macro(ShouldDisplayTextDescriptions, shouldDisplayTextDescriptions, Bool, bool, false, "", "") \
+    macro(NotificationsEnabled, notificationsEnabled, Bool, bool, true, "", "") \
+    macro(ShouldRespectImageOrientation, shouldRespectImageOrientation, Bool, bool, DEFAULT_SHOULD_RESPECT_IMAGE_ORIENTATION, "", "") \
+    macro(WantsBalancedSetDefersLoadingBehavior, wantsBalancedSetDefersLoadingBehavior, Bool, bool, false, "", "") \
+    macro(RequestAnimationFrameEnabled, requestAnimationFrameEnabled, Bool, bool, true, "", "") \
+    macro(DiagnosticLoggingEnabled, diagnosticLoggingEnabled, Bool, bool, false, "", "") \
+    macro(AsynchronousPluginInitializationEnabled, asynchronousPluginInitializationEnabled, Bool, bool, false, "", "") \
+    macro(AsynchronousPluginInitializationEnabledForAllPlugins, asynchronousPluginInitializationEnabledForAllPlugins, Bool, bool, false, "", "") \
+    macro(ArtificialPluginInitializationDelayEnabled, artificialPluginInitializationDelayEnabled, Bool, bool, false, "", "") \
+    macro(TabToLinksEnabled, tabToLinksEnabled, Bool, bool, false, "", "") \
+    macro(InteractiveFormValidationEnabled, interactiveFormValidationEnabled, Bool, bool, false, "", "") \
+    macro(ScrollingPerformanceLoggingEnabled, scrollingPerformanceLoggingEnabled, Bool, bool, false, "", "") \
+    macro(ScrollAnimatorEnabled, scrollAnimatorEnabled, Bool, bool, DEFAULT_WEBKIT_SCROLL_ANIMATOR_ENABLED, "", "") \
+    macro(ForceUpdateScrollbarsOnMainThreadForPerformanceTesting, forceUpdateScrollbarsOnMainThreadForPerformanceTesting, Bool, bool, false, "", "") \
+    macro(CookieEnabled, cookieEnabled, Bool, bool, true, "", "") \
+    macro(PlugInSnapshottingEnabled, plugInSnapshottingEnabled, Bool, bool, false, "", "") \
+    macro(SnapshotAllPlugIns, snapshotAllPlugIns, Bool, bool, false, "", "") \
+    macro(AutostartOriginPlugInSnapshottingEnabled, autostartOriginPlugInSnapshottingEnabled, Bool, bool, true, "", "") \
+    macro(PrimaryPlugInSnapshotDetectionEnabled, primaryPlugInSnapshotDetectionEnabled, Bool, bool, true, "", "") \
+    macro(PDFPluginEnabled, pdfPluginEnabled, Bool, bool, DEFAULT_PDFPLUGIN_ENABLED, "", "") \
+    macro(UsesEncodingDetector, usesEncodingDetector, Bool, bool, false, "", "") \
+    macro(TextAutosizingEnabled, textAutosizingEnabled, Bool, bool, false, "", "") \
+    macro(AggressiveTileRetentionEnabled, aggressiveTileRetentionEnabled, Bool, bool, false, "", "") \
+    macro(TemporaryTileCohortRetentionEnabled, temporaryTileCohortRetentionEnabled, Bool, bool, DEFAULT_TEMPORARY_TILE_COHORT_RETENTION_ENABLED, "", "") \
+    macro(QTKitEnabled, isQTKitEnabled, Bool, bool, WebCore::Settings::isQTKitEnabled(), "", "") \
+    macro(PageVisibilityBasedProcessSuppressionEnabled, pageVisibilityBasedProcessSuppressionEnabled, Bool, bool, true, "", "") \
+    macro(SmartInsertDeleteEnabled, smartInsertDeleteEnabled, Bool, bool, true, "", "") \
+    macro(SelectTrailingWhitespaceEnabled, selectTrailingWhitespaceEnabled, Bool, bool, false, "", "") \
+    macro(ShowsURLsInToolTipsEnabled, showsURLsInToolTipsEnabled, Bool, bool, false, "", "") \
+    macro(AcceleratedCompositingForOverflowScrollEnabled, acceleratedCompositingForOverflowScrollEnabled, Bool, bool, false, "", "") \
+    macro(HiddenPageDOMTimerThrottlingEnabled, hiddenPageDOMTimerThrottlingEnabled, Bool, bool, DEFAULT_HIDDEN_PAGE_DOM_TIMER_THROTTLING_ENABLED, "", "") \
+    macro(HiddenPageDOMTimerThrottlingAutoIncreases, hiddenPageDOMTimerThrottlingAutoIncreases, Bool, bool, false, "", "") \
+    macro(HiddenPageCSSAnimationSuspensionEnabled, hiddenPageCSSAnimationSuspensionEnabled, Bool, bool, DEFAULT_HIDDEN_PAGE_CSS_ANIMATION_SUSPENSION_ENABLED, "", "") \
+    macro(LowPowerVideoAudioBufferSizeEnabled, lowPowerVideoAudioBufferSizeEnabled, Bool, bool, false, "", "") \
+    macro(ThreadedScrollingEnabled, threadedScrollingEnabled, Bool, bool, true, "", "") \
+    macro(SimpleLineLayoutEnabled, simpleLineLayoutEnabled, Bool, bool, true, "", "") \
+    macro(SubpixelCSSOMElementMetricsEnabled, subpixelCSSOMElementMetricsEnabled, Bool, bool, false, "", "") \
+    macro(UseGiantTiles, useGiantTiles, Bool, bool, false, "", "") \
+    macro(MediaStreamEnabled, mediaStreamEnabled, Bool, bool, false, "", "") \
+    macro(UseLegacyTextAlignPositionedElementBehavior, useLegacyTextAlignPositionedElementBehavior, Bool, bool, false, "", "") \
+    macro(SpatialNavigationEnabled, spatialNavigationEnabled, Bool, bool, false, "", "") \
+    macro(MediaSourceEnabled, mediaSourceEnabled, Bool, bool, true, "", "") \
+    macro(ViewGestureDebuggingEnabled, viewGestureDebuggingEnabled, Bool, bool, false, "", "") \
+    macro(ShouldConvertPositionStyleOnCopy, shouldConvertPositionStyleOnCopy, Bool, bool, false, "", "") \
+    macro(Standalone, standalone, Bool, bool, false, "", "") \
+    macro(TelephoneNumberParsingEnabled, telephoneNumberParsingEnabled, Bool, bool, false, "", "") \
+    macro(AllowMultiElementImplicitSubmission, allowMultiElementImplicitSubmission, Bool, bool, false, "", "") \
+    macro(AlwaysUseAcceleratedOverflowScroll, alwaysUseAcceleratedOverflowScroll, Bool, bool, false, "", "") \
+    macro(PasswordEchoEnabled, passwordEchoEnabled, Bool, bool, DEFAULT_PASSWORD_ECHO_ENABLED, "", "") \
+    macro(ImageControlsEnabled, imageControlsEnabled, Bool, bool, false, "", "") \
+    macro(EnableInheritURIQueryComponent, enableInheritURIQueryComponent, Bool, bool, false, "", "") \
+    macro(ServiceControlsEnabled, serviceControlsEnabled, Bool, bool, false, "", "") \
+    macro(GamepadsEnabled, gamepadsEnabled, Bool, bool, false, "", "") \
+    macro(NewBlockInsideInlineModelEnabled, newBlockInsideInlineModelEnabled, Bool, bool, false, "", "") \
+    macro(HTTPEquivEnabled, httpEquivEnabled, Bool, bool, true, "", "") \
+    macro(MockCaptureDevicesEnabled, mockCaptureDevicesEnabled, Bool, bool, false, "", "") \
+    macro(ShadowDOMEnabled, shadowDOMEnabled, Bool, bool, true, "", "") \
+    macro(CustomElementsEnabled, customElementsEnabled, Bool, bool, false, "", "") \
+    macro(FetchAPIEnabled, fetchAPIEnabled, Bool, bool, false, "", "") \
+    macro(WebGL2Enabled, webGL2Enabled, Bool, bool, false, "", "") \
+    macro(DownloadAttributeEnabled, downloadAttributeEnabled, Bool, bool, false, "", "") \
     FOR_EACH_ADDITIONAL_WEBKIT_BOOL_PREFERENCE(macro) \
     \
 
 #define FOR_EACH_WEBKIT_DOUBLE_PREFERENCE(macro) \
-    macro(IncrementalRenderingSuppressionTimeout, incrementalRenderingSuppressionTimeout, Double, double, 5) \
-    macro(MinimumFontSize, minimumFontSize, Double, double, 0) \
-    macro(MinimumLogicalFontSize, minimumLogicalFontSize, Double, double, 9) \
-    macro(MinimumZoomFontSize, minimumZoomFontSize, Double, double, DEFAULT_MINIMUM_FONT_ZOOM_SIZE) \
-    macro(DefaultFontSize, defaultFontSize, Double, double, 16) \
-    macro(DefaultFixedFontSize, defaultFixedFontSize, Double, double, 13) \
-    macro(LayoutInterval, layoutInterval, Double, double, -1) \
-    macro(MaxParseDuration, maxParseDuration, Double, double, -1) \
-    macro(PasswordEchoDuration, passwordEchoDuration, Double, double, 2) \
+    macro(IncrementalRenderingSuppressionTimeout, incrementalRenderingSuppressionTimeout, Double, double, 5, "", "") \
+    macro(MinimumFontSize, minimumFontSize, Double, double, 0, "", "") \
+    macro(MinimumLogicalFontSize, minimumLogicalFontSize, Double, double, 9, "", "") \
+    macro(MinimumZoomFontSize, minimumZoomFontSize, Double, double, DEFAULT_MINIMUM_FONT_ZOOM_SIZE, "", "") \
+    macro(DefaultFontSize, defaultFontSize, Double, double, 16, "", "") \
+    macro(DefaultFixedFontSize, defaultFixedFontSize, Double, double, 13, "", "") \
+    macro(LayoutInterval, layoutInterval, Double, double, -1, "", "") \
+    macro(MaxParseDuration, maxParseDuration, Double, double, -1, "", "") \
+    macro(PasswordEchoDuration, passwordEchoDuration, Double, double, 2, "", "") \
     \
 
 #define FOR_EACH_WEBKIT_UINT32_PREFERENCE(macro) \
-    macro(FontSmoothingLevel, fontSmoothingLevel, UInt32, uint32_t, FontSmoothingLevelMedium) \
-    macro(LayoutFallbackWidth, layoutFallbackWidth, UInt32, uint32_t, 980) \
-    macro(DeviceWidth, deviceWidth, UInt32, uint32_t, 0) \
-    macro(DeviceHeight, deviceHeight, UInt32, uint32_t, 0) \
-    macro(EditableLinkBehavior, editableLinkBehavior, UInt32, uint32_t, WebCore::EditableLinkNeverLive) \
-    macro(InspectorAttachedHeight, inspectorAttachedHeight, UInt32, uint32_t, 300) \
-    macro(InspectorAttachedWidth, inspectorAttachedWidth, UInt32, uint32_t, 750) \
-    macro(InspectorAttachmentSide, inspectorAttachmentSide, UInt32, uint32_t, 0) \
-    macro(StorageBlockingPolicy, storageBlockingPolicy, UInt32, uint32_t, WebCore::SecurityOrigin::BlockThirdPartyStorage) \
-    macro(JavaScriptRuntimeFlags, javaScriptRuntimeFlags, UInt32, uint32_t, 0) \
-    macro(DataDetectorTypes, dataDetectorTypes, UInt32, uint32_t, 0) \
+    macro(FontSmoothingLevel, fontSmoothingLevel, UInt32, uint32_t, FontSmoothingLevelMedium, "", "") \
+    macro(LayoutFallbackWidth, layoutFallbackWidth, UInt32, uint32_t, 980, "", "") \
+    macro(DeviceWidth, deviceWidth, UInt32, uint32_t, 0, "", "") \
+    macro(DeviceHeight, deviceHeight, UInt32, uint32_t, 0, "", "") \
+    macro(EditableLinkBehavior, editableLinkBehavior, UInt32, uint32_t, WebCore::EditableLinkNeverLive, "", "") \
+    macro(InspectorAttachedHeight, inspectorAttachedHeight, UInt32, uint32_t, 300, "", "") \
+    macro(InspectorAttachedWidth, inspectorAttachedWidth, UInt32, uint32_t, 750, "", "") \
+    macro(InspectorAttachmentSide, inspectorAttachmentSide, UInt32, uint32_t, 0, "", "") \
+    macro(StorageBlockingPolicy, storageBlockingPolicy, UInt32, uint32_t, WebCore::SecurityOrigin::BlockThirdPartyStorage, "", "") \
+    macro(JavaScriptRuntimeFlags, javaScriptRuntimeFlags, UInt32, uint32_t, 0, "", "") \
+    macro(DataDetectorTypes, dataDetectorTypes, UInt32, uint32_t, 0, "", "") \
     \
 
 #define FOR_EACH_WEBKIT_DEBUG_BOOL_PREFERENCE(macro) \
-    macro(AcceleratedDrawingEnabled, acceleratedDrawingEnabled, Bool, bool, DEFAULT_ACCELERATED_DRAWING_ENABLED) \
-    macro(DisplayListDrawingEnabled, displayListDrawingEnabled, Bool, bool, false) \
-    macro(CompositingBordersVisible, compositingBordersVisible, Bool, bool, false) \
-    macro(CompositingRepaintCountersVisible, compositingRepaintCountersVisible, Bool, bool, false) \
-    macro(TiledScrollingIndicatorVisible, tiledScrollingIndicatorVisible, Bool, bool, false) \
-    macro(SimpleLineLayoutDebugBordersEnabled, simpleLineLayoutDebugBordersEnabled, Bool, bool, false) \
-    macro(DeveloperExtrasEnabled, developerExtrasEnabled, Bool, bool, false) \
-    macro(LogsPageMessagesToSystemConsoleEnabled, logsPageMessagesToSystemConsoleEnabled, Bool, bool, false) \
-    macro(IgnoreViewportScalingConstraints, ignoreViewportScalingConstraints, Bool, bool, true) \
-    macro(ForceAlwaysUserScalable, forceAlwaysUserScalable, Bool, bool, false) \
-    macro(ResourceUsageOverlayVisible, resourceUsageOverlayVisible, Bool, bool, false) \
+    macro(AcceleratedDrawingEnabled, acceleratedDrawingEnabled, Bool, bool, DEFAULT_ACCELERATED_DRAWING_ENABLED, "", "") \
+    macro(DisplayListDrawingEnabled, displayListDrawingEnabled, Bool, bool, false, "", "") \
+    macro(CompositingBordersVisible, compositingBordersVisible, Bool, bool, false, "", "") \
+    macro(CompositingRepaintCountersVisible, compositingRepaintCountersVisible, Bool, bool, false, "", "") \
+    macro(TiledScrollingIndicatorVisible, tiledScrollingIndicatorVisible, Bool, bool, false, "", "") \
+    macro(SimpleLineLayoutDebugBordersEnabled, simpleLineLayoutDebugBordersEnabled, Bool, bool, false, "", "") \
+    macro(DeveloperExtrasEnabled, developerExtrasEnabled, Bool, bool, false, "", "") \
+    macro(LogsPageMessagesToSystemConsoleEnabled, logsPageMessagesToSystemConsoleEnabled, Bool, bool, false, "", "") \
+    macro(IgnoreViewportScalingConstraints, ignoreViewportScalingConstraints, Bool, bool, true, "", "") \
+    macro(ForceAlwaysUserScalable, forceAlwaysUserScalable, Bool, bool, false, "", "") \
+    macro(ResourceUsageOverlayVisible, resourceUsageOverlayVisible, Bool, bool, false, "", "") \
     \
 
 #define FOR_EACH_WEBKIT_DEBUG_UINT32_PREFERENCE(macro) \
-    macro(VisibleDebugOverlayRegions, visibleDebugOverlayRegions, UInt32, uint32_t, 0)
+    macro(VisibleDebugOverlayRegions, visibleDebugOverlayRegions, UInt32, uint32_t, 0, "", "")
+
+#define FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(macro) \
+    macro(ExperimentalShadowDOMEnabled, experimentalShadowDOMEnabled, Bool, bool, false, "Shadow DOM", "Support for the Shadow DOM feature") \
+    macro(ExperimentalWebGL2Enabled, experimentalWebGL2Enabled, Bool, bool, false, "WebGL 2.0", "Prototype WebGL 2 Support") \
+    \
 
 #if PLATFORM(COCOA)
 
 
 
 #define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
-    macro(StandardFontFamily, standardFontFamily, String, String, "Times") \
-    macro(CursiveFontFamily, cursiveFontFamily, String, String, DEFAULT_CURSIVE_FONT_FAMILY) \
-    macro(FantasyFontFamily, fantasyFontFamily, String, String, "Papyrus") \
-    macro(FixedFontFamily, fixedFontFamily, String, String, "Courier") \
-    macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Helvetica") \
-    macro(SerifFontFamily, serifFontFamily, String, String, "Times") \
-    macro(PictographFontFamily, pictographFontFamily, String, String, "Apple Color Emoji") \
+    macro(StandardFontFamily, standardFontFamily, String, String, "Times", "", "") \
+    macro(CursiveFontFamily, cursiveFontFamily, String, String, DEFAULT_CURSIVE_FONT_FAMILY, "", "") \
+    macro(FantasyFontFamily, fantasyFontFamily, String, String, "Papyrus", "", "") \
+    macro(FixedFontFamily, fixedFontFamily, String, String, "Courier", "", "") \
+    macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Helvetica", "", "") \
+    macro(SerifFontFamily, serifFontFamily, String, String, "Times", "", "") \
+    macro(PictographFontFamily, pictographFontFamily, String, String, "Apple Color Emoji", "", "") \
     \
 
 #elif PLATFORM(GTK) || PLATFORM(EFL)
 
 #define FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
-    macro(StandardFontFamily, standardFontFamily, String, String, "Times") \
-    macro(CursiveFontFamily, cursiveFontFamily, String, String, "Comic Sans MS") \
-    macro(FantasyFontFamily, fantasyFontFamily, String, String, "Impact") \
-    macro(FixedFontFamily, fixedFontFamily, String, String, "Courier New") \
-    macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Helvetica") \
-    macro(SerifFontFamily, serifFontFamily, String, String, "Times") \
-    macro(PictographFontFamily, pictographFontFamily, String, String, "Times") \
+    macro(StandardFontFamily, standardFontFamily, String, String, "Times", "", "") \
+    macro(CursiveFontFamily, cursiveFontFamily, String, String, "Comic Sans MS", "", "") \
+    macro(FantasyFontFamily, fantasyFontFamily, String, String, "Impact", "", "") \
+    macro(FixedFontFamily, fixedFontFamily, String, String, "Courier New", "", "") \
+    macro(SansSerifFontFamily, sansSerifFontFamily, String, String, "Helvetica", "", "") \
+    macro(SerifFontFamily, serifFontFamily, String, String, "Times", "", "") \
+    macro(PictographFontFamily, pictographFontFamily, String, String, "Times", "", "") \
     \
 
 #endif
 
 #define FOR_EACH_WEBKIT_STRING_PREFERENCE(macro) \
     FOR_EACH_WEBKIT_FONT_FAMILY_PREFERENCE(macro) \
-    macro(DefaultTextEncodingName, defaultTextEncodingName, String, String, defaultTextEncodingNameForSystemLanguage()) \
-    macro(FTPDirectoryTemplatePath, ftpDirectoryTemplatePath, String, String, "") \
+    macro(DefaultTextEncodingName, defaultTextEncodingName, String, String, defaultTextEncodingNameForSystemLanguage(), "", "") \
+    macro(FTPDirectoryTemplatePath, ftpDirectoryTemplatePath, String, String, "", "", "") \
     \
 
 #define FOR_EACH_WEBKIT_STRING_PREFERENCE_NOT_IN_WEBCORE(macro) \
-    macro(InspectorWindowFrame, inspectorWindowFrame, String, String, "") \
+    macro(InspectorWindowFrame, inspectorWindowFrame, String, String, "", "", "") \
     \
 
 #define FOR_EACH_WEBKIT_DEBUG_PREFERENCE(macro) \
index fdd04f6..8467cd3 100644 (file)
@@ -31,7 +31,7 @@
 namespace WebKit {
 namespace WebPreferencesKey {
 
-#define DEFINE_KEY_GETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \
+#define DEFINE_KEY_GETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
         const String& KeyLower##Key() \
         { \
             static NeverDestroyed<String> key(ASCIILiteral(#KeyUpper)); \
@@ -40,6 +40,7 @@ namespace WebPreferencesKey {
 
 FOR_EACH_WEBKIT_PREFERENCE(DEFINE_KEY_GETTERS)
 FOR_EACH_WEBKIT_DEBUG_PREFERENCE(DEFINE_KEY_GETTERS)
+FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(DEFINE_KEY_GETTERS)
 
 #undef DEFINE_KEY_GETTERS
 
index 0b8fbc7..dffc375 100644 (file)
 namespace WebKit {
 namespace WebPreferencesKey {
 
-#define DECLARE_KEY_GETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) const String& KeyLower##Key();
+#define DECLARE_KEY_GETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) const String& KeyLower##Key();
 
 FOR_EACH_WEBKIT_PREFERENCE(DECLARE_KEY_GETTERS)
 FOR_EACH_WEBKIT_DEBUG_PREFERENCE(DECLARE_KEY_GETTERS)
+FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(DECLARE_KEY_GETTERS)
 
 #undef DECLARE_KEY_GETTERS
 
index 3e9ffb2..170a308 100644 (file)
@@ -160,9 +160,10 @@ static WebPreferencesStore::ValueMap& defaults()
 {
     static NeverDestroyed<WebPreferencesStore::ValueMap> defaults;
     if (defaults.get().isEmpty()) {
-#define DEFINE_DEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) defaults.get().set(WebPreferencesKey::KeyLower##Key(), WebPreferencesStore::Value((Type)DefaultValue));
+#define DEFINE_DEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) defaults.get().set(WebPreferencesKey::KeyLower##Key(), WebPreferencesStore::Value((Type)DefaultValue));
         FOR_EACH_WEBKIT_PREFERENCE(DEFINE_DEFAULTS)
         FOR_EACH_WEBKIT_DEBUG_PREFERENCE(DEFINE_DEFAULTS)
+        FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(DEFINE_DEFAULTS)
 #undef DEFINE_DEFAULTS
 #if USE(APPLE_INTERNAL_SDK)
 #include <WebKitAdditions/WebPreferencesStoreDefaultsAdditions.cpp>
diff --git a/Source/WebKit2/UIProcess/API/APIExperimentalFeature.cpp b/Source/WebKit2/UIProcess/API/APIExperimentalFeature.cpp
new file mode 100644 (file)
index 0000000..452b1de
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "APIExperimentalFeature.h"
+
+namespace API {
+
+Ref<ExperimentalFeature> ExperimentalFeature::create(const WTF::String& name, const WTF::String& key, const WTF::String& details)
+{
+    return adoptRef(*new ExperimentalFeature(name, key, details));
+}
+
+ExperimentalFeature::ExperimentalFeature(const WTF::String& name, const WTF::String& key, const WTF::String& details)
+    : m_name(name)
+    , m_key(key)
+    , m_details(details)
+{
+}
+
+ExperimentalFeature::~ExperimentalFeature()
+{
+}
+
+}
diff --git a/Source/WebKit2/UIProcess/API/APIExperimentalFeature.h b/Source/WebKit2/UIProcess/API/APIExperimentalFeature.h
new file mode 100644 (file)
index 0000000..0c9069d
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef APIExperimentalFeature_h
+#define APIExperimentalFeature_h
+
+#include "APIObject.h"
+#include <wtf/text/WTFString.h>
+
+namespace API {
+
+class ExperimentalFeature final : public ObjectImpl<Object::Type::ExperimentalFeature> {
+public:
+    static Ref<ExperimentalFeature> create(const WTF::String& name, const WTF::String& key, const WTF::String& details);
+    virtual ~ExperimentalFeature();
+
+    WTF::String name() const { return m_name; }
+    WTF::String key() const { return m_key; }
+    WTF::String details() const { return m_details; }
+
+private:
+    explicit ExperimentalFeature(const WTF::String& name, const WTF::String& key, const WTF::String& details);
+
+    WTF::String m_name;
+    WTF::String m_key;
+    WTF::String m_details;
+};
+
+}
+
+#endif // APIExperimentalFeature_h
index 787e992..34df12e 100644 (file)
@@ -51,6 +51,7 @@
 #include <WebCore/Settings.h>
 
 namespace API {
+class ExperimentalFeature;
 class FrameHandle;
 class FrameInfo;
 class HitTestResult;
index 58e658c..c4e9a19 100644 (file)
 
 #if WK_API_ENABLED
 
+#import "APIArray.h"
+#import "WKNSArray.h"
 #import "WebPreferences.h"
+#import "_WKExperimentalFeature.h"
+#import "_WKExperimentalFeatureInternal.h"
 #import <WebCore/SecurityOrigin.h>
 #import <wtf/RetainPtr.h>
 
@@ -419,6 +423,22 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setFixedFontFamily(fixedPitchFontFamily);
 }
 
++ (WK_ARRAY(_WKExperimentalFeature *) *)_experimentalFeatures
+{
+    auto features = WebKit::WebPreferences::experimentalFeatures();
+    return [wrapper(API::Array::create(WTFMove(features)).leakRef()) autorelease];
+}
+
+- (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature
+{
+    return _preferences->isEnabledForFeature(*feature->_experimentalFeature);
+}
+
+- (void)_setEnabled:(BOOL)value forFeature:(_WKExperimentalFeature *)feature
+{
+    _preferences->setEnabledForFeature(value, *feature->_experimentalFeature);
+}
+
 @end
 
 #endif // WK_API_ENABLED
index 09ced5a..7b2ada6 100644 (file)
@@ -46,6 +46,8 @@ typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
     _WKJavaScriptRuntimeFlagsAllEnabled = 0
 } WK_ENUM_AVAILABLE(10_11, 9_0);
 
+@class _WKExperimentalFeature;
+
 @interface WKPreferences (WKPrivate)
 
 // FIXME: This property should not have the verb "is" in it.
@@ -85,6 +87,10 @@ typedef NS_OPTIONS(NSUInteger, _WKJavaScriptRuntimeFlags) {
 @property (nonatomic, setter=_setOfflineApplicationCacheIsEnabled:) BOOL _offlineApplicationCacheIsEnabled;
 @property (nonatomic, setter=_setFullScreenEnabled:) BOOL _fullScreenEnabled WK_AVAILABLE(10_11, 9_0);
 
++ (WK_ARRAY(_WKExperimentalFeature *) *)_experimentalFeatures;
+- (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature;
+- (void)_setEnabled:(BOOL)value forFeature:(_WKExperimentalFeature *)feature;
+
 @end
 
 #endif
diff --git a/Source/WebKit2/UIProcess/API/Cocoa/_WKExperimentalFeature.h b/Source/WebKit2/UIProcess/API/Cocoa/_WKExperimentalFeature.h
new file mode 100644 (file)
index 0000000..698e92f
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import <WebKit/WKFoundation.h>
+
+#if WK_API_ENABLED
+
+#import <Foundation/Foundation.h>
+
+WK_CLASS_AVAILABLE(10_11, 9_0)
+@interface _WKExperimentalFeature : NSObject
+
+@property (nonatomic, readonly, copy) NSString *key;
+@property (nonatomic, readonly, copy) NSString *name;
+@property (nonatomic, readonly, copy) NSString *details;
+
+@end
+
+#endif
diff --git a/Source/WebKit2/UIProcess/API/Cocoa/_WKExperimentalFeature.mm b/Source/WebKit2/UIProcess/API/Cocoa/_WKExperimentalFeature.mm
new file mode 100644 (file)
index 0000000..0e25b4b
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "_WKExperimentalFeatureInternal.h"
+
+#if WK_API_ENABLED
+
+@implementation _WKExperimentalFeature
+
+- (void)dealloc
+{
+    _experimentalFeature->API::ExperimentalFeature::~ExperimentalFeature();
+
+    [super dealloc];
+}
+
+- (NSString *)description
+{
+    return [NSString stringWithFormat:@"<%@: %p; name = %@; key = { %@ }>", NSStringFromClass(self.class), self, self.name, self.key];
+}
+
+- (NSString *)name
+{
+    return _experimentalFeature->name();
+}
+
+- (NSString *)key
+{
+    return _experimentalFeature->key();
+}
+
+- (NSString *)details
+{
+    return _experimentalFeature->details();
+}
+
+#pragma mark WKObject protocol implementation
+
+- (API::Object&)_apiObject
+{
+    return *_experimentalFeature;
+}
+
+@end
+
+#endif
diff --git a/Source/WebKit2/UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h b/Source/WebKit2/UIProcess/API/Cocoa/_WKExperimentalFeatureInternal.h
new file mode 100644 (file)
index 0000000..9eb1dd1
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "_WKExperimentalFeature.h"
+
+#if WK_API_ENABLED
+
+#import "APIExperimentalFeature.h"
+#import "WKObject.h"
+
+namespace WebKit {
+
+inline _WKExperimentalFeature *wrapper(API::ExperimentalFeature& experimentalFeature)
+{
+    ASSERT([experimentalFeature.wrapper() isKindOfClass:[_WKExperimentalFeature class]]);
+    return (_WKExperimentalFeature *)experimentalFeature.wrapper();
+}
+
+}
+
+@interface _WKExperimentalFeature () <WKObject> {
+@package
+    API::ObjectStorage<API::ExperimentalFeature> _experimentalFeature;
+}
+@end
+
+#endif
index e1c390e..f14630e 100644 (file)
@@ -29,6 +29,7 @@
 #include "WebPageGroup.h"
 #include "WebPreferencesKeys.h"
 #include "WebProcessPool.h"
+#include <wtf/NeverDestroyed.h>
 #include <wtf/ThreadingPrimitives.h>
 
 namespace WebKit {
@@ -170,7 +171,7 @@ void WebPreferences::updatePrivateBrowsingValue(bool value)
     }
 }
 
-#define DEFINE_PREFERENCE_GETTER_AND_SETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \
+#define DEFINE_PREFERENCE_GETTER_AND_SETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
     void WebPreferences::set##KeyUpper(const Type& value) \
     { \
         if (!m_store.set##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), value)) \
@@ -186,9 +187,58 @@ void WebPreferences::updatePrivateBrowsingValue(bool value)
 
 FOR_EACH_WEBKIT_PREFERENCE(DEFINE_PREFERENCE_GETTER_AND_SETTERS)
 FOR_EACH_WEBKIT_DEBUG_PREFERENCE(DEFINE_PREFERENCE_GETTER_AND_SETTERS)
+FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(DEFINE_PREFERENCE_GETTER_AND_SETTERS)
 
 #undef DEFINE_PREFERENCE_GETTER_AND_SETTERS
 
+static Vector<RefPtr<API::Object>> createExperimentalFeaturesVector()
+{
+    Vector<RefPtr<API::Object>> features;
+
+#define ADD_EXPERIMENTAL_PREFERENCE_DESCRIPTION(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
+    features.append(API::ExperimentalFeature::create(HumanReadableName, #KeyUpper, HumanReadableDescription)); \
+
+    FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(ADD_EXPERIMENTAL_PREFERENCE_DESCRIPTION)
+
+#undef ADD_EXPERIMENTAL_PREFERENCE_DESCRIPTION
+
+    return features;
+}
+
+const Vector<RefPtr<API::Object>>& WebPreferences::experimentalFeatures()
+{
+    static NeverDestroyed<Vector<RefPtr<API::Object>>> features = createExperimentalFeaturesVector();
+    return features;
+}
+
+bool WebPreferences::isEnabledForFeature(const API::ExperimentalFeature& feature) const
+{
+    const String& key = feature.key();
+
+#define CALL_EXPERIMENTAL_GETTER(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
+    if (key == #KeyUpper) \
+        return KeyLower(); \
+
+    FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(CALL_EXPERIMENTAL_GETTER)
+
+#undef CALL_EXPERIMENTAL_GETTER
+
+    return false;
+}
+
+void WebPreferences::setEnabledForFeature(bool value, const API::ExperimentalFeature& feature)
+{
+    const String& key = feature.key();
+
+#define CALL_EXPERIMENTAL_SETTER(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
+    if (key == #KeyUpper) \
+        set##KeyUpper(value); \
+
+    FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(CALL_EXPERIMENTAL_SETTER)
+    
+#undef CALL_EXPERIMENTAL_SETTER
+}
+
 bool WebPreferences::anyPagesAreUsingPrivateBrowsing()
 {
     return privateBrowsingPageCount;
index 0181738..26599b3 100644 (file)
@@ -26,6 +26,7 @@
 #ifndef WebPreferences_h
 #define WebPreferences_h
 
+#include "APIExperimentalFeature.h"
 #include "APIObject.h"
 #include "FontSmoothingLevel.h"
 #include "WebPreferencesDefinitions.h"
@@ -34,7 +35,7 @@
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefPtr.h>
 
-#define DECLARE_PREFERENCE_GETTER_AND_SETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \
+#define DECLARE_PREFERENCE_GETTER_AND_SETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
     void set##KeyUpper(const Type& value); \
     Type KeyLower() const;
 
@@ -59,14 +60,13 @@ public:
 
     const WebPreferencesStore& store() const { return m_store; }
 
-#define DECLARE_PREFERENCE_GETTER_AND_SETTERS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \
-    void set##KeyUpper(const Type& value); \
-    Type KeyLower() const; \
-
     FOR_EACH_WEBKIT_PREFERENCE(DECLARE_PREFERENCE_GETTER_AND_SETTERS)
     FOR_EACH_WEBKIT_DEBUG_PREFERENCE(DECLARE_PREFERENCE_GETTER_AND_SETTERS)
+    FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(DECLARE_PREFERENCE_GETTER_AND_SETTERS)
 
-#undef DECLARE_PREFERENCE_GETTER_AND_SETTERS
+    static const Vector<RefPtr<API::Object>>& experimentalFeatures();
+    bool isEnabledForFeature(const API::ExperimentalFeature&) const;
+    void setEnabledForFeature(bool, const API::ExperimentalFeature&);
 
     // Exposed for WebKitTestRunner use only.
     void forceUpdate() { update(); }
index 2fa352e..9ad8095 100644 (file)
@@ -144,9 +144,10 @@ static void setDebugUInt32ValueIfInUserDefaults(const String& identifier, const
 
 void WebPreferences::platformInitializeStore()
 {
-#define INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \
+#define INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
     setDebug##TypeName##ValueIfInUserDefaults(m_identifier, m_keyPrefix, m_globalDebugKeyPrefix, WebPreferencesKey::KeyLower##Key(), m_store);
 
+    FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS)
     FOR_EACH_WEBKIT_DEBUG_PREFERENCE(INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS)
 
 #undef INITIALIZE_DEBUG_PREFERENCE_FROM_NSUSERDEFAULTS
@@ -154,7 +155,7 @@ void WebPreferences::platformInitializeStore()
     if (!m_identifier)
         return;
 
-#define INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) \
+#define INITIALIZE_PREFERENCE_FROM_NSUSERDEFAULTS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) \
     Type user##KeyUpper##Value; \
     if (platformGet##TypeName##UserValueForKey(WebPreferencesKey::KeyLower##Key(), user##KeyUpper##Value)) \
         m_store.set##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key(), user##KeyUpper##Value);
index 8d81774..cb033c1 100644 (file)
                3131261F148FF82C00BA2A39 /* NotificationPermissionRequestManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3131261A148FF82B00BA2A39 /* NotificationPermissionRequestManager.h */; };
                31312620148FF82C00BA2A39 /* WebNotificationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3131261B148FF82B00BA2A39 /* WebNotificationManager.cpp */; };
                31312621148FF82C00BA2A39 /* WebNotificationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 3131261C148FF82B00BA2A39 /* WebNotificationManager.h */; };
+               317FE7C51C487A6C00A0CA89 /* APIExperimentalFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = 317FE7C21C487A6600A0CA89 /* APIExperimentalFeature.h */; };
+               317FE7C61C487A7100A0CA89 /* APIExperimentalFeature.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 317FE7C11C487A6600A0CA89 /* APIExperimentalFeature.cpp */; };
+               317FE7CD1C487DAE00A0CA89 /* _WKExperimentalFeatureInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 317FE7C91C487D9D00A0CA89 /* _WKExperimentalFeatureInternal.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               317FE7CE1C487DB800A0CA89 /* _WKExperimentalFeature.mm in Sources */ = {isa = PBXBuildFile; fileRef = 317FE7C81C487D9D00A0CA89 /* _WKExperimentalFeature.mm */; };
+               317FE7CF1C487DBD00A0CA89 /* _WKExperimentalFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = 317FE7C71C487D9D00A0CA89 /* _WKExperimentalFeature.h */; settings = {ATTRIBUTES = (Private, ); }; };
                318BE17114743DB100A8FBB2 /* WKNotificationManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 318BE17014743DB100A8FBB2 /* WKNotificationManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
                318BE17514743DD700A8FBB2 /* WKNotificationManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 318BE17414743DD600A8FBB2 /* WKNotificationManager.cpp */; };
                318BE17714743E6000A8FBB2 /* WKNotification.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 318BE17614743E6000A8FBB2 /* WKNotification.cpp */; };
                3131261C148FF82B00BA2A39 /* WebNotificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNotificationManager.h; sourceTree = "<group>"; };
                3131261D148FF82C00BA2A39 /* WebNotificationManager.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebNotificationManager.messages.in; sourceTree = "<group>"; };
                31607F3819627002009B87DA /* LegacySessionStateCoding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LegacySessionStateCoding.h; sourceTree = "<group>"; };
+               317FE7C11C487A6600A0CA89 /* APIExperimentalFeature.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIExperimentalFeature.cpp; sourceTree = "<group>"; };
+               317FE7C21C487A6600A0CA89 /* APIExperimentalFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIExperimentalFeature.h; sourceTree = "<group>"; };
+               317FE7C71C487D9D00A0CA89 /* _WKExperimentalFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKExperimentalFeature.h; sourceTree = "<group>"; };
+               317FE7C81C487D9D00A0CA89 /* _WKExperimentalFeature.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKExperimentalFeature.mm; sourceTree = "<group>"; };
+               317FE7C91C487D9D00A0CA89 /* _WKExperimentalFeatureInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKExperimentalFeatureInternal.h; sourceTree = "<group>"; };
                318BE17014743DB100A8FBB2 /* WKNotificationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKNotificationManager.h; sourceTree = "<group>"; };
                318BE17414743DD600A8FBB2 /* WKNotificationManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNotificationManager.cpp; sourceTree = "<group>"; };
                318BE17614743E6000A8FBB2 /* WKNotification.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKNotification.cpp; sourceTree = "<group>"; };
                                379A873B18BBFF0700588AF2 /* _WKElementActionInternal.h */,
                                1AD01BC71905D37E00C9C45F /* _WKErrorRecoveryAttempting.h */,
                                1AD01BC61905D37E00C9C45F /* _WKErrorRecoveryAttempting.mm */,
+                               317FE7C71C487D9D00A0CA89 /* _WKExperimentalFeature.h */,
+                               317FE7C81C487D9D00A0CA89 /* _WKExperimentalFeature.mm */,
+                               317FE7C91C487D9D00A0CA89 /* _WKExperimentalFeatureInternal.h */,
                                005D158E18E4C4EB00734619 /* _WKFindDelegate.h */,
                                2DEAC5CE1AC368BB00A195D8 /* _WKFindOptions.h */,
                                2E7A94491BBD95C600945547 /* _WKFocusedElementInfo.h */,
                                076E884D1A13CADF005E90FC /* APIContextMenuClient.h */,
                                83891B621A68B3420030F386 /* APIDiagnosticLoggingClient.h */,
                                1F7D36C018DA513F00D9D659 /* APIDownloadClient.h */,
+                               317FE7C11C487A6600A0CA89 /* APIExperimentalFeature.cpp */,
+                               317FE7C21C487A6600A0CA89 /* APIExperimentalFeature.h */,
                                00B9661518E24CBA00CE1F88 /* APIFindClient.h */,
                                2DD67A2D1BD819730053B251 /* APIFindMatchesClient.h */,
                                37E25D6D18FDE5D6005D3A00 /* APIFormClient.h */,
                                2DE6943E18BD2A68005C15E5 /* SmartMagnificationControllerMessages.h in Headers */,
                                5272B28B1406985D0096A5D0 /* StatisticsData.h in Headers */,
                                514BDED316C98EDD00E4E25E /* StatisticsRequest.h in Headers */,
+                               317FE7CD1C487DAE00A0CA89 /* _WKExperimentalFeatureInternal.h in Headers */,
                                1AD3306F16B1D991004F60E7 /* StorageAreaImpl.h in Headers */,
                                1ACECD2517162DB1001FC9EF /* StorageAreaMap.h in Headers */,
                                1A334DEE16DE8F88006A8E38 /* StorageAreaMapMessages.h in Headers */,
                                51F060E01654317F00F3281B /* WebResourceLoaderMessages.h in Headers */,
                                7C361D731927FA360036A59D /* WebScriptMessageHandler.h in Headers */,
                                D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */,
+                               317FE7C51C487A6C00A0CA89 /* APIExperimentalFeature.h in Headers */,
                                1A4832D71A9CDF96008B4DFE /* WebsiteData.h in Headers */,
                                1A4832D11A9BDC2F008B4DFE /* WebsiteDataRecord.h in Headers */,
                                1A53C2AA1A325730004E8C70 /* WebsiteDataStore.h in Headers */,
                                26F9A83B18A3468100AEB88A /* WKWebViewPrivate.h in Headers */,
                                1AD60F5E18E20F4C0020C034 /* WKWindowFeatures.h in Headers */,
                                1AD60F6018E20F740020C034 /* WKWindowFeaturesInternal.h in Headers */,
+                               317FE7CF1C487DBD00A0CA89 /* _WKExperimentalFeature.h in Headers */,
                                1A7C0DF71B7D1F1000A9B848 /* WKWindowFeaturesRef.h in Headers */,
                                BCBECDE816B6416800047A1A /* XPCServiceEntryPoint.h in Headers */,
                        );
                                1A002D48196B345D00B9AD44 /* SessionStateCoding.mm in Sources */,
                                1A7284481959F8040007BCE5 /* SessionStateConversion.cpp in Sources */,
                                753E3E0D1887398500188496 /* SessionTracker.cpp in Sources */,
+                               317FE7C61C487A7100A0CA89 /* APIExperimentalFeature.cpp in Sources */,
                                1A6420E412DCE2FF00CAAE2C /* ShareableBitmap.cpp in Sources */,
                                C01A260112662F2100C9ED55 /* ShareableBitmapCG.cpp in Sources */,
                                1ACC50F11CBC381D003C7D03 /* WKOpenPanelParameters.mm in Sources */,
                                BCEE7AD012817988009827DA /* WebProcessProxyMessageReceiver.cpp in Sources */,
                                1A1E093318861D3800D2DC49 /* WebProgressTrackerClient.cpp in Sources */,
                                512F589C12A8838800629530 /* WebProtectionSpace.cpp in Sources */,
+                               317FE7CE1C487DB800A0CA89 /* _WKExperimentalFeature.mm in Sources */,
                                A1C512C8190656E500448914 /* WebQuickLookHandleClient.cpp in Sources */,
                                37948403150C350600E52CE9 /* WebRenderLayer.cpp in Sources */,
                                3760881E150413E900FC82C7 /* WebRenderObject.cpp in Sources */,
index a52fedc..cbd91cb 100644 (file)
@@ -2844,7 +2844,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
     // but we currently don't match the naming of WebCore exactly so we are
     // handrolling the boolean and integer preferences until that is fixed.
 
-#define INITIALIZE_SETTINGS(KeyUpper, KeyLower, TypeName, Type, DefaultValue) settings.set##KeyUpper(store.get##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key()));
+#define INITIALIZE_SETTINGS(KeyUpper, KeyLower, TypeName, Type, DefaultValue, HumanReadableName, HumanReadableDescription) settings.set##KeyUpper(store.get##TypeName##ValueForKey(WebPreferencesKey::KeyLower##Key()));
 
     FOR_EACH_WEBKIT_STRING_PREFERENCE(INITIALIZE_SETTINGS)
 
@@ -3108,7 +3108,7 @@ void WebPage::updatePreferences(const WebPreferencesStore& store)
 #if ENABLE(DOWNLOAD_ATTRIBUTE)
     RuntimeEnabledFeatures::sharedFeatures().setDownloadAttributeEnabled(store.getBoolValueForKey(WebPreferencesKey::downloadAttributeEnabledKey()));
 #endif
-    
+
     bool processSuppressionEnabled = store.getBoolValueForKey(WebPreferencesKey::pageVisibilityBasedProcessSuppressionEnabledKey());
     if (m_processSuppressionEnabled != processSuppressionEnabled) {
         m_processSuppressionEnabled = processSuppressionEnabled;
index d711e48..32fd71d 100644 (file)
@@ -1,3 +1,15 @@
+2016-04-18  Dean Jackson  <dino@apple.com>
+
+        New SPI to export a dictionary of runtime features
+        https://bugs.webkit.org/show_bug.cgi?id=156645
+        <rdar://problem/23621666>
+
+        Reviewed by Darin Adler.
+
+        Test the experimental features SPI on WKPreferences.
+
+        * TestWebKitAPI/Tests/WebKit2Cocoa/Preferences.mm:
+
 2016-04-18  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [JSCOnly] Implement RunLoop and remove glib dependency
index 5dee581..c5f9f8b 100644 (file)
@@ -30,6 +30,7 @@
 #import "Test.h"
 #import <WebKit/WKFoundation.h>
 #import <WebKit/WKPreferencesPrivate.h>
+#import <WebKit/_WKExperimentalFeature.h>
 #import <wtf/RetainPtr.h>
 
 TEST(WebKit2, DefaultWKPreferences)
@@ -41,4 +42,17 @@ TEST(WebKit2, DefaultWKPreferences)
     EXPECT_TRUE([preferences _isStandalone]);
 }
 
+TEST(WebKit2, ExperimentalFeatures)
+{
+    NSArray<_WKExperimentalFeature *> *features = [WKPreferences _experimentalFeatures];
+    EXPECT_NOT_NULL(features);
+
+    RetainPtr<WKPreferences> preferences = adoptNS([[WKPreferences alloc] init]);
+
+    for (_WKExperimentalFeature *feature in features) {
+        BOOL value = [preferences _isEnabledForFeature:feature];
+        [preferences _setEnabled:value forFeature:feature];
+    }
+}
+
 #endif