-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the ability for the IPCTestingAPI to report when a sync stream me…
…ssage fails to be deserialized correctly https://bugs.webkit.org/show_bug.cgi?id=264810 rdar://118391408 Reviewed by Alex Christensen. Add the ability for the IPCTestingAPI to report when a sync stream connection message fails to be received correctly. The existing behaviour is that no reply is returned for failed messages. This change records the decoder validity on failure into a MessageSyncReply so that the IPCTestingAPI can raise an exception. * LayoutTests/ipc/ignoreinvalidmessagesfortesting-stream-connection-expected.txt: Added. * LayoutTests/ipc/ignoreinvalidmessagesfortesting-stream-connection.html: Added. * Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp: (WebKit::GPUConnectionToWebProcess::createRenderingBackend): (WebKit::GPUConnectionToWebProcess::createGraphicsContextGL): (WebKit::GPUConnectionToWebProcess::createRemoteGPU): * Source/WebKit/Platform/IPC/HandleMessage.h: (IPC::handleMessageSynchronous): * Source/WebKit/Platform/IPC/StreamServerConnection.cpp: (IPC::StreamServerConnection::tryCreate): (IPC::StreamServerConnection::dispatchStreamMessage): (IPC::StreamServerConnection::dispatchOutOfStreamMessage): (IPC::StreamServerConnection::sendDeserializationErrorSyncReply): * Source/WebKit/Platform/IPC/StreamServerConnection.h: * Source/WebKit/Shared/IPCStreamTester.cpp: (WebKit::IPCStreamTester::IPCStreamTester): (WebKit::IPCStreamTester::syncMessageEmptyReply): * Source/WebKit/Shared/IPCStreamTester.h: * Source/WebKit/Shared/IPCStreamTester.messages.in: * Source/WebKit/WebKit.xcodeproj/project.pbxproj: * Tools/TestWebKitAPI/Tests/IPC/StreamConnectionTests.cpp: (TestWebKitAPI::TEST_F): Canonical link: https://commits.webkit.org/270892@main
- Loading branch information
1 parent
4dacd4a
commit 56b0d92
Showing
13 changed files
with
144 additions
and
18 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
LayoutTests/ipc/send-invalid-sync-stream-message-empty-reply-check-exception-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
PASS Sending sync stream message with incorrect parameters to the UI process shouldn't crash when IPCTestingAPI is enabled | ||
PASS Sending sync stream message with incorrect parameters to the GPU process shouldn't crash when IPCTestingAPI is enabled | ||
|
61 changes: 61 additions & 0 deletions
61
LayoutTests/ipc/send-invalid-sync-stream-message-empty-reply-check-exception.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<!doctype html><!-- webkit-test-runner [ IPCTestingAPIEnabled=true ] --> | ||
<title>Test that sending invalid messages via the IPC testing StreamConnectoin API doesn't kill the receiver</title> | ||
<script src="../resources/testharness.js"></script> | ||
<script src="../resources/testharnessreport.js"></script> | ||
<body> | ||
<script> | ||
const defaultTimeout = 1000; | ||
const bufferSizeLog2 = 9; | ||
const streamTesterID = 447; | ||
|
||
promise_test(async t => { | ||
if (!window.IPC) | ||
return; | ||
|
||
const [streamConnection, serverConnectionHandle] = IPC.createStreamClientConnection(bufferSizeLog2); | ||
streamConnection.open(); | ||
IPC.sendMessage("UI", 0, IPC.messages.IPCTester_CreateStreamTester.name, [ | ||
{ type: 'uint64_t', value: streamTesterID }, | ||
{ type: 'StreamServerConnectionHandle', value: serverConnectionHandle }, | ||
]); | ||
const arguments = streamConnection.waitForMessage(streamTesterID, IPC.messages.IPCStreamTesterProxy_WasCreated.name, defaultTimeout); | ||
streamConnection.setSemaphores(arguments[0].value, arguments[1].value); | ||
|
||
// Test starts here. | ||
try { | ||
assert_throws_js(TypeError, | ||
() => { streamConnection.sendSyncMessage(streamTesterID, IPC.messages.IPCStreamTester_SyncMessageEmptyReply.name, defaultTimeout, [ ]) }, | ||
`failed sync message must throw error`); | ||
} finally { | ||
IPC.sendSyncMessage("UI", 0, IPC.messages.IPCTester_ReleaseStreamTester.name, defaultTimeout, [{ type: 'uint64_t', value: streamTesterID }]); | ||
streamConnection.invalidate(); | ||
} | ||
|
||
}, "Sending sync stream message with incorrect parameters to the UI process shouldn't crash when IPCTestingAPI is enabled"); | ||
|
||
promise_test(async t => { | ||
if (!window.IPC) | ||
return; | ||
|
||
const [streamConnection, serverConnectionHandle] = IPC.createStreamClientConnection(bufferSizeLog2); | ||
streamConnection.open(); | ||
IPC.sendMessage("GPU", 0, IPC.messages.IPCTester_CreateStreamTester.name, [ | ||
{ type: 'uint64_t', value: streamTesterID }, | ||
{ type: 'StreamServerConnectionHandle', value: serverConnectionHandle }, | ||
]); | ||
const arguments = streamConnection.waitForMessage(streamTesterID, IPC.messages.IPCStreamTesterProxy_WasCreated.name, defaultTimeout); | ||
streamConnection.setSemaphores(arguments[0].value, arguments[1].value); | ||
|
||
// Test starts here. | ||
try { | ||
assert_throws_js(TypeError, | ||
() => { streamConnection.sendSyncMessage(streamTesterID, IPC.messages.IPCStreamTester_SyncMessageEmptyReply.name, defaultTimeout, [ ]) }, | ||
`failed sync message must throw error`); | ||
} finally { | ||
IPC.sendSyncMessage("GPU", 0, IPC.messages.IPCTester_ReleaseStreamTester.name, defaultTimeout, [{ type: 'uint64_t', value: streamTesterID }]); | ||
streamConnection.invalidate(); | ||
} | ||
|
||
}, "Sending sync stream message with incorrect parameters to the GPU process shouldn't crash when IPCTestingAPI is enabled"); | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters