Title: [265235] trunk/Source
Revision
265235
Author
you...@apple.com
Date
2020-08-03 18:05:08 -0700 (Mon, 03 Aug 2020)

Log Message

Move user gesture propagation over promise behind a feature flag
https://bugs.webkit.org/show_bug.cgi?id=215014

Reviewed by Eric Carlson.

Source/WebCore:

If runtime flag is false, disable user gesture propagation to the next micro task.

* bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::queueMicrotaskToEventLoop):
* page/RuntimeEnabledFeatures.h:
(WebCore::RuntimeEnabledFeatures::userGesturePromisePropagationEnabled const):
(WebCore::RuntimeEnabledFeatures::setUserGesturePromisePropagationEnabled):

Source/WebKit:

Add a preference, on by default.

* Shared/WebPreferences.yaml:

Source/WebKitLegacy/mac:

* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(-[WebPreferences userGesturePromisePropagationEnabled]):
(-[WebPreferences setUserGesturePromisePropagationEnabled:]):
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (265234 => 265235)


--- trunk/Source/WebCore/ChangeLog	2020-08-04 00:36:52 UTC (rev 265234)
+++ trunk/Source/WebCore/ChangeLog	2020-08-04 01:05:08 UTC (rev 265235)
@@ -1,3 +1,18 @@
+2020-08-03  Youenn Fablet  <you...@apple.com>
+
+        Move user gesture propagation over promise behind a feature flag
+        https://bugs.webkit.org/show_bug.cgi?id=215014
+
+        Reviewed by Eric Carlson.
+
+        If runtime flag is false, disable user gesture propagation to the next micro task.
+
+        * bindings/js/JSDOMWindowBase.cpp:
+        (WebCore::JSDOMWindowBase::queueMicrotaskToEventLoop):
+        * page/RuntimeEnabledFeatures.h:
+        (WebCore::RuntimeEnabledFeatures::userGesturePromisePropagationEnabled const):
+        (WebCore::RuntimeEnabledFeatures::setUserGesturePromisePropagationEnabled):
+
 2020-08-03  Chris Dumez  <cdu...@apple.com>
 
         Add constructor for AudioBufferSourceNode

Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (265234 => 265235)


--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2020-08-04 00:36:52 UTC (rev 265234)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp	2020-08-04 01:05:08 UTC (rev 265235)
@@ -42,6 +42,7 @@
 #include "Page.h"
 #include "RejectedPromiseTracker.h"
 #include "RuntimeApplicationChecks.h"
+#include "RuntimeEnabledFeatures.h"
 #include "ScriptController.h"
 #include "ScriptModuleLoader.h"
 #include "SecurityOrigin.h"
@@ -217,7 +218,7 @@
     auto& eventLoop = thisObject.scriptExecutionContext()->eventLoop();
     // Propagating media only user gesture for Fetch API's promise chain.
     auto userGestureToken = UserGestureIndicator::currentUserGesture();
-    if (userGestureToken && !userGestureToken->isPropagatedFromFetch())
+    if (userGestureToken && (!userGestureToken->isPropagatedFromFetch() || !RuntimeEnabledFeatures::sharedFeatures().userGesturePromisePropagationEnabled()))
         userGestureToken = nullptr;
     eventLoop.queueMicrotask([callback = WTFMove(callback), userGestureToken = WTFMove(userGestureToken)]() mutable {
         if (!userGestureToken) {

Modified: trunk/Source/WebCore/page/RuntimeEnabledFeatures.h (265234 => 265235)


--- trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2020-08-04 00:36:52 UTC (rev 265234)
+++ trunk/Source/WebCore/page/RuntimeEnabledFeatures.h	2020-08-04 01:05:08 UTC (rev 265235)
@@ -225,6 +225,9 @@
     bool indexedDBWorkersEnabled() const { return m_isIndexedDBWorkersEnabled; }
 #endif
 
+    bool userGesturePromisePropagationEnabled() const { return m_userGesturePromisePropagationEnabled; }
+    void setUserGesturePromisePropagationEnabled(bool isEnabled) { m_userGesturePromisePropagationEnabled = isEnabled; }
+
 #if ENABLE(MEDIA_STREAM)
     bool mediaRecorderEnabled() const { return m_isMediaRecorderEnabled; }
     void setMediaRecorderEnabled(bool isEnabled) { m_isMediaRecorderEnabled = isEnabled; }
@@ -475,6 +478,7 @@
     bool m_isIndexedDBWorkersEnabled { true };
 #endif
 
+    bool m_userGesturePromisePropagationEnabled { true };
 #if ENABLE(MEDIA_STREAM)
     bool m_isMediaRecorderEnabled { false };
     bool m_isMediaDevicesEnabled { false };

Modified: trunk/Source/WebKit/ChangeLog (265234 => 265235)


--- trunk/Source/WebKit/ChangeLog	2020-08-04 00:36:52 UTC (rev 265234)
+++ trunk/Source/WebKit/ChangeLog	2020-08-04 01:05:08 UTC (rev 265235)
@@ -1,3 +1,14 @@
+2020-08-03  Youenn Fablet  <you...@apple.com>
+
+        Move user gesture propagation over promise behind a feature flag
+        https://bugs.webkit.org/show_bug.cgi?id=215014
+
+        Reviewed by Eric Carlson.
+
+        Add a preference, on by default.
+
+        * Shared/WebPreferences.yaml:
+
 2020-08-03  Alex Christensen  <achristen...@webkit.org>
 
         Null check parentProcessConnection when creating a NetworkDataTaskCocoa

Modified: trunk/Source/WebKit/Shared/WebPreferences.yaml (265234 => 265235)


--- trunk/Source/WebKit/Shared/WebPreferences.yaml	2020-08-04 00:36:52 UTC (rev 265234)
+++ trunk/Source/WebKit/Shared/WebPreferences.yaml	2020-08-04 01:05:08 UTC (rev 265235)
@@ -282,6 +282,14 @@
   type: bool
   defaultValue: false
 
+UserGesturePromisePropagationEnabled:
+    type: bool
+    defaultValue: true
+    webcoreBinding: RuntimeEnabledFeatures
+    humanReadableName: "UserGesture Promise Propagation"
+    humanReadableDescription: "UserGesture Promise Propagation"
+    category: experimental
+
 AllowsInlineMediaPlayback:
   type: bool
   defaultValue: DEFAULT_ALLOWS_INLINE_MEDIA_PLAYBACK

Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (265234 => 265235)


--- trunk/Source/WebKitLegacy/mac/ChangeLog	2020-08-04 00:36:52 UTC (rev 265234)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog	2020-08-04 01:05:08 UTC (rev 265235)
@@ -1,3 +1,18 @@
+2020-08-03  Youenn Fablet  <you...@apple.com>
+
+        Move user gesture propagation over promise behind a feature flag
+        https://bugs.webkit.org/show_bug.cgi?id=215014
+
+        Reviewed by Eric Carlson.
+
+        * WebView/WebPreferenceKeysPrivate.h:
+        * WebView/WebPreferences.mm:
+        (-[WebPreferences userGesturePromisePropagationEnabled]):
+        (-[WebPreferences setUserGesturePromisePropagationEnabled:]):
+        * WebView/WebPreferencesPrivate.h:
+        * WebView/WebView.mm:
+        (-[WebView _preferencesChanged:]):
+
 2020-08-03  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Remove the ENABLE_DATA_INTERACTION feature flag

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h (265234 => 265235)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h	2020-08-04 00:36:52 UTC (rev 265234)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferenceKeysPrivate.h	2020-08-04 01:05:08 UTC (rev 265235)
@@ -212,6 +212,7 @@
 #define WebKitCSSShadowPartsEnabledPreferenceKey @"WebKitCSSShadowPartsEnabled"
 #define WebKitLayoutFormattingContextIntegrationEnabledPreferenceKey @"WebKitLayoutFormattingContextIntegrationEnabled"
 #define WebKitWebSQLEnabledPreferenceKey @"WebKitWebSQLEnabled"
+#define WebKitUserGesturePromisePropagationEnabledPreferenceKey @"WebKitUserGesturePromisePropagationEnabled"
 
 #if !TARGET_OS_IPHONE
 // These are private both because callers should be using the cover methods and because the

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm (265234 => 265235)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm	2020-08-04 00:36:52 UTC (rev 265234)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferences.mm	2020-08-04 01:05:08 UTC (rev 265235)
@@ -718,6 +718,7 @@
         @NO, WebKitDebugInAppBrowserPrivacyEnabledPreferenceKey,
         @NO, WebKitAspectRatioOfImgFromWidthAndHeightEnabledPreferenceKey,
         @(webSQLEnabled), WebKitWebSQLEnabledPreferenceKey,
+        @YES, WebKitUserGesturePromisePropagationEnabledPreferenceKey,
         nil];
 
 #if !PLATFORM(IOS_FAMILY)
@@ -3703,6 +3704,16 @@
     [self _setBoolValue:webSQLEnabled forKey:WebKitWebSQLEnabledPreferenceKey];
 }
 
+- (BOOL)userGesturePromisePropagationEnabled
+{
+    return [self _boolValueForKey:WebKitUserGesturePromisePropagationEnabledPreferenceKey];
+}
+
+- (void)setUserGesturePromisePropagationEnabled:(BOOL)flag
+{
+    [self _setBoolValue:flag forKey:WebKitUserGesturePromisePropagationEnabledPreferenceKey];
+}
+
 @end
 
 @implementation WebPreferences (WebInternal)

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h (265234 => 265235)


--- trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h	2020-08-04 00:36:52 UTC (rev 265234)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebPreferencesPrivate.h	2020-08-04 01:05:08 UTC (rev 265235)
@@ -652,6 +652,9 @@
 - (void)setWebSQLEnabled:(BOOL)flag;
 - (BOOL)webSQLEnabled;
 
+- (void)setUserGesturePromisePropagationEnabled:(BOOL)flag;
+- (BOOL)userGesturePromisePropagationEnabled;
+
 @property (nonatomic) BOOL visualViewportAPIEnabled;
 @property (nonatomic) BOOL CSSOMViewScrollingAPIEnabled;
 @property (nonatomic) BOOL CSSOMViewSmoothScrollingEnabled;

Modified: trunk/Source/WebKitLegacy/mac/WebView/WebView.mm (265234 => 265235)


--- trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-08-04 00:36:52 UTC (rev 265234)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebView.mm	2020-08-04 01:05:08 UTC (rev 265235)
@@ -3397,6 +3397,8 @@
     RuntimeEnabledFeatures::sharedFeatures().setEncryptedMediaAPIEnabled(preferences.encryptedMediaAPIEnabled);
 #endif
 
+    RuntimeEnabledFeatures::sharedFeatures().setUserGesturePromisePropagationEnabled(preferences.userGesturePromisePropagationEnabled);
+
 #if ENABLE(PICTURE_IN_PICTURE_API)
     settings.setPictureInPictureAPIEnabled(preferences.pictureInPictureAPIEnabled);
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to