forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend-invalid-sync-stream-message-empty-reply-check-exception.html
38 lines (33 loc) · 1.72 KB
/
send-invalid-sync-stream-message-empty-reply-check-exception.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!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;
for (const processTarget of IPC.processTargets) {
const [streamConnection, serverConnectionHandle] = IPC.createStreamClientConnection(bufferSizeLog2, defaultTimeout);
streamConnection.open();
IPC.sendMessage(processTarget, 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);
streamConnection.setSemaphores(arguments[0].value, arguments[1].value);
// Test starts here.
try {
assert_throws_js(TypeError,
() => { streamConnection.sendSyncMessage(streamTesterID, IPC.messages.IPCStreamTester_SyncMessageEmptyReply.name, [ ]) },
`failed sync message must throw error`);
} finally {
IPC.sendSyncMessage(processTarget, 0, IPC.messages.IPCTester_ReleaseStreamTester.name, defaultTimeout, [{ type: 'uint64_t', value: streamTesterID }]);
streamConnection.invalidate();
}
}
}, "Sending sync stream message with incorrect parameters shouldn't crash when IPCTestingAPI is enabled");
</script>