Add and expose Internal features from WebKit
authordino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Sep 2018 23:23:38 +0000 (23:23 +0000)
committerdino@apple.com <dino@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Sep 2018 23:23:38 +0000 (23:23 +0000)
commitd7781b2ade01951bcc6bcdfe7bfa87439f073796
tree1da76505ac53d502b490d2bbaaf55c3d09f45628
parenteee29c572108273bfa497933ac3d09c9ec87508e
Add and expose Internal features from WebKit
https://bugs.webkit.org/show_bug.cgi?id=189442
<rdar://problem/44243404>

Reviewed by Simon Fraser.

Source/WebKit:

Experimental features have become a mess. People are using them for
anything that they want to be easily toggled from a host app (e.g.
Safari), which means the user-facing menu has become large and
confusing.

Introduce the idea of Internal features, that will be exposed in a way
that end-users are not expected to ever see (unless they really want
to).

* CMakeLists.txt: Add new files.
* Sources.txt:
* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:

* DerivedSources.make: Add new generated files.
* Scripts/GeneratePreferences.rb: Generate the preferences stuff for Internal Debug features.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb: Added.

* Shared/API/APIObject.h: New API object for InternalDebugFeature.
* Shared/Cocoa/APIObject.mm:
(API::Object::newObject):

* Shared/WebPreferences.yaml: Change some of the existing experimental features to "internal".

* UIProcess/API/APIInternalDebugFeature.cpp: New API type - just like APIExperimentalFeature.
(API::InternalDebugFeature::create):
(API::InternalDebugFeature::InternalDebugFeature):
(API::InternalDebugFeature::~InternalDebugFeature):
* UIProcess/API/APIInternalDebugFeature.h:
* UIProcess/API/C/WKAPICast.h:

* UIProcess/API/Cocoa/WKPreferences.mm: Change the naming of the experimental feature API so that it
won't clash with internal debug features. We can remove the old API once Safari has adopted.
(+[WKPreferences _internalDebugFeatures]):
(-[WKPreferences _isEnabledForInternalDebugFeature:]):
(-[WKPreferences _setEnabled:forInternalDebugFeature:]):
(-[WKPreferences _isEnabledForFeature:]):
(-[WKPreferences _setEnabled:forFeature:]):
(-[WKPreferences _isEnabledForExperimentalFeature:]):
(-[WKPreferences _setEnabled:forExperimentalFeature:]):
* UIProcess/API/Cocoa/WKPreferencesPrivate.h:

* UIProcess/API/Cocoa/_WKInternalDebugFeature.h: New object - same as _WKExperimentalFeature.
* UIProcess/API/Cocoa/_WKInternalDebugFeature.mm:
(-[_WKInternalDebugFeature dealloc]):
(-[_WKInternalDebugFeature description]):
(-[_WKInternalDebugFeature name]):
(-[_WKInternalDebugFeature key]):
(-[_WKInternalDebugFeature details]):
(-[_WKInternalDebugFeature defaultValue]):
(-[_WKInternalDebugFeature isHidden]):
(-[_WKInternalDebugFeature _apiObject]):
* UIProcess/API/Cocoa/_WKInternalDebugFeatureInternal.h:

* UIProcess/WebPreferences.cpp: Add support for Internal Debug features.
(WebKit::WebPreferences::updateBoolValueForInternalDebugFeatureKey):
(WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey):
* UIProcess/WebPreferences.h:

* UIProcess/WebProcessPool.cpp: Change a comment now that it is an internal feature.
(WebKit::WebProcessPool::createWebPage):

Tools:

Update MiniBrowser to expose an Internal feature menu.

* MiniBrowser/mac/AppDelegate.m:
(defaultConfiguration):
* MiniBrowser/mac/SettingsController.m:
(-[SettingsController _populateMenu]):
(-[SettingsController validateMenuItem:]):
(-[SettingsController toggleExperimentalFeature:]):
(-[SettingsController toggleInternalDebugFeature:]):

LayoutTests:

Skip some tests that rely on an experimental feature that has
moved to internal. A follow-up patch will allow WKTR to enable
them on demand.

* platform/mac/TestExpectations:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@235921 268f45cc-cd09-0410-ab3c-d52691b4dbfc
31 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/TestExpectations
Source/WebKit/CMakeLists.txt
Source/WebKit/ChangeLog
Source/WebKit/DerivedSources.make
Source/WebKit/Scripts/GeneratePreferences.rb
Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb
Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb
Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb [new file with mode: 0644]
Source/WebKit/Shared/API/APIObject.h
Source/WebKit/Shared/Cocoa/APIObject.mm
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/Sources.txt
Source/WebKit/SourcesCocoa.txt
Source/WebKit/UIProcess/API/APIExperimentalFeature.cpp
Source/WebKit/UIProcess/API/APIExperimentalFeature.h
Source/WebKit/UIProcess/API/APIInternalDebugFeature.cpp [new file with mode: 0644]
Source/WebKit/UIProcess/API/APIInternalDebugFeature.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/C/WKAPICast.h
Source/WebKit/UIProcess/API/Cocoa/WKPreferences.mm
Source/WebKit/UIProcess/API/Cocoa/WKPreferencesPrivate.h
Source/WebKit/UIProcess/API/Cocoa/_WKInternalDebugFeature.h [new file with mode: 0644]
Source/WebKit/UIProcess/API/Cocoa/_WKInternalDebugFeature.mm [new file with mode: 0644]
Source/WebKit/UIProcess/API/Cocoa/_WKInternalDebugFeatureInternal.h [new file with mode: 0644]
Source/WebKit/UIProcess/WebPreferences.cpp
Source/WebKit/UIProcess/WebPreferences.h
Source/WebKit/UIProcess/WebProcessPool.cpp
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Tools/ChangeLog
Tools/MiniBrowser/mac/AppDelegate.m
Tools/MiniBrowser/mac/SettingsController.m