Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 08baee0f736008bb945716a2430aa9a513040f36
      
https://github.com/WebKit/WebKit/commit/08baee0f736008bb945716a2430aa9a513040f36
  Author: Kimmo Kinnunen <[email protected]>
  Date:   2024-04-09 (Tue, 09 Apr 2024)

  Changed paths:
    A LayoutTests/ipc/async-with-reply-expected.txt
    A LayoutTests/ipc/async-with-reply.html
    A LayoutTests/ipc/stream-async-with-reply-expected.txt
    A LayoutTests/ipc/stream-async-with-reply.html
    M LayoutTests/resources/ipc.js
    M Source/WebKit/Shared/IPCStreamTester.cpp
    M Source/WebKit/Shared/IPCStreamTester.h
    M Source/WebKit/Shared/IPCStreamTester.messages.in
    M Source/WebKit/Shared/IPCTester.cpp
    M Source/WebKit/Shared/IPCTester.h
    M Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp

  Log Message:
  -----------
  IPC Testing API: asynchronous stream messages with replies not working
https://bugs.webkit.org/show_bug.cgi?id=272148
rdar://125084127

Reviewed by Ryosuke Niwa.

Implement support for asynchronous replies in JS testing API:
 - JSIPCConnection::sendWithAsyncReply
 - JSIPCConnection::waitForAsyncReplyAndDispatchImmediately
 - JSIPCStreamClientConnection::sendWithAsyncReply
 - JSIPCStreamClientConnection::waitForAsyncReplyAndDispatchImmediately

Previously in JS, the JSIPC object would support sending the async message
and receiving it as a promise. Stream connections would not support it.

Replace it with more consistent connection-specific sendWithAsyncReply
calls that take a callback parameter, similar to C++. Implement the
promise variant in JS side.

This way the async reply id is available for the tests, if they need it.

Organize the code so that the JSIPCConnection and
JSIPCStreamClientConnection share the common implementation in jsSend,
jsSendSync, jsSendWithAsyncReply, jsWaitForMessage,
jsWaitForAsyncReplyAndDispatchImmediately. Organize
JSIPCStreamClientConnection::prepareToSendOutOfStreamMessage to just
prepare the stream connection so that the above common functionality can
then be shared.

* LayoutTests/resources/ipc.js:
(connectionSendWithPromisedReply):
(IPC.sendWithPromisedReply):
(asyncFlush):
* Source/WebKit/Shared/IPCStreamTester.cpp:
(WebKit::IPCStreamTester::asyncPing):
(WebKit::IPCStreamTester::asyncMessage): Deleted.
* Source/WebKit/Shared/IPCStreamTester.h:
* Source/WebKit/Shared/IPCStreamTester.messages.in:
* Source/WebKit/Shared/IPCTester.cpp:
(WebKit::IPCTester::asyncPing):
* Source/WebKit/Shared/IPCTester.h:
* Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::JSIPCConnection::create):
(WebKit::IPCTestingAPI::JSIPCConnection::connection const):
(WebKit::IPCTestingAPI::JSIPCConnection::JSIPCConnection):
(WebKit::IPCTestingAPI::createErrorFromIPCError):
(WebKit::IPCTestingAPI::extractSyncIPCMessageInfo):
(WebKit::IPCTestingAPI::jsSend):
(WebKit::IPCTestingAPI::jsSendWithAsyncReply):
(WebKit::IPCTestingAPI::jsSendSync):
(WebKit::IPCTestingAPI::jsWaitForMessage):
(WebKit::IPCTestingAPI::jsWaitForAsyncReplyAndDispatchImmediately):
(WebKit::IPCTestingAPI::JSIPCConnection::staticFunctions):
(WebKit::IPCTestingAPI::JSIPCConnection::sendMessage):
(WebKit::IPCTestingAPI::JSIPCConnection::sendWithAsyncReply):
(WebKit::IPCTestingAPI::JSIPCConnection::sendSyncMessage):
(WebKit::IPCTestingAPI::JSIPCConnection::waitForMessage):
(WebKit::IPCTestingAPI::JSIPCConnection::waitForAsyncReplyAndDispatchImmediately):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::staticFunctions):
(WebKit::IPCTestingAPI::extractIPCStreamMessageInfo):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::prepareToSendOutOfStreamMessage):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::sendMessage):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::sendWithAsyncReply):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::sendSyncMessage):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::waitForMessage):
(WebKit::IPCTestingAPI::JSIPCStreamClientConnection::waitForAsyncReplyAndDispatchImmediately):
(WebKit::IPCTestingAPI::JSIPC::staticFunctions):
(WebKit::IPCTestingAPI::JSIPC::processTargetFromArgument):
(WebKit::IPCTestingAPI::JSIPC::addMessageListener):
(WebKit::IPCTestingAPI::messageNameFromArgument):
(WebKit::IPCTestingAPI::encodeArgument):
(WebKit::IPCTestingAPI::JSIPC::getConnectionForProcessTarget):
(WebKit::IPCTestingAPI::JSIPC::sendMessage):
(WebKit::IPCTestingAPI::JSIPC::waitForMessage):
(WebKit::IPCTestingAPI::JSIPC::sendSyncMessage):
(WebKit::IPCTestingAPI::sendMessageWithJSArguments): Deleted.
(WebKit::IPCTestingAPI::sendSyncMessageWithJSArguments): Deleted.
(WebKit::IPCTestingAPI::waitForMessageWithJSArguments): Deleted.
(WebKit::IPCTestingAPI::processTargetFromArgument): Deleted.
(WebKit::IPCTestingAPI::messageIDFromArgument): Deleted.
* LayoutTests/ipc/async-with-reply-expected.txt: Added.
* LayoutTests/ipc/async-with-reply.html: Added.
* LayoutTests/ipc/stream-async-with-reply-expected.txt: Added.
* LayoutTests/ipc/stream-async-with-reply.html: Added.

Canonical link: https://commits.webkit.org/277239@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to