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)
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

index ae4ede2..b02d39d 100644 (file)
@@ -1,3 +1,17 @@
+2018-09-07  Dean Jackson  <dino@apple.com>
+
+        Add and expose Internal features from WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=189442
+        <rdar://problem/44243404>
+
+        Reviewed by Simon Fraser.
+
+        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:
+
 2018-09-11  Jer Noble  <jer.noble@apple.com>
 
         [MediaCapabilities] Implement MediaEngineConfigurationFactory registration
index b4d9fc4..c4bb160 100644 (file)
@@ -1765,3 +1765,6 @@ webkit.org/b/187393 imported/w3c/web-platform-tests/2dcontext/imagebitmap/create
 [ Mojave+ ] fast/gradients/conic-extended-stops.html [ Pass ]
 [ Mojave+ ] fast/gradients/conic-from-angle.html [ Pass ]
 
+# Mark these as failing while Internal Debug Features default to off in WKTR
+imported/w3c/web-platform-tests/media-source/mediasource-changetype.html [ Pass Failure ]
+imported/w3c/web-platform-tests/media-source/mediasource-changetype-play.html [ Pass Failure ]
index 1d6b3b7..dea3e5b 100644 (file)
@@ -399,13 +399,14 @@ set(WebKit_WEB_PREFERENCES_TEMPLATES
     ${WEBKIT_DIR}/Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb
     ${WEBKIT_DIR}/Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb
     ${WEBKIT_DIR}/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb
+    ${WEBKIT_DIR}/Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb
     ${WEBKIT_DIR}/Scripts/PreferencesTemplates/WebPreferencesKeys.cpp.erb
     ${WEBKIT_DIR}/Scripts/PreferencesTemplates/WebPreferencesKeys.h.erb
     ${WEBKIT_DIR}/Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb
 )
 
 add_custom_command(
-    OUTPUT ${DERIVED_SOURCES_WEBKIT_DIR}/WebPageUpdatePreferences.cpp ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesDefinitions.h ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesExperimentalFeatures.cpp ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesKeys.cpp ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesKeys.h ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesStoreDefaultsMap.cpp
+    OUTPUT ${DERIVED_SOURCES_WEBKIT_DIR}/WebPageUpdatePreferences.cpp ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesDefinitions.h ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesExperimentalFeatures.cpp ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesInternalDebugFeatures.cpp ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesKeys.cpp ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesKeys.h ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesStoreDefaultsMap.cpp
     MAIN_DEPENDENCY ${WEBKIT_DIR}/Shared/WebPreferences.yaml
     DEPENDS ${WebKit_WEB_PREFERENCES_TEMPLATES}
     COMMAND ${RUBY_EXECUTABLE} ${WEBKIT_DIR}/Scripts/GeneratePreferences.rb --input ${WEBKIT_DIR}/Shared/WebPreferences.yaml --outputDir "${DERIVED_SOURCES_WEBKIT_DIR}"
@@ -419,6 +420,7 @@ list(APPEND WebKit_HEADERS
 list(APPEND WebKit_SOURCES
     ${DERIVED_SOURCES_WEBKIT_DIR}/WebPageUpdatePreferences.cpp
     ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesExperimentalFeatures.cpp
+    ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesInternalDebugFeatures.cpp
     ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesKeys.cpp
     ${DERIVED_SOURCES_WEBKIT_DIR}/WebPreferencesStoreDefaultsMap.cpp
 )
index bda82cd..3760210 100644 (file)
@@ -1,3 +1,74 @@
+2018-09-07  Dean Jackson  <dino@apple.com>
+
+        Add and expose Internal features from WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=189442
+        <rdar://problem/44243404>
+
+        Reviewed by Simon Fraser.
+
+        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):
+
 2018-09-11  Eric Carlson  <eric.carlson@apple.com>
 
         WebPage::close should clear UserMediaPermissionRequestManager
index bdec283..0c020d3 100644 (file)
@@ -295,14 +295,15 @@ WEB_PREFERENCES_TEMPLATES = \
     $(WebKit2)/Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb \
     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb \
     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb \
+    $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb \
     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesKeys.h.erb \
     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesKeys.cpp.erb \
     $(WebKit2)/Scripts/PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb \
 
 #
 
-all : WebPageUpdatePreferences.cpp WebPreferencesDefinitions.h WebPreferencesExperimentalFeatures.cpp WebPreferencesKeys.h WebPreferencesKeys.cpp WebPreferencesStoreDefaultsMap.cpp
+all : WebPageUpdatePreferences.cpp WebPreferencesDefinitions.h WebPreferencesExperimentalFeatures.cpp WebPreferencesInternalDebugFeatures.cpp WebPreferencesKeys.h WebPreferencesKeys.cpp WebPreferencesStoreDefaultsMap.cpp
 
-WebPageUpdatePreferences%cpp WebPreferencesDefinitions%h WebPreferencesExperimentalFeatures%cpp WebPreferencesKeys%h WebPreferencesKeys%cpp WebPreferencesStoreDefaultsMap%cpp : $(WebKit2)/Scripts/GeneratePreferences.rb $(WEB_PREFERENCES_TEMPLATES) $(WebKit2)/Shared/WebPreferences.yaml
+WebPageUpdatePreferences%cpp WebPreferencesDefinitions%h WebPreferencesExperimentalFeatures%cpp WebPreferencesInternalDebugFeatures%cpp WebPreferencesKeys%h WebPreferencesKeys%cpp WebPreferencesStoreDefaultsMap%cpp : $(WebKit2)/Scripts/GeneratePreferences.rb $(WEB_PREFERENCES_TEMPLATES) $(WebKit2)/Shared/WebPreferences.yaml
        $(RUBY) $< --input $(WebKit2)/Shared/WebPreferences.yaml
 
index 131caf4..5ff5bd8 100755 (executable)
@@ -28,7 +28,7 @@ require 'erb'
 require 'optparse'
 require 'yaml'
 
-options = { 
+options = {
   :input => nil,
   :outputDirectory => nil
 }
@@ -128,17 +128,18 @@ end
 
 class Preferences
   attr_accessor :preferences
-  
+
   def initialize(hash)
     @preferences = []
     hash.each do |name, options|
       @preferences << Preference.new(name, options)
     end
     @preferences.sort! { |x, y| x.name <=> y.name }
-    
+
     @preferencesNotDebug = @preferences.select { |p| !p.category }
     @preferencesDebug = @preferences.select { |p| p.category == "debug" }
     @experimentalFeatures = @preferences.select { |p| p.category == "experimental" }
+    @internalDebugFeatures = @preferences.select { |p| p.category == "internal" }
 
     @preferencesBoundToSetting = @preferences.select { |p| !p.webcoreBinding }
     @preferencesBoundToDeprecatedGlobalSettings = @preferences.select { |p| p.webcoreBinding == "DeprecatedGlobalSettings" }
@@ -161,4 +162,5 @@ preferences.renderToFile("PreferencesTemplates/WebPageUpdatePreferences.cpp.erb"
 preferences.renderToFile("PreferencesTemplates/WebPreferencesKeys.h.erb", File.join(options[:outputDirectory], "WebPreferencesKeys.h"))
 preferences.renderToFile("PreferencesTemplates/WebPreferencesKeys.cpp.erb", File.join(options[:outputDirectory], "WebPreferencesKeys.cpp"))
 preferences.renderToFile("PreferencesTemplates/WebPreferencesStoreDefaultsMap.cpp.erb", File.join(options[:outputDirectory], "WebPreferencesStoreDefaultsMap.cpp"))
+preferences.renderToFile("PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb", File.join(options[:outputDirectory], "WebPreferencesInternalDebugFeatures.cpp"))
 preferences.renderToFile("PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb", File.join(options[:outputDirectory], "WebPreferencesExperimentalFeatures.cpp"))
index 9cb732d..e6774e2 100644 (file)
 <%- end -%>
     \
 
+// Internal Debug Features
+
+#define FOR_EACH_WEBKIT_INTERNAL_DEBUG_FEATURE_PREFERENCE(macro) \
+<%- for @pref in @internalDebugFeatures do -%>
+    macro(<%= @pref.name %>, <%= @pref.nameLower %>, Bool, bool, <%= @pref.defaultValue %>, <%= @pref.humanReadableName %>, <%= @pref.humanReadableDescription %>) \
+<%- end -%>
+   \
 
 // Experimental Features
 
index 1c15dbb..79f0c06 100644 (file)
@@ -63,7 +63,7 @@ const Vector<RefPtr<API::Object>>& WebPreferences::experimentalFeatures()
     return features;
 }
 
-bool WebPreferences::isEnabledForFeature(const API::ExperimentalFeature& feature) const
+bool WebPreferences::isFeatureEnabled(const API::ExperimentalFeature& feature) const
 {
     struct FeatureGetterMapping {
         const char* name;
@@ -92,7 +92,7 @@ bool WebPreferences::isEnabledForFeature(const API::ExperimentalFeature& feature
     return false;
 }
 
-void WebPreferences::setEnabledForFeature(bool value, const API::ExperimentalFeature& feature)
+void WebPreferences::setFeatureEnabled(const API::ExperimentalFeature& feature, bool value)
 {
     struct FeatureSetterMapping {
         const char* name;
diff --git a/Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb b/Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb
new file mode 100644 (file)
index 0000000..90c03e5
--- /dev/null
@@ -0,0 +1,124 @@
+/*
+* THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT.
+*
+* Copyright (C) 2018 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 "WebPreferences.h"
+
+#include "WebPreferencesKeys.h"
+
+namespace WebKit {
+
+<%- for @pref in @internalDebugFeatures do -%>
+void WebPreferences::set<%= @pref.name %>(const bool& value)
+{
+    if (!m_store.setBoolValueForKey(WebPreferencesKey::<%= @pref.nameLower %>Key(), value))
+        return;
+    updateBoolValueForInternalDebugFeatureKey(WebPreferencesKey::<%= @pref.nameLower %>Key(), value);
+}
+
+bool WebPreferences::<%= @pref.nameLower %>() const
+{
+    return m_store.getBoolValueForKey(WebPreferencesKey::<%= @pref.nameLower %>Key());
+}
+
+<%- end -%>
+const Vector<RefPtr<API::Object>>& WebPreferences::internalDebugFeatures()
+{
+    static NeverDestroyed<Vector<RefPtr<API::Object>>> features(std::initializer_list<RefPtr<API::Object>> {
+<%- for @pref in @internalDebugFeatures do -%>
+<%- if @pref.condition -%>
+#if <%= @pref.condition %>
+<%- end -%>
+        API::InternalDebugFeature::create(<%= @pref.humanReadableName %>, "<%= @pref.name %>", <%= @pref.humanReadableDescription %>, <%= @pref.defaultValue %>, <%= @pref.hidden %>),
+<%- if @pref.condition -%>
+#endif
+<%- end -%>
+<%- end -%>
+    });
+
+    return features;
+}
+
+bool WebPreferences::isFeatureEnabled(const API::InternalDebugFeature& feature) const
+{
+    struct FeatureGetterMapping {
+        const char* name;
+        bool (WebPreferences::*function) () const;
+    };
+
+    static FeatureGetterMapping getters[] = {
+<%- for @pref in @internalDebugFeatures do -%>
+<%- if @pref.condition -%>
+#if <%= @pref.condition %>
+<%- end -%>
+        { "<%= @pref.name %>", &WebPreferences::<%= @pref.nameLower %> },
+<%- if @pref.condition -%>
+#endif
+<%- end -%>
+<%- end -%>
+    };
+
+    const String& key = feature.key();
+
+    for (auto& getter : getters) {
+        if (key == getter.name)
+            return (this->*getter.function)();
+    }
+
+    return false;
+}
+
+void WebPreferences::setFeatureEnabled(const API::InternalDebugFeature& feature, bool value)
+{
+    struct FeatureSetterMapping {
+        const char* name;
+        void (WebPreferences::*function) (const bool&);
+    };
+
+    static FeatureSetterMapping setters[] = {
+<%- for @pref in @internalDebugFeatures do -%>
+<%- if @pref.condition -%>
+#if <%= @pref.condition %>
+<%- end -%>
+        { "<%= @pref.name %>", &WebPreferences::set<%= @pref.name %> },
+<%- if @pref.condition -%>
+#endif
+<%- end -%>
+<%- end -%>
+    };
+
+    const String& key = feature.key();
+
+    for (auto& setter : setters) {
+        if (key == setter.name) {
+            (this->*setter.function)(value);
+            return;
+        }
+    }
+}
+
+}
index 1f6003f..b0ca54d 100644 (file)
@@ -110,6 +110,7 @@ public:
         ContentRuleListStore,
         ContextMenuListener,
         CookieManager,
+        InternalDebugFeature,
         Download,
         ExperimentalFeature,
         FormSubmissionListener,
index 448ffd2..ecc352f 100644 (file)
@@ -76,6 +76,7 @@
 #import "_WKGeolocationPositionInternal.h"
 #import "_WKHitTestResultInternal.h"
 #import "_WKInspectorInternal.h"
+#import "_WKInternalDebugFeatureInternal.h"
 #import "_WKProcessPoolConfigurationInternal.h"
 #import "_WKUserContentWorldInternal.h"
 #import "_WKUserInitiatedActionInternal.h"
@@ -194,6 +195,10 @@ void* Object::newObject(size_t size, Type type)
         wrapper = [WKNSData alloc];
         break;
 
+    case Type::InternalDebugFeature:
+        wrapper = [_WKInternalDebugFeature alloc];
+        break;
+
     case Type::Dictionary:
         wrapper = [WKNSDictionary alloc];
         break;
index 4bee637..15999fb 100644 (file)
@@ -1127,20 +1127,13 @@ IsSecureContextAttributeEnabled:
 
 # For experimental features:
 # The type should be boolean.
-# You must provide a humanReadableName and humanReadableName for all experimental features. They
+# You must provide a humanReadableName and humanReadableDescription for all experimental features. They
 #   are the text exposed to the user from the WebKit client.
 # The default value may be either false (for unstable features) or
 #   DEFAULT_EXPERIMENTAL_FEATURES_ENABLED (for features that are ready for
 #   wider testing).
 
 
-AsyncFrameScrollingEnabled:
-  type: bool
-  defaultValue: false
-  humanReadableName: "Async Frame Scrolling"
-  humanReadableDescription: "Perform frame scrolling in a dedicated thread or process"
-  category: experimental
-
 SpringTimingFunctionEnabled:
   type: bool
   defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED
@@ -1172,38 +1165,10 @@ IntersectionObserverEnabled:
   category: experimental
   condition: ENABLE(INTERSECTION_OBSERVER)
 
-MDNSICECandidatesEnabled:
-  type: bool
-  defaultValue: false
-  humanReadableName: "Enable MDNS ICE candidates"
-  humanReadableDescription: "Enable MDNS ICE candidates"
-  webcoreBinding: RuntimeEnabledFeatures
-  category: experimental
-  condition: ENABLE(WEB_RTC)
-
-FetchAPIKeepAliveEnabled:
-  type: bool
-  defaultValue: false
-  humanReadableName: "Fetch API Request KeepAlive"
-  humanReadableDescription: "Enable Fetch API Request KeepAlive"
-  category: experimental
-  webcoreBinding: RuntimeEnabledFeatures
-  webcoreName: fetchAPIKeepAliveEnabled
-
-ServiceWorkersEnabled:
-  type: bool
-  defaultValue: DEFAULT_SERVICE_WORKERS_ENABLED
-  humanReadableName: "ServiceWorkers"
-  humanReadableDescription: "Enable ServiceWorkers"
-  category: experimental
-  webcoreBinding: RuntimeEnabledFeatures
-  webcoreName: serviceWorkerEnabled
-  condition: ENABLE(SERVICE_WORKER)
-
 VisualViewportAPIEnabled:
   type: bool
   defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED
-  humanReadableName: "VisualViewportAPI"
+  humanReadableName: "Visual Viewport API"
   humanReadableDescription: "Enable Visual Viewport API"
   category: experimental
 
@@ -1225,7 +1190,7 @@ WebAnimationsEnabled:
 WebAnimationsCSSIntegrationEnabled:
   type: bool
   defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED
-  humanReadableName: "Web Animations and CSS Integration"
+  humanReadableName: "CSS Animations via Web Animations"
   humanReadableDescription: "Expose CSS Animations and CSS Transitions through getAnimations()"
   category: experimental
   webcoreBinding: RuntimeEnabledFeatures
@@ -1256,14 +1221,6 @@ AccessibilityObjectModelEnabled:
   category: experimental
   webcoreBinding: RuntimeEnabledFeatures
 
-AriaReflectionEnabled:
-  type: bool
-  defaultValue: true
-  humanReadableName: "ARIA Reflection"
-  humanReadableDescription: "ARIA Reflection support"
-  category: experimental
-  webcoreBinding: RuntimeEnabledFeatures
-
 WebVREnabled:
   type: bool
   defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED
@@ -1273,39 +1230,104 @@ WebVREnabled:
   category: experimental
   condition: PLATFORM(GTK) || PLATFORM(WPE)
 
+ServerTimingEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "Server Timing"
+  humanReadableDescription: "Enable Server Timing API"
+  category: experimental
+  webcoreBinding: RuntimeEnabledFeatures
+  webcoreName: serverTimingEnabled
+
+EncryptedMediaAPIEnabled:
+  type: bool
+  defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED
+  humanReadableName: "Modern Encrypted Media API"
+  humanReadableDescription: "Enable Modern Encrypted Media API"
+  webcoreBinding: RuntimeEnabledFeatures
+  category: experimental
+  condition: ENABLE(ENCRYPTED_MEDIA)
+
+# For internal features:
+# The type should be boolean.
+# You must provide a humanReadableName and humanReadableDescription for all debug features. They
+#   are the text exposed to the user from the WebKit client.
+
+ExperimentalPlugInSandboxProfilesEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "Sandbox Plug-Ins"
+  humanReadableDescription: "Enable Plug-In sandboxing"
+  category: internal
+  webcoreBinding: RuntimeEnabledFeatures
+  webcoreName: experimentalPlugInSandboxProfilesEnabled
+
+ProcessSwapOnCrossSiteNavigationEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "Swap Processes on Cross-Site Navigation"
+  humanReadableDescription: "Swap WebContent processes on cross-site navigations"
+  category: internal
+  webcoreBinding: none
+
+SourceBufferChangeTypeEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "Media Source Codec Switching Support"
+  humanReadableDescription: "Media Source Codec Switching through changeType()"
+  category: internal
+  condition: ENABLE(MEDIA_SOURCE)
+
 ResourceLoadStatisticsDebugMode:
   type: bool
   defaultValue: false
   humanReadableName: "ITP Debug Mode"
   humanReadableDescription: "Intelligent Tracking Prevention Debug Mode"
-  category: experimental
+  category: internal
   webcoreBinding: RuntimeEnabledFeatures
 
-WebGLCompressedTextureASTCSupportEnabled:
+ServiceWorkersEnabled:
+  type: bool
+  defaultValue: DEFAULT_SERVICE_WORKERS_ENABLED
+  humanReadableName: "Service Workers"
+  humanReadableDescription: "Enable Service Workers"
+  category: internal
+  webcoreBinding: RuntimeEnabledFeatures
+  webcoreName: serviceWorkerEnabled
+  condition: ENABLE(SERVICE_WORKER)
+
+AsyncFrameScrollingEnabled:
   type: bool
   defaultValue: false
-  humanReadableName: "ASTC Texture Support"
-  humanReadableDescription: "Support for ASTC compressed texture formats in WebGL"
-  category: experimental
+  humanReadableName: "Async Frame Scrolling"
+  humanReadableDescription: "Perform frame scrolling in a dedicated thread or process"
+  category: internal
+
+MDNSICECandidatesEnabled:
+  type: bool
+  defaultValue: false
+  humanReadableName: "MDNS ICE candidates"
+  humanReadableDescription: "Enable MDNS ICE candidates"
   webcoreBinding: RuntimeEnabledFeatures
+  category: internal
+  condition: ENABLE(WEB_RTC)
 
-ServerTimingEnabled:
+FetchAPIKeepAliveEnabled:
   type: bool
   defaultValue: false
-  humanReadableName: "Server Timing"
-  humanReadableDescription: "Enable Server Timing API"
-  category: experimental
+  humanReadableName: "Fetch API Request KeepAlive"
+  humanReadableDescription: "Enable Fetch API Request KeepAlive"
+  category: internal
   webcoreBinding: RuntimeEnabledFeatures
-  webcoreName: serverTimingEnabled
+  webcoreName: fetchAPIKeepAliveEnabled
 
-ExperimentalPlugInSandboxProfilesEnabled:
+WebGLCompressedTextureASTCSupportEnabled:
   type: bool
   defaultValue: false
-  humanReadableName: "Sandbox Plug-Ins"
-  humanReadableDescription: "Enable Plug-In sandboxing"
-  category: debug
+  humanReadableName: "ASTC Texture Support"
+  humanReadableDescription: "Support for ASTC compressed texture formats in WebGL"
+  category: internal
   webcoreBinding: RuntimeEnabledFeatures
-  webcoreName: experimentalPlugInSandboxProfilesEnabled
 
 FullScreenEnabled:
   type: bool
@@ -1314,32 +1336,15 @@ FullScreenEnabled:
   hidden: EXPERIMENTAL_FULLSCREEN_API_HIDDEN
   humanReadableName: "Fullscreen API"
   humanReadableDescription: "Fullscreen API"
-  category: experimental
+  category: internal
 
-EncryptedMediaAPIEnabled:
+AriaReflectionEnabled:
   type: bool
-  defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED
-  humanReadableName: "Modern Encrypted Media API"
-  humanReadableDescription: "Modern Encrypted Media API"
+  defaultValue: true
+  humanReadableName: "ARIA Reflection"
+  humanReadableDescription: "ARIA Reflection support"
+  category: internal
   webcoreBinding: RuntimeEnabledFeatures
-  category: experimental
-  condition: ENABLE(ENCRYPTED_MEDIA)
-
-ProcessSwapOnCrossSiteNavigationEnabled:
-  type: bool
-  defaultValue: false
-  humanReadableName: "Swap Processes on Cross-Site Navigation"
-  humanReadableDescription: "Swap WebContent processes on cross-site navigations"
-  category: experimental
-  webcoreBinding: none
-
-SourceBufferChangeTypeEnabled:
-  type: bool
-  defaultValue: DEFAULT_EXPERIMENTAL_FEATURES_ENABLED
-  humanReadableName: "Media Source Codec Switching Support"
-  humanReadableDescription: "Enable Media Source Codec Switching through changeType()"
-  category: experimental
-  condition: ENABLE(MEDIA_SOURCE)
 
 WebAPIStatisticsEnabled:
   type: bool
@@ -1347,4 +1352,4 @@ WebAPIStatisticsEnabled:
   humanReadableName: "Web API Statistics"
   humanReadableDescription: "Enable Web API Statistics"
   webcoreBinding: RuntimeEnabledFeatures
-  category: experimental
+  category: internal
index 947cfd4..dad703a 100644 (file)
@@ -292,6 +292,7 @@ UIProcess/API/APIExperimentalFeature.cpp
 UIProcess/API/APIFrameInfo.cpp
 UIProcess/API/APIHTTPCookieStore.cpp
 UIProcess/API/APIHitTestResult.cpp
+UIProcess/API/APIInternalDebugFeature.cpp
 UIProcess/API/APINavigation.cpp
 UIProcess/API/APINavigationData.cpp
 UIProcess/API/APIPageConfiguration.cpp
index 16d07ba..2fb8e1a 100644 (file)
@@ -240,6 +240,7 @@ UIProcess/API/Cocoa/_WKErrorRecoveryAttempting.mm
 UIProcess/API/Cocoa/_WKExperimentalFeature.mm
 UIProcess/API/Cocoa/_WKGeolocationPosition.mm
 UIProcess/API/Cocoa/_WKInspector.mm
+UIProcess/API/Cocoa/_WKInternalDebugFeature.mm
 UIProcess/API/Cocoa/_WKLinkIconParameters.mm
 UIProcess/API/Cocoa/_WKProcessPoolConfiguration.mm
 UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm
index e1a323a..7b2dc10 100644 (file)
@@ -42,8 +42,4 @@ ExperimentalFeature::ExperimentalFeature(const WTF::String& name, const WTF::Str
 {
 }
 
-ExperimentalFeature::~ExperimentalFeature()
-{
-}
-
 }
index f3d4aef..60a8c16 100644 (file)
@@ -34,7 +34,7 @@ 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, bool defaultValue, bool hidden);
-    virtual ~ExperimentalFeature();
+    virtual ~ExperimentalFeature() = default;
 
     WTF::String name() const { return m_name; }
     WTF::String key() const { return m_key; }
diff --git a/Source/WebKit/UIProcess/API/APIInternalDebugFeature.cpp b/Source/WebKit/UIProcess/API/APIInternalDebugFeature.cpp
new file mode 100644 (file)
index 0000000..1ed2e99
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2018 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 "APIInternalDebugFeature.h"
+
+namespace API {
+
+Ref<InternalDebugFeature> InternalDebugFeature::create(const WTF::String& name, const WTF::String& key, const WTF::String& details, bool defaultValue, bool hidden)
+{
+    return adoptRef(*new InternalDebugFeature(name, key, details, defaultValue, hidden));
+}
+
+InternalDebugFeature::InternalDebugFeature(const WTF::String& name, const WTF::String& key, const WTF::String& details, bool defaultValue, bool hidden)
+    : m_name(name)
+    , m_key(key)
+    , m_details(details)
+    , m_defaultValue(defaultValue)
+    , m_hidden(hidden)
+{
+}
+
+}
diff --git a/Source/WebKit/UIProcess/API/APIInternalDebugFeature.h b/Source/WebKit/UIProcess/API/APIInternalDebugFeature.h
new file mode 100644 (file)
index 0000000..7ac3984
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2018 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.
+ */
+
+#pragma once
+
+#include "APIObject.h"
+#include <wtf/text/WTFString.h>
+
+namespace API {
+
+class InternalDebugFeature final : public ObjectImpl<Object::Type::InternalDebugFeature> {
+public:
+    static Ref<InternalDebugFeature> create(const WTF::String& name, const WTF::String& key, const WTF::String& details, bool defaultValue, bool hidden);
+    virtual ~InternalDebugFeature() = default;
+
+    WTF::String name() const { return m_name; }
+    WTF::String key() const { return m_key; }
+    WTF::String details() const { return m_details; }
+    bool defaultValue() const { return m_defaultValue; }
+    bool isHidden() const { return m_hidden; }
+
+private:
+    explicit InternalDebugFeature(const WTF::String& name, const WTF::String& key, const WTF::String& details, bool defaultValue, bool hidden);
+
+    WTF::String m_name;
+    WTF::String m_key;
+    WTF::String m_details;
+    bool m_defaultValue;
+    bool m_hidden;
+};
+
+}
index e65fd97..718707f 100644 (file)
@@ -54,6 +54,7 @@
 namespace API {
 class ContentRuleList;
 class ContentRuleListStore;
+class InternalDebugFeature;
 class ExperimentalFeature;
 class FrameHandle;
 class FrameInfo;
index 3e827ec..c258ce2 100644 (file)
@@ -32,8 +32,8 @@
 #import "PluginProcessManager.h"
 #import "WKNSArray.h"
 #import "WebPreferences.h"
-#import "_WKExperimentalFeature.h"
 #import "_WKExperimentalFeatureInternal.h"
+#import "_WKInternalDebugFeatureInternal.h"
 #import <WebCore/SecurityOrigin.h>
 #import <WebCore/Settings.h>
 #import <wtf/RetainPtr.h>
@@ -527,20 +527,48 @@ static _WKStorageBlockingPolicy toAPI(WebCore::SecurityOrigin::StorageBlockingPo
     _preferences->setFixedFontFamily(fixedPitchFontFamily);
 }
 
++ (NSArray<_WKInternalDebugFeature *> *)_internalDebugFeatures
+{
+    auto features = WebKit::WebPreferences::internalDebugFeatures();
+    return wrapper(API::Array::create(WTFMove(features)));
+}
+
+- (BOOL)_isEnabledForInternalDebugFeature:(_WKInternalDebugFeature *)feature
+{
+    return _preferences->isFeatureEnabled(*feature->_internalDebugFeature);
+}
+
+- (void)_setEnabled:(BOOL)value forInternalDebugFeature:(_WKInternalDebugFeature *)feature
+{
+    _preferences->setFeatureEnabled(*feature->_internalDebugFeature, value);
+}
+
 + (NSArray<_WKExperimentalFeature *> *)_experimentalFeatures
 {
     auto features = WebKit::WebPreferences::experimentalFeatures();
     return wrapper(API::Array::create(WTFMove(features)));
 }
 
+// FIXME: Remove this once Safari has adopted the new API.
 - (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature
 {
-    return _preferences->isEnabledForFeature(*feature->_experimentalFeature);
+    return [self _isEnabledForExperimentalFeature:feature];
 }
 
+// FIXME: Remove this once Safari has adopted the new API.
 - (void)_setEnabled:(BOOL)value forFeature:(_WKExperimentalFeature *)feature
 {
-    _preferences->setEnabledForFeature(value, *feature->_experimentalFeature);
+    [self _setEnabled:value forExperimentalFeature:feature];
+}
+
+- (BOOL)_isEnabledForExperimentalFeature:(_WKExperimentalFeature *)feature
+{
+    return _preferences->isFeatureEnabled(*feature->_experimentalFeature);
+}
+
+- (void)_setEnabled:(BOOL)value forExperimentalFeature:(_WKExperimentalFeature *)feature
+{
+    _preferences->setFeatureEnabled(*feature->_experimentalFeature, value);
 }
 
 - (BOOL)_applePayCapabilityDisclosureAllowed
index 3879e35..100fda2 100644 (file)
@@ -55,6 +55,7 @@ typedef NS_ENUM(NSInteger, _WKEditableLinkBehavior) {
 } WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));
 
 @class _WKExperimentalFeature;
+@class _WKInternalDebugFeature;
 
 @interface WKPreferences () <NSCopying>
 @end
@@ -130,9 +131,15 @@ typedef NS_ENUM(NSInteger, _WKEditableLinkBehavior) {
 
 @property (nonatomic, setter=_setAVFoundationEnabled:) BOOL _avFoundationEnabled WK_API_AVAILABLE(macosx(10.10), ios(WK_IOS_TBA));
 
++ (NSArray<_WKInternalDebugFeature *> *)_internalDebugFeatures WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (BOOL)_isEnabledForInternalDebugFeature:(_WKInternalDebugFeature *)feature WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+- (void)_setEnabled:(BOOL)value forInternalDebugFeature:(_WKInternalDebugFeature *)feature WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
+
 + (NSArray<_WKExperimentalFeature *> *)_experimentalFeatures WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 - (BOOL)_isEnabledForFeature:(_WKExperimentalFeature *)feature WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 - (void)_setEnabled:(BOOL)value forFeature:(_WKExperimentalFeature *)feature WK_API_AVAILABLE(macosx(10.12), ios(10.0));
+- (BOOL)_isEnabledForExperimentalFeature:(_WKExperimentalFeature *)feature WK_API_AVAILABLE(macosx(10.12), ios(10.0));
+- (void)_setEnabled:(BOOL)value forExperimentalFeature:(_WKExperimentalFeature *)feature WK_API_AVAILABLE(macosx(10.12), ios(10.0));
 
 @property (nonatomic, setter=_setShouldEnableTextAutosizingBoost:) BOOL _shouldEnableTextAutosizingBoost WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA));
 
diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKInternalDebugFeature.h b/Source/WebKit/UIProcess/API/Cocoa/_WKInternalDebugFeature.h
new file mode 100644 (file)
index 0000000..7515494
--- /dev/null
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2018 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(macosx(WK_MAC_TBA), ios(WK_IOS_TBA))
+@interface _WKInternalDebugFeature : NSObject
+
+@property (nonatomic, readonly, copy) NSString *key;
+@property (nonatomic, readonly, copy) NSString *name;
+@property (nonatomic, readonly, copy) NSString *details;
+@property (nonatomic, readonly) BOOL defaultValue;
+@property (nonatomic, readonly, getter=isHidden) BOOL hidden;
+
+@end
+
+#endif
diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKInternalDebugFeature.mm b/Source/WebKit/UIProcess/API/Cocoa/_WKInternalDebugFeature.mm
new file mode 100644 (file)
index 0000000..6c78707
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2018 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 "_WKInternalDebugFeatureInternal.h"
+
+#if WK_API_ENABLED
+
+@implementation _WKInternalDebugFeature
+
+- (void)dealloc
+{
+    _internalDebugFeature->API::InternalDebugFeature::~InternalDebugFeature();
+
+    [super dealloc];
+}
+
+- (NSString *)description
+{
+    return [NSString stringWithFormat:@"<%@: %p; name = %@; key = %@; defaultValue = %s >", NSStringFromClass(self.class), self, self.name, self.key, self.defaultValue ? "on" : "off"];
+}
+
+- (NSString *)name
+{
+    return _internalDebugFeature->name();
+}
+
+- (NSString *)key
+{
+    return _internalDebugFeature->key();
+}
+
+- (NSString *)details
+{
+    return _internalDebugFeature->details();
+}
+
+- (BOOL)defaultValue
+{
+    return _internalDebugFeature->defaultValue();
+}
+
+- (BOOL)isHidden
+{
+    return _internalDebugFeature->isHidden();
+}
+
+#pragma mark WKObject protocol implementation
+
+- (API::Object&)_apiObject
+{
+    return *_internalDebugFeature;
+}
+
+@end
+
+#endif
diff --git a/Source/WebKit/UIProcess/API/Cocoa/_WKInternalDebugFeatureInternal.h b/Source/WebKit/UIProcess/API/Cocoa/_WKInternalDebugFeatureInternal.h
new file mode 100644 (file)
index 0000000..dffe9c1
--- /dev/null
@@ -0,0 +1,47 @@
+/*
+ * Copyright (C) 2018 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 "_WKInternalDebugFeature.h"
+
+#if WK_API_ENABLED
+
+#import "APIInternalDebugFeature.h"
+#import "WKObject.h"
+
+namespace WebKit {
+
+template<> struct WrapperTraits<API::InternalDebugFeature> {
+    using WrapperClass = _WKInternalDebugFeature;
+};
+
+}
+
+@interface _WKInternalDebugFeature () <WKObject> {
+@package
+    API::ObjectStorage<API::InternalDebugFeature> _internalDebugFeature;
+}
+@end
+
+#endif
index 084bed3..44a0a02 100644 (file)
@@ -131,7 +131,7 @@ void WebPreferences::updateBoolValueForKey(const String& key, bool value)
     update(); // FIXME: Only send over the changed key and value.
 }
 
-void WebPreferences::updateBoolValueForExperimentalFeatureKey(const String& key, bool value)
+void WebPreferences::updateBoolValueForInternalDebugFeatureKey(const String& key, bool value)
 {
     if (key == WebPreferencesKey::processSwapOnCrossSiteNavigationEnabledKey()) {
         for (auto* page : m_pages)
@@ -143,6 +143,11 @@ void WebPreferences::updateBoolValueForExperimentalFeatureKey(const String& key,
     update(); // FIXME: Only send over the changed key and value.
 }
 
+void WebPreferences::updateBoolValueForExperimentalFeatureKey(const String& key, bool value)
+{
+    update(); // FIXME: Only send over the changed key and value.
+}
+
 void WebPreferences::updateUInt32ValueForKey(const String& key, uint32_t value)
 {
     platformUpdateUInt32ValueForKey(key, value);
index 33e84a2..219bd9d 100644 (file)
@@ -26,6 +26,7 @@
 #pragma once
 
 #include "APIExperimentalFeature.h"
+#include "APIInternalDebugFeature.h"
 #include "APIObject.h"
 #include "FontSmoothingLevel.h"
 #include "WebPreferencesDefinitions.h"
@@ -60,13 +61,18 @@ public:
 
     FOR_EACH_WEBKIT_PREFERENCE(DECLARE_PREFERENCE_GETTER_AND_SETTERS)
     FOR_EACH_WEBKIT_DEBUG_PREFERENCE(DECLARE_PREFERENCE_GETTER_AND_SETTERS)
+    FOR_EACH_WEBKIT_INTERNAL_DEBUG_FEATURE_PREFERENCE(DECLARE_PREFERENCE_GETTER_AND_SETTERS)
     FOR_EACH_WEBKIT_EXPERIMENTAL_FEATURE_PREFERENCE(DECLARE_PREFERENCE_GETTER_AND_SETTERS)
 
     static const Vector<RefPtr<API::Object>>& experimentalFeatures();
-    bool isEnabledForFeature(const API::ExperimentalFeature&) const;
-    void setEnabledForFeature(bool, const API::ExperimentalFeature&);
+    bool isFeatureEnabled(const API::ExperimentalFeature&) const;
+    void setFeatureEnabled(const API::ExperimentalFeature&, bool);
     void enableAllExperimentalFeatures();
 
+    static const Vector<RefPtr<API::Object>>& internalDebugFeatures();
+    bool isFeatureEnabled(const API::InternalDebugFeature&) const;
+    void setFeatureEnabled(const API::InternalDebugFeature&, bool);
+
     // Exposed for WebKitTestRunner use only.
     void forceUpdate() { update(); }
 
@@ -79,6 +85,7 @@ private:
 
     void updateStringValueForKey(const String& key, const String& value);
     void updateBoolValueForKey(const String& key, bool value);
+    void updateBoolValueForInternalDebugFeatureKey(const String& key, bool value);
     void updateBoolValueForExperimentalFeatureKey(const String& key, bool value);
     void updateUInt32ValueForKey(const String& key, uint32_t value);
     void updateDoubleValueForKey(const String& key, double value);
index 14b6746..4bbd736 100644 (file)
@@ -1159,7 +1159,7 @@ Ref<WebPageProxy> WebProcessPool::createWebPage(PageClient& pageClient, Ref<API:
     auto page = process->createWebPage(pageClient, WTFMove(pageConfiguration));
     if (page->preferences().processSwapOnCrossSiteNavigationEnabled()) {
         m_configuration->setProcessSwapsOnNavigation(true);
-        // FIXME: For now, turning on PSON from the experimental features menu also turns on
+        // FIXME: For now, turning on PSON from the debug features menu also turns on
         // automatic process warming until clients can be updated.
         m_configuration->setIsAutomaticProcessWarmingEnabled(true);
     }
index 7a46bf5..f681719 100644 (file)
                31A2EC74148D59CA00810D71 /* WKNotificationPermissionRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 31A2EC72148D59BB00810D71 /* WKNotificationPermissionRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
                31A505FA1680025500A930EB /* WebContextClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31A505F81680025500A930EB /* WebContextClient.h */; };
                31A67E0D165B2A99006CBA66 /* PlugInAutoStartProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 31A67E0B165B2A99006CBA66 /* PlugInAutoStartProvider.h */; };
+               31B3628F2141EA5D007BFA53 /* APIInternalDebugFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = 31B3628E2141EA4D007BFA53 /* APIInternalDebugFeature.h */; };
+               31B362952141EBCD007BFA53 /* _WKInternalDebugFeature.h in Headers */ = {isa = PBXBuildFile; fileRef = 31B362942141EBAD007BFA53 /* _WKInternalDebugFeature.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               31B362972141EBD9007BFA53 /* _WKInternalDebugFeatureInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 31B362932141EBAD007BFA53 /* _WKInternalDebugFeatureInternal.h */; };
+               31B362992141F6E8007BFA53 /* WebPreferencesInternalDebugFeatures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31B362982141F6E0007BFA53 /* WebPreferencesInternalDebugFeatures.cpp */; };
                31BA924D148831260062EDB5 /* WebNotificationManagerMessageReceiver.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 31BA9248148830810062EDB5 /* WebNotificationManagerMessageReceiver.cpp */; };
                31BA924E148831260062EDB5 /* WebNotificationManagerMessages.h in Headers */ = {isa = PBXBuildFile; fileRef = 31BA9249148830810062EDB5 /* WebNotificationManagerMessages.h */; };
                31D5929F166E060000E6BF02 /* WebPlugInClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 31D5929D166E060000E6BF02 /* WebPlugInClient.h */; };
                31A505F81680025500A930EB /* WebContextClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebContextClient.h; sourceTree = "<group>"; };
                31A67E0A165B2A99006CBA66 /* PlugInAutoStartProvider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlugInAutoStartProvider.cpp; sourceTree = "<group>"; };
                31A67E0B165B2A99006CBA66 /* PlugInAutoStartProvider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlugInAutoStartProvider.h; sourceTree = "<group>"; };
+               31B3628E2141EA4D007BFA53 /* APIInternalDebugFeature.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = APIInternalDebugFeature.h; sourceTree = "<group>"; };
+               31B362902141EABC007BFA53 /* APIInternalDebugFeature.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = APIInternalDebugFeature.cpp; sourceTree = "<group>"; };
+               31B362922141EBAC007BFA53 /* _WKInternalDebugFeature.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKInternalDebugFeature.mm; sourceTree = "<group>"; };
+               31B362932141EBAD007BFA53 /* _WKInternalDebugFeatureInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInternalDebugFeatureInternal.h; sourceTree = "<group>"; };
+               31B362942141EBAD007BFA53 /* _WKInternalDebugFeature.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKInternalDebugFeature.h; sourceTree = "<group>"; };
+               31B362982141F6E0007BFA53 /* WebPreferencesInternalDebugFeatures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPreferencesInternalDebugFeatures.cpp; sourceTree = "<group>"; };
                31BA9248148830810062EDB5 /* WebNotificationManagerMessageReceiver.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebNotificationManagerMessageReceiver.cpp; sourceTree = "<group>"; };
                31BA9249148830810062EDB5 /* WebNotificationManagerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebNotificationManagerMessages.h; sourceTree = "<group>"; };
                31D5929C166E05FF00E6BF02 /* WebPlugInClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebPlugInClient.cpp; sourceTree = "<group>"; };
                                5CAFDE422130843500B1F7E1 /* _WKInspector.h */,
                                5CAFDE432130843600B1F7E1 /* _WKInspector.mm */,
                                5CAFDE442130843600B1F7E1 /* _WKInspectorInternal.h */,
+                               31B362942141EBAD007BFA53 /* _WKInternalDebugFeature.h */,
+                               31B362922141EBAC007BFA53 /* _WKInternalDebugFeature.mm */,
+                               31B362932141EBAD007BFA53 /* _WKInternalDebugFeatureInternal.h */,
                                2D790A9C1AD7050D00AB90B3 /* _WKLayoutMode.h */,
                                51C0C9791DDD78540032CAD3 /* _WKLinkIconParameters.h */,
                                51C0C97A1DDD78540032CAD3 /* _WKLinkIconParameters.mm */,
                                7AB6EA441EEAAE2300037B2B /* APIIconDatabaseClient.h */,
                                5143B2611DDD0DA00014FAC6 /* APIIconLoadingClient.h */,
                                7A8A9D571EF119AA009801AE /* APIInjectedBundleClient.h */,
+                               31B362902141EABC007BFA53 /* APIInternalDebugFeature.cpp */,
+                               31B3628E2141EA4D007BFA53 /* APIInternalDebugFeature.h */,
                                7CE4D2061A46775700C7F152 /* APILegacyContextHistoryClient.h */,
                                1A2464F21891E45100234C5B /* APILoaderClient.h */,
                                7CD3A4801A5D02FA009623B8 /* APINavigation.cpp */,
                                1AB1F7951D1B3613007C9BD1 /* WebPaymentCoordinatorProxyMessages.h */,
                                7CDE73A31F9DAB6500390312 /* WebPreferencesDefinitions.h */,
                                7CEB00DC1FA69A890065473B /* WebPreferencesExperimentalFeatures.cpp */,
+                               31B362982141F6E0007BFA53 /* WebPreferencesInternalDebugFeatures.cpp */,
                                7CB100EE1FA2D74A001729EE /* WebPreferencesKeys.cpp */,
                                7CB100EF1FA2D74B001729EE /* WebPreferencesKeys.h */,
                                7CB100F01FA2D784001729EE /* WebPreferencesStoreDefaultsMap.cpp */,
                                37A64E5518F38E3C00EB30F1 /* _WKInputDelegate.h in Headers */,
                                5CAFDE452130846300B1F7E1 /* _WKInspector.h in Headers */,
                                5CAFDE472130846A00B1F7E1 /* _WKInspectorInternal.h in Headers */,
+                               31B362952141EBCD007BFA53 /* _WKInternalDebugFeature.h in Headers */,
+                               31B362972141EBD9007BFA53 /* _WKInternalDebugFeatureInternal.h in Headers */,
                                2D790A9D1AD7050D00AB90B3 /* _WKLayoutMode.h in Headers */,
                                510F59111DDE297000412FF5 /* _WKLinkIconParameters.h in Headers */,
                                A118A9F31908B8EA00F7C92B /* _WKNSFileManagerExtras.h in Headers */,
                                7A3ACE1B1EEEF79B00A864A4 /* APIInjectedBundlePageLoaderClient.h in Headers */,
                                7A8A9D5C1EF14598009801AE /* APIInjectedBundlePageResourceLoadClient.h in Headers */,
                                3769079A18F31CB2001DFF04 /* APIInjectedBundlePageUIClient.h in Headers */,
+                               31B3628F2141EA5D007BFA53 /* APIInternalDebugFeature.h in Headers */,
                                7CE4D2071A46776100C7F152 /* APILegacyContextHistoryClient.h in Headers */,
                                1A2464F31891E45100234C5B /* APILoaderClient.h in Headers */,
                                7CD3A4831A5D02FA009623B8 /* APINavigation.h in Headers */,
                                2D92A78D212B6AB100F493FD /* WebPlatformTouchPoint.cpp in Sources */,
                                2D91344E212CF9F000128AFD /* WebPluginInfoProvider.cpp in Sources */,
                                7CEB00DD1FA69ABE0065473B /* WebPreferencesExperimentalFeatures.cpp in Sources */,
+                               31B362992141F6E8007BFA53 /* WebPreferencesInternalDebugFeatures.cpp in Sources */,
                                7CB100F11FA3858A001729EE /* WebPreferencesKeys.cpp in Sources */,
                                7CB100F41FA38592001729EE /* WebPreferencesStoreDefaultsMap.cpp in Sources */,
                                1A043A0A124D11A900FFBFB5 /* WebProcessConnection.cpp in Sources */,
index 60af4a4..c684a5e 100644 (file)
@@ -1,3 +1,21 @@
+2018-09-07  Dean Jackson  <dino@apple.com>
+
+        Add and expose Internal features from WebKit
+        https://bugs.webkit.org/show_bug.cgi?id=189442
+        <rdar://problem/44243404>
+
+        Reviewed by Simon Fraser.
+
+        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:]):
+
 2018-09-11  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         [macOS] [WK2] Support changing foreground colors via color panel
index 3a369a4..25617ec 100644 (file)
@@ -40,6 +40,7 @@
 
 #if WK_API_ENABLED
 #import <WebKit/_WKExperimentalFeature.h>
+#import <WebKit/_WKInternalDebugFeature.h>
 #endif
 
 enum {
@@ -106,10 +107,16 @@ static WKWebViewConfiguration *defaultConfiguration()
         configuration.processPool = [[[WKProcessPool alloc] _initWithConfiguration:processConfiguration] autorelease];
 
 #if WK_API_ENABLED
-        NSArray<_WKExperimentalFeature *> *features = [WKPreferences _experimentalFeatures];
-        for (_WKExperimentalFeature *feature in features) {
+        NSArray<_WKExperimentalFeature *> *experimentalFeatures = [WKPreferences _experimentalFeatures];
+        for (_WKExperimentalFeature *feature in experimentalFeatures) {
             BOOL enabled = [[NSUserDefaults standardUserDefaults] boolForKey:feature.key];
-            [configuration.preferences _setEnabled:enabled forFeature:feature];
+            [configuration.preferences _setEnabled:enabled forExperimentalFeature:feature];
+        }
+
+        NSArray<_WKInternalDebugFeature *> *internalDebugFeatures = [WKPreferences _internalDebugFeatures];
+        for (_WKInternalDebugFeature *feature in internalDebugFeatures) {
+            BOOL enabled = [[NSUserDefaults standardUserDefaults] boolForKey:feature.key];
+            [configuration.preferences _setEnabled:enabled forInternalDebugFeature:feature];
         }
 #endif
     }
index 704170d..24a37de 100644 (file)
@@ -32,6 +32,7 @@
 
 #if WK_API_ENABLED
 #import <WebKit/_WKExperimentalFeature.h>
+#import <WebKit/_WKInternalDebugFeature.h>
 #endif
 
 static NSString * const defaultURL = @"http://www.webkit.org/";
@@ -81,6 +82,7 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     WheelEventHandlerRegionOverlayTag,
 #if WK_API_ENABLED
     ExperimentalFeatureTag,
+    InternalDebugFeatureTag,
 #endif
 };
 
@@ -212,9 +214,9 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     NSMenu *experimentalFeaturesMenu = [[NSMenu alloc] initWithTitle:@"Experimental Features"];
     [experimentalFeaturesSubmenuItem setSubmenu:experimentalFeaturesMenu];
 
-    NSArray<_WKExperimentalFeature *> *features = [WKPreferences _experimentalFeatures];
+    NSArray<_WKExperimentalFeature *> *experimentalFeatures = [WKPreferences _experimentalFeatures];
 
-    for (_WKExperimentalFeature *feature in features) {
+    for (_WKExperimentalFeature *feature in experimentalFeatures) {
         NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:feature.name action:@selector(toggleExperimentalFeature:) keyEquivalent:@""];
         item.toolTip = feature.details;
         item.representedObject = feature;
@@ -227,6 +229,26 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     [_menu addItem:experimentalFeaturesSubmenuItem];
     [experimentalFeaturesSubmenuItem release];
     [experimentalFeaturesMenu release];
+
+    NSMenuItem *internalDebugFeaturesSubmenuItem = [[NSMenuItem alloc] initWithTitle:@"Internal Features" action:nil keyEquivalent:@""];
+    NSMenu *internalDebugFeaturesMenu = [[NSMenu alloc] initWithTitle:@"Internal Features"];
+    [internalDebugFeaturesSubmenuItem setSubmenu:internalDebugFeaturesMenu];
+
+    NSArray<_WKInternalDebugFeature *> *internalDebugFeatures = [WKPreferences _internalDebugFeatures];
+
+    for (_WKInternalDebugFeature *feature in internalDebugFeatures) {
+        NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:feature.name action:@selector(toggleInternalDebugFeature:) keyEquivalent:@""];
+        item.toolTip = feature.details;
+        item.representedObject = feature;
+
+        [item setTag:InternalDebugFeatureTag];
+        [item setTarget:self];
+        [internalDebugFeaturesMenu addItem:[item autorelease]];
+    }
+
+    [_menu addItem:internalDebugFeaturesSubmenuItem];
+    [internalDebugFeaturesSubmenuItem release];
+    [internalDebugFeaturesMenu release];
 #endif // WK_API_ENABLED
 
     [self _addHeaderWithTitle:@"WebKit1-only Settings"];
@@ -301,7 +323,11 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
 #if WK_API_ENABLED
     if (menuItem.tag == ExperimentalFeatureTag) {
         _WKExperimentalFeature *feature = menuItem.representedObject;
-        [menuItem setState:[defaultPreferences() _isEnabledForFeature:feature] ? NSControlStateValueOn : NSControlStateValueOff];
+        [menuItem setState:[defaultPreferences() _isEnabledForExperimentalFeature:feature] ? NSControlStateValueOn : NSControlStateValueOff];
+    }
+    if (menuItem.tag == InternalDebugFeatureTag) {
+        _WKInternalDebugFeature *feature = menuItem.representedObject;
+        [menuItem setState:[defaultPreferences() _isEnabledForInternalDebugFeature:feature] ? NSControlStateValueOn : NSControlStateValueOff];
     }
 #endif
 
@@ -654,8 +680,19 @@ typedef NS_ENUM(NSInteger, DebugOverylayMenuItemTag) {
     _WKExperimentalFeature *feature = ((NSMenuItem *)sender).representedObject;
     WKPreferences *preferences = defaultPreferences();
 
-    BOOL currentlyEnabled = [preferences _isEnabledForFeature:feature];
-    [preferences _setEnabled:!currentlyEnabled forFeature:feature];
+    BOOL currentlyEnabled = [preferences _isEnabledForExperimentalFeature:feature];
+    [preferences _setEnabled:!currentlyEnabled forExperimentalFeature:feature];
+
+    [[NSUserDefaults standardUserDefaults] setBool:!currentlyEnabled forKey:feature.key];
+}
+
+- (void)toggleInternalDebugFeature:(id)sender
+{
+    _WKInternalDebugFeature *feature = ((NSMenuItem *)sender).representedObject;
+    WKPreferences *preferences = defaultPreferences();
+
+    BOOL currentlyEnabled = [preferences _isEnabledForInternalDebugFeature:feature];
+    [preferences _setEnabled:!currentlyEnabled forInternalDebugFeature:feature];
 
     [[NSUserDefaults standardUserDefaults] setBool:!currentlyEnabled forKey:feature.key];
 }