Source/WebCore:
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Jan 2018 21:06:48 +0000 (21:06 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 17 Jan 2018 21:06:48 +0000 (21:06 +0000)
Put fetch request keepAlive behind a runtime flag
https://bugs.webkit.org/show_bug.cgi?id=181592

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-17
Reviewed by Chris Dumez.

No change of behavior.

* Modules/fetch/FetchRequest.idl:
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::fetchAPIKeepAliveEnabled const):
(WebCore::RuntimeEnabledFeatures::setFetchAPIKeepAliveEnabled):

Source/WebKit:
Put fetch request keepAlive behind a runtime flag
https://bugs.webkit.org/show_bug.cgi?id=181592

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-17
Reviewed by Chris Dumez.

* Shared/WebPreferences.yaml:
* UIProcess/API/C/WKPreferences.cpp:
(WKPreferencesSetFetchAPIKeepAliveEnabled):
(WKPreferencesGetFetchAPIKeepAliveEnabled):
* UIProcess/API/C/WKPreferencesRefPrivate.h:

Source/WebKitLegacy/mac:
Put fetch Request.keepalive behind a runtime flag
https://bugs.webkit.org/show_bug.cgi?id=181592

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-17
Reviewed by Chris Dumez.

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
(-[WebPreferences fetchAPIKeepAliveEnabled]):
(-[WebPreferences setFetchAPIKeepAliveEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Source/WebKitLegacy/win:
Put fetch Request.keepalive behind a runtime flag
https://bugs.webkit.org/show_bug.cgi?id=181592

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-17
Reviewed by Chris Dumez.

* WebPreferences.cpp:
(WebPreferences::fetchAPIKeepAliveEnabled):
(WebPreferences::setFetchAPIKeepAliveEnabled):
* WebPreferences.h:
* WebView.cpp:
(WebView::notifyPreferencesChanged):

Tools:
Put fetch Request.keepalive behind a runtime flag
https://bugs.webkit.org/show_bug.cgi?id=181592

Patch by Youenn Fablet <youenn@apple.com> on 2018-01-17
Reviewed by Chris Dumez.

* DumpRenderTree/mac/DumpRenderTree.mm:
(enableExperimentalFeatures):
* DumpRenderTree/win/DumpRenderTree.cpp:
(enableExperimentalFeatures):
* WebKitTestRunner/TestController.cpp:
(WTR::TestController::resetPreferencesToConsistentValues):

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

23 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/fetch/FetchRequest.idl
Source/WebCore/page/RuntimeEnabledFeatures.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/WebPreferences.yaml
Source/WebKit/UIProcess/API/C/WKPreferences.cpp
Source/WebKit/UIProcess/API/C/WKPreferencesRefPrivate.h
Source/WebKit/WebProcess/Storage/WebSWContextManagerConnection.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/mac/WebView/WebPreferences.mm
Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h
Source/WebKitLegacy/mac/WebView/WebView.mm
Source/WebKitLegacy/win/ChangeLog
Source/WebKitLegacy/win/Interfaces/IWebPreferencesPrivate.idl
Source/WebKitLegacy/win/WebPreferenceKeysPrivate.h
Source/WebKitLegacy/win/WebPreferences.cpp
Source/WebKitLegacy/win/WebPreferences.h
Source/WebKitLegacy/win/WebView.cpp
Tools/ChangeLog
Tools/DumpRenderTree/mac/DumpRenderTree.mm
Tools/DumpRenderTree/win/DumpRenderTree.cpp
Tools/WebKitTestRunner/TestController.cpp

index 875c7d3..909a5b0 100644 (file)
@@ -1,3 +1,17 @@
+2018-01-17  Youenn Fablet  <youenn@apple.com>
+
+        Put fetch request keepAlive behind a runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=181592
+
+        Reviewed by Chris Dumez.
+
+        No change of behavior.
+
+        * Modules/fetch/FetchRequest.idl:
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::fetchAPIKeepAliveEnabled const):
+        (WebCore::RuntimeEnabledFeatures::setFetchAPIKeepAliveEnabled):
+
 2018-01-17  Per Arne Vollan  <pvollan@apple.com>
 
         [Win] Use switch when converting from ResourceRequestCachePolicy to platform cache policy.
index f39fd4c..80a41f8 100644 (file)
@@ -54,7 +54,7 @@ typedef (Blob or BufferSource or DOMFormData or URLSearchParams or ReadableStrea
     readonly attribute FetchRequestCache cache;
     readonly attribute FetchRequestRedirect redirect;
     readonly attribute DOMString integrity;
-    readonly attribute boolean keepalive;
+    [EnabledAtRuntime=FetchAPIKeepAlive] readonly attribute boolean keepalive;
 
     [CallWith=ScriptExecutionContext, MayThrowException, NewObject] FetchRequest clone();
 };
index 6b9fed3..6feefec 100644 (file)
@@ -220,6 +220,9 @@ public:
     void setServiceWorkerEnabled(bool isEnabled) { m_serviceWorkerEnabled = isEnabled; }
 #endif
 
+    bool fetchAPIKeepAliveEnabled() const { return m_fetchAPIKeepAliveEnabled; }
+    void setFetchAPIKeepAliveEnabled(bool isEnabled) { m_fetchAPIKeepAliveEnabled = isEnabled; }
+
     bool spectreGadgetsEnabled() const;
 
 #if ENABLE(VIDEO)
@@ -357,6 +360,7 @@ private:
 #if ENABLE(SERVICE_WORKER)
     bool m_serviceWorkerEnabled { false };
 #endif
+    bool m_fetchAPIKeepAliveEnabled { false };
 
     bool m_inspectorAdditionsEnabled { false };
     bool m_webVREnabled { false };
index 0101c9d..e97b6ab 100644 (file)
@@ -1,3 +1,16 @@
+2018-01-17  Youenn Fablet  <youenn@apple.com>
+
+        Put fetch request keepAlive behind a runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=181592
+
+        Reviewed by Chris Dumez.
+
+        * Shared/WebPreferences.yaml:
+        * UIProcess/API/C/WKPreferences.cpp:
+        (WKPreferencesSetFetchAPIKeepAliveEnabled):
+        (WKPreferencesGetFetchAPIKeepAliveEnabled):
+        * UIProcess/API/C/WKPreferencesRefPrivate.h:
+
 2018-01-17  John Wilander  <wilander@apple.com>
 
         Resource Load Statistics: Block cookies for prevalent resources without user interaction
index a049ce1..e8560ab 100644 (file)
@@ -1123,6 +1123,15 @@ IsSecureContextAttributeEnabled:
   category: experimental
   webcoreBinding: RuntimeEnabledFeatures
 
+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
index b2f4f79..95b22fe 100644 (file)
@@ -1754,6 +1754,16 @@ bool WKPreferencesGetResourceTimingEnabled(WKPreferencesRef preferencesRef)
     return toImpl(preferencesRef)->resourceTimingEnabled();
 }
 
+void WKPreferencesSetFetchAPIKeepAliveEnabled(WKPreferencesRef preferencesRef, bool flag)
+{
+    toImpl(preferencesRef)->setFetchAPIKeepAliveEnabled(flag);
+}
+
+bool WKPreferencesGetFetchAPIKeepAliveEnabled(WKPreferencesRef preferencesRef)
+{
+    return toImpl(preferencesRef)->fetchAPIKeepAliveEnabled();
+}
+
 void WKPreferencesSetSelectionPaintingWithoutSelectionGapsEnabled(WKPreferencesRef preferencesRef, bool flag)
 {
     toImpl(preferencesRef)->setSelectionPaintingWithoutSelectionGapsEnabled(flag);
index 348066d..a4193e0 100644 (file)
@@ -493,6 +493,10 @@ WK_EXPORT bool WKPreferencesGetUserTimingEnabled(WKPreferencesRef);
 WK_EXPORT void WKPreferencesSetResourceTimingEnabled(WKPreferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetResourceTimingEnabled(WKPreferencesRef);
 
+// Defaults to false
+WK_EXPORT void WKPreferencesSetFetchAPIKeepAliveEnabled(WKPreferencesRef, bool flag);
+WK_EXPORT bool WKPreferencesGetFetchAPIKeepAliveEnabled(WKPreferencesRef);
+
 // Defaults to true.
 WK_EXPORT void WKPreferencesSetLargeImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef, bool flag);
 WK_EXPORT bool WKPreferencesGetLargeImageAsyncDecodingEnabled(WKPreferencesRef preferencesRef);
index 8d47942..affc5ac 100644 (file)
@@ -114,6 +114,7 @@ void WebSWContextManagerConnection::updatePreferencesStore(const WebPreferencesS
     RuntimeEnabledFeatures::sharedFeatures().setFetchAPIEnabled(store.getBoolValueForKey(WebPreferencesKey::fetchAPIEnabledKey()));
     RuntimeEnabledFeatures::sharedFeatures().setUserTimingEnabled(store.getBoolValueForKey(WebPreferencesKey::userTimingEnabledKey()));
     RuntimeEnabledFeatures::sharedFeatures().setResourceTimingEnabled(store.getBoolValueForKey(WebPreferencesKey::resourceTimingEnabledKey()));
+    RuntimeEnabledFeatures::sharedFeatures().setFetchAPIKeepAliveEnabled(store.getBoolValueForKey(WebPreferencesKey::fetchAPIKeepAliveEnabledKey()));
 
     m_storageBlockingPolicy = static_cast<SecurityOrigin::StorageBlockingPolicy>(store.getUInt32ValueForKey(WebPreferencesKey::storageBlockingPolicyKey()));
 }
index f18ecd3..2c46b68 100644 (file)
@@ -1,3 +1,19 @@
+2018-01-17  Youenn Fablet  <youenn@apple.com>
+
+        Put fetch Request.keepalive behind a runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=181592
+
+        Reviewed by Chris Dumez.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences fetchAPIKeepAliveEnabled]):
+        (-[WebPreferences setFetchAPIKeepAliveEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
index 74fda8d..6b050b9 100644 (file)
 #define WebKitIsSecureContextAttributeEnabledPreferenceKey @"WebKitIsSecureContextAttributeEnabled"
 #define WebKitViewportFitEnabledPreferenceKey @"WebKitViewportFitEnabled"
 #define WebKitConstantPropertiesEnabledPreferenceKey @"WebKitConstantPropertiesEnabled"
+#define WebKitFetchAPIKeepAliveEnabledPreferenceKey @"WebKitFetchAPIKeepAliveEnabled"
 
 #if !TARGET_OS_IPHONE
 // These are private both because callers should be using the cover methods and because the
index 2b5e09b..764d735 100644 (file)
@@ -682,6 +682,7 @@ public:
         (NSString *)Settings::defaultMediaContentTypesRequiringHardwareSupport(), WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
         @NO, WebKitAccessibilityObjectModelEnabledPreferenceKey,
         @NO, WebKitMediaCapabilitiesEnabledPreferenceKey,
+        @NO, WebKitFetchAPIKeepAliveEnabledPreferenceKey,
         nil];
 
 #if !PLATFORM(IOS)
@@ -3095,6 +3096,16 @@ static NSString *classIBCreatorID = nil;
     [self _setBoolValue:flag forKey:WebKitWebAnimationsEnabledPreferenceKey];
 }
 
+- (BOOL)fetchAPIKeepAliveEnabled
+{
+    return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];
+}
+
+- (void)setFetchAPIKeepAliveEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitFetchAPIEnabledPreferenceKey];
+}
+
 - (BOOL)modernMediaControlsEnabled
 {
     return [self _boolValueForKey:WebKitModernMediaControlsEnabledPreferenceKey];
index b7909a1..eee06b5 100644 (file)
@@ -564,6 +564,9 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification;
 - (void)setWebAnimationsEnabled:(BOOL)flag;
 - (BOOL)webAnimationsEnabled;
 
+- (void)setFetchAPIKeepAliveEnabled:(BOOL)flag;
+- (BOOL)fetchAPIKeepAliveEnabled;
+
 - (void)setModernMediaControlsEnabled:(BOOL)flag;
 - (BOOL)modernMediaControlsEnabled;
 
index c3e231d..f9ce9a4 100644 (file)
@@ -3047,7 +3047,8 @@ static bool needsSelfRetainWhileLoadingQuirk()
     RuntimeEnabledFeatures::sharedFeatures().setMenuItemElementEnabled([preferences menuItemElementEnabled]);
     RuntimeEnabledFeatures::sharedFeatures().setAccessibilityObjectModelEnabled([preferences accessibilityObjectModelEnabled]);
     RuntimeEnabledFeatures::sharedFeatures().setMediaCapabilitiesEnabled([preferences mediaCapabilitiesEnabled]);
-    
+    RuntimeEnabledFeatures::sharedFeatures().setFetchAPIKeepAliveEnabled([preferences fetchAPIKeepAliveEnabled]);
+
 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
     RuntimeEnabledFeatures::sharedFeatures().setLegacyEncryptedMediaAPIEnabled(preferences.legacyEncryptedMediaAPIEnabled);
 #endif
index ea59cab..2b64889 100644 (file)
@@ -1,3 +1,17 @@
+2018-01-17  Youenn Fablet  <youenn@apple.com>
+
+        Put fetch Request.keepalive behind a runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=181592
+
+        Reviewed by Chris Dumez.
+
+        * WebPreferences.cpp:
+        (WebPreferences::fetchAPIKeepAliveEnabled):
+        (WebPreferences::setFetchAPIKeepAliveEnabled):
+        * WebPreferences.h:
+        * WebView.cpp:
+        (WebView::notifyPreferencesChanged):
+
 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
index 1e9289b..12ecec0 100644 (file)
@@ -219,4 +219,6 @@ interface IWebPreferencesPrivate6 : IWebPreferencesPrivate5
     HRESULT setInspectorAdditionsEnabled([in] BOOL enabled);
     HRESULT visualViewportAPIEnabled([out, retval] BOOL*);
     HRESULT setVisualViewportAPIEnabled([in] BOOL enabled);
+    HRESULT fetchAPIKeepAliveEnabled([out, retval] BOOL* enabled);
+    HRESULT setFetchAPIKeepAliveEnabled([in] BOOL enabled);
 }
index 665f22c..3d94796 100644 (file)
 
 #define WebKitFetchAPIEnabledPreferenceKey "WebKitFetchAPIEnabled"
 
+#define WebKitFetchAPIKeepAliveEnabledPreferenceKey "WebKitFetchAPIKeepAlivEnabled"
+
 #define WebKitShadowDOMEnabledPreferenceKey "WebKitShadowDOMEnabled"
 
 #define WebKitCustomElementsEnabledPreferenceKey "WebKitCustomElementsEnabled"
index bef34b3..be3eb31 100644 (file)
@@ -2013,6 +2013,20 @@ HRESULT WebPreferences::modernMediaControlsEnabled(_Out_ BOOL* enabled)
     return S_OK;
 }
 
+HRESULT WebPreferences::fetchAPIKeepAliveEnabled(_Out_ BOOL* enabled)
+{
+    if (!enabled)
+        return E_POINTER;
+    *enabled = boolValueForKey(WebKitFetchAPIKeepAliveEnabledPreferenceKey);
+    return S_OK;
+}
+
+HRESULT WebPreferences::setFetchAPIKeepAliveEnabled(BOOL enabled)
+{
+    setBoolValue(WebKitFetchAPIKeepAliveEnabledPreferenceKey, enabled);
+    return S_OK;
+}
+
 HRESULT WebPreferences::setLinkPreloadEnabled(BOOL enabled)
 {
     setBoolValue(WebKitLinkPreloadEnabledPreferenceKey, enabled);
index a75dae8..59a5025 100644 (file)
@@ -267,6 +267,8 @@ public:
     virtual HRESULT STDMETHODCALLTYPE setInspectorAdditionsEnabled(BOOL);
     virtual HRESULT STDMETHODCALLTYPE visualViewportAPIEnabled(_Out_ BOOL*);
     virtual HRESULT STDMETHODCALLTYPE setVisualViewportAPIEnabled(BOOL);
+    virtual HRESULT STDMETHODCALLTYPE fetchAPIKeepAliveEnabled(_Out_ BOOL*);
+    virtual HRESULT STDMETHODCALLTYPE setFetchAPIKeepAliveEnabled(BOOL);
 
     // WebPreferences
 
index 5910f33..c190f93 100644 (file)
@@ -5233,6 +5233,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
         return hr;
     RuntimeEnabledFeatures::sharedFeatures().setLinkPreloadEnabled(!!enabled);
 
+    hr = prefsPrivate->fetchAPIKeepAliveEnabled(&enabled);
+    if (FAILED(hr))
+        return hr;
+    RuntimeEnabledFeatures::sharedFeatures().setFetchAPIKeepAliveEnabled(!!enabled);
+
     hr = prefsPrivate->mediaPreloadingEnabled(&enabled);
     if (FAILED(hr))
         return hr;
index 2f9fd15..2fe8abc 100644 (file)
@@ -1,3 +1,17 @@
+2018-01-17  Youenn Fablet  <youenn@apple.com>
+
+        Put fetch Request.keepalive behind a runtime flag
+        https://bugs.webkit.org/show_bug.cgi?id=181592
+
+        Reviewed by Chris Dumez.
+
+        * DumpRenderTree/mac/DumpRenderTree.mm:
+        (enableExperimentalFeatures):
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (enableExperimentalFeatures):
+        * WebKitTestRunner/TestController.cpp:
+        (WTR::TestController::resetPreferencesToConsistentValues):
+
 2018-01-17  Wenson Hsieh  <wenson_hsieh@apple.com>
 
         Add injected bundle SPI to replace subresource URLs when dropping or pasting rich content
index 477cc1f..15855be 100644 (file)
@@ -846,6 +846,7 @@ static void enableExperimentalFeatures(WebPreferences* preferences)
     [preferences setLinkPreloadEnabled:YES];
     [preferences setMediaPreloadingEnabled:YES];
     // FIXME: InputEvents
+    [preferences setFetchAPIKeepAliveEnabled:YES];
     [preferences setWebAnimationsEnabled:YES];
     [preferences setWebGL2Enabled:YES];
     [preferences setWebGPUEnabled:YES];
index 8c84065..8cc9cb7 100644 (file)
@@ -774,6 +774,7 @@ static void enableExperimentalFeatures(IWebPreferences* preferences)
 {
     COMPtr<IWebPreferencesPrivate6> prefsPrivate { Query, preferences };
 
+    prefsPrivate->setFetchAPIKeepAliveEnabled(TRUE);
     // FIXME: CSSGridLayout
     // FIXME: SpringTimingFunction
     // FIXME: Gamepads
index c99e6e5..f3085ef 100644 (file)
@@ -725,6 +725,7 @@ void TestController::resetPreferencesToConsistentValues(const TestOptions& optio
     // FIXME: We should be testing the default.
     WKPreferencesSetStorageBlockingPolicy(preferences, kWKAllowAllStorage);
 
+    WKPreferencesSetFetchAPIKeepAliveEnabled(preferences, true);
     WKPreferencesSetResourceTimingEnabled(preferences, true);
     WKPreferencesSetUserTimingEnabled(preferences, true);
     WKPreferencesSetMediaPreloadingEnabled(preferences, true);