Title: [289738] trunk
Revision
289738
Author
[email protected]
Date
2022-02-14 09:07:17 -0800 (Mon, 14 Feb 2022)

Log Message

Don't perform layout in WKBundlePagePostSynchronousMessageForTesting
https://bugs.webkit.org/show_bug.cgi?id=236579

Reviewed by Brady Eidson.

This turned out to be a problem for bug 22722, which introduced the WithLayout::No workaround.

r188793 introduced this layoutIfNeeded call specifically for UI event messages, so only perform the
layout in that specific case. Also remove the workaround introduced in bug 22722.

Source/WebKit:

* WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
(WKBundlePagePostSynchronousMessageForTesting):
(WKBundlePageLayoutIfNeeded):
(WKBundlePagePostSynchronousMessageForTestingWithoutLayout): Deleted.
* WebProcess/InjectedBundle/API/c/WKBundlePage.h:

Tools:

* WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
* WebKitTestRunner/InjectedBundle/InjectedBundle.h:
(WTR::postSynchronousPageMessage):
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::postSynchronousPageMessageWithReturnValue):
(WTR::TestRunner::grantWebNotificationPermission):
(WTR::TestRunner::denyWebNotificationPermission):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (289737 => 289738)


--- trunk/Source/WebKit/ChangeLog	2022-02-14 15:28:07 UTC (rev 289737)
+++ trunk/Source/WebKit/ChangeLog	2022-02-14 17:07:17 UTC (rev 289738)
@@ -1,3 +1,21 @@
+2022-02-14  Tim Nguyen  <[email protected]>
+
+        Don't perform layout in WKBundlePagePostSynchronousMessageForTesting
+        https://bugs.webkit.org/show_bug.cgi?id=236579
+
+        Reviewed by Brady Eidson.
+
+        This turned out to be a problem for bug 22722, which introduced the WithLayout::No workaround.
+
+        r188793 introduced this layoutIfNeeded call specifically for UI event messages, so only perform the
+        layout in that specific case. Also remove the workaround introduced in bug 22722.
+
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.cpp:
+        (WKBundlePagePostSynchronousMessageForTesting):
+        (WKBundlePageLayoutIfNeeded):
+        (WKBundlePagePostSynchronousMessageForTestingWithoutLayout): Deleted.
+        * WebProcess/InjectedBundle/API/c/WKBundlePage.h:
+
 2022-02-13  Lauro Moura  <[email protected]>
 
         Unreviewed, non-unified build fixes

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp (289737 => 289738)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2022-02-14 15:28:07 UTC (rev 289737)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.cpp	2022-02-14 17:07:17 UTC (rev 289738)
@@ -776,13 +776,6 @@
 
 void WKBundlePagePostSynchronousMessageForTesting(WKBundlePageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef, WKTypeRef* returnRetainedDataRef)
 {
-    WebKit::toImpl(pageRef)->layoutIfNeeded();
-
-    WKBundlePagePostSynchronousMessageForTestingWithoutLayout(pageRef, messageNameRef, messageBodyRef, returnRetainedDataRef);
-}
-
-void WKBundlePagePostSynchronousMessageForTestingWithoutLayout(WKBundlePageRef pageRef, WKStringRef messageNameRef, WKTypeRef messageBodyRef, WKTypeRef* returnRetainedDataRef)
-{
     RefPtr<API::Object> returnData;
     WebKit::toImpl(pageRef)->postSynchronousMessageForTesting(WebKit::toWTFString(messageNameRef), WebKit::toImpl(messageBodyRef), returnData);
     if (returnRetainedDataRef)
@@ -878,3 +871,8 @@
 
     WebKit::toImpl(page)->corePage()->setEventThrottlingBehaviorOverride(behaviorValue);
 }
+
+void WKBundlePageLayoutIfNeeded(WKBundlePageRef page)
+{
+    WebKit::toImpl(page)->layoutIfNeeded();
+}

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.h (289737 => 289738)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2022-02-14 15:28:07 UTC (rev 289737)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/c/WKBundlePage.h	2022-02-14 17:07:17 UTC (rev 289738)
@@ -125,11 +125,12 @@
 // Call the given callback after both a postTask() on the page's document's ScriptExecutionContext, and a zero-delay timer.
 WK_EXPORT void WKBundlePageCallAfterTasksAndTimers(WKBundlePageRef, WKBundlePageTestNotificationCallback, void* context);
 
+WK_EXPORT void WKBundlePageLayoutIfNeeded(WKBundlePageRef page);
+
 WK_EXPORT void WKBundlePagePostMessage(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody);
 
 // Switches a connection into a fully synchronous mode, so all messages become synchronous until we get a response.
 WK_EXPORT void WKBundlePagePostSynchronousMessageForTesting(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnRetainedData);
-WK_EXPORT void WKBundlePagePostSynchronousMessageForTestingWithoutLayout(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody, WKTypeRef* returnRetainedData);
 // Same as WKBundlePagePostMessage() but the message cannot become synchronous, even if the connection is in fully synchronous mode.
 WK_EXPORT void WKBundlePagePostMessageIgnoringFullySynchronousMode(WKBundlePageRef page, WKStringRef messageName, WKTypeRef messageBody);
 

Modified: trunk/Tools/ChangeLog (289737 => 289738)


--- trunk/Tools/ChangeLog	2022-02-14 15:28:07 UTC (rev 289737)
+++ trunk/Tools/ChangeLog	2022-02-14 17:07:17 UTC (rev 289738)
@@ -1,3 +1,23 @@
+2022-02-14  Tim Nguyen  <[email protected]>
+
+        Don't perform layout in WKBundlePagePostSynchronousMessageForTesting
+        https://bugs.webkit.org/show_bug.cgi?id=236579
+
+        Reviewed by Brady Eidson.
+
+        This turned out to be a problem for bug 22722, which introduced the WithLayout::No workaround.
+
+        r188793 introduced this layoutIfNeeded call specifically for UI event messages, so only perform the
+        layout in that specific case. Also remove the workaround introduced in bug 22722.
+
+        * WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h:
+        * WebKitTestRunner/InjectedBundle/InjectedBundle.h:
+        (WTR::postSynchronousPageMessage):
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::postSynchronousPageMessageWithReturnValue):
+        (WTR::TestRunner::grantWebNotificationPermission):
+        (WTR::TestRunner::denyWebNotificationPermission):
+
 2022-02-11  Jonathan Bedard  <[email protected]>
 
         [EWS] Re-enable build retry for PRs

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h (289737 => 289738)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2022-02-14 15:28:07 UTC (rev 289737)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/AccessibilityUIElement.h	2022-02-14 17:07:17 UTC (rev 289738)
@@ -34,6 +34,7 @@
 #include <_javascript_Core/JSObjectRef.h>
 #include <_javascript_Core/JSRetainPtr.h>
 #include <WebKit/WKBundleFrame.h>
+#include <WebKit/WKBundlePage.h>
 #include <wtf/Platform.h>
 #include <wtf/Vector.h>
 

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h (289737 => 289738)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h	2022-02-14 15:28:07 UTC (rev 289737)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/InjectedBundle.h	2022-02-14 17:07:17 UTC (rev 289738)
@@ -30,6 +30,7 @@
 #include "TestRunner.h"
 #include "TextInputController.h"
 #include <WebKit/WKBase.h>
+#include <WebKit/WKBundlePage.h>
 #include <WebKit/WKRetainPtr.h>
 #include <sstream>
 #include <wtf/Forward.h>
@@ -257,8 +258,12 @@
 
 template<typename T> void postSynchronousPageMessage(const char* name, const WKRetainPtr<T>& value)
 {
-    if (auto page = InjectedBundle::singleton().pageRef())
+    if (auto page = InjectedBundle::singleton().pageRef()) {
+        // EventSender needs a layout
+        if (!strcmp(name, "EventSender"))
+            WKBundlePageLayoutIfNeeded(page);
         WKBundlePagePostSynchronousMessageForTesting(page, toWK(name).get(), value.get(), nullptr);
+    }
 }
 
 } // namespace WTR

Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (289737 => 289738)


--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2022-02-14 15:28:07 UTC (rev 289737)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp	2022-02-14 17:07:17 UTC (rev 289738)
@@ -147,22 +147,10 @@
     return postSynchronousMessageReturningBoolean(name, WKRetainPtr<WKTypeRef> { });
 }
 
-enum class WithLayout : bool {
-    No,
-    Yes
-};
-
-template<typename T> static WKRetainPtr<WKTypeRef> postSynchronousPageMessageWithReturnValue(const char* name, const WKRetainPtr<T>& value, WithLayout withLayout = WithLayout::Yes)
+template<typename T> static WKRetainPtr<WKTypeRef> postSynchronousPageMessageWithReturnValue(const char* name, const WKRetainPtr<T>& value)
 {
     WKTypeRef rawReturnValue = nullptr;
-    switch (withLayout) {
-    case WithLayout::No:
-        WKBundlePagePostSynchronousMessageForTestingWithoutLayout(page(), toWK(name).get(), value.get(), &rawReturnValue);
-        break;
-    case WithLayout::Yes:
-        WKBundlePagePostSynchronousMessageForTesting(page(), toWK(name).get(), value.get(), &rawReturnValue);
-        break;
-    }
+    WKBundlePagePostSynchronousMessageForTesting(page(), toWK(name).get(), value.get(), &rawReturnValue);
     return adoptWK(rawReturnValue);
 }
 
@@ -879,13 +867,13 @@
 void TestRunner::grantWebNotificationPermission(JSStringRef origin)
 {
     WKBundleSetWebNotificationPermission(InjectedBundle::singleton().bundle(), page(), toWK(origin).get(), true);
-    postSynchronousPageMessageWithReturnValue("GrantNotificationPermission", toWK(origin), WithLayout::No);
+    postSynchronousPageMessageWithReturnValue("GrantNotificationPermission", toWK(origin));
 }
 
 void TestRunner::denyWebNotificationPermission(JSStringRef origin)
 {
     WKBundleSetWebNotificationPermission(InjectedBundle::singleton().bundle(), page(), toWK(origin).get(), false);
-    postSynchronousPageMessageWithReturnValue("DenyNotificationPermission", toWK(origin), WithLayout::No);
+    postSynchronousPageMessageWithReturnValue("DenyNotificationPermission", toWK(origin));
 }
 
 void TestRunner::removeAllWebNotificationPermissions()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to