forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate-image-buffer-crash.html
63 lines (55 loc) · 2.02 KB
/
create-image-buffer-crash.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<!-- webkit-test-runner [ IPCTestingAPIEnabled=true ] -->
<p>This test passes if WebKit does not crash.</p>
<script src="../resources/ipc.js"></script>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
window.setTimeout(async () => {
if (!window.IPC)
return window.testRunner?.notifyDone();
const { CoreIPC } = await import('./coreipc.js');
const renderingBackendIdentifier = randomIPCID();
const connection = CoreIPC.newStreamConnection();
CoreIPC.GPU.GPUConnectionToWebProcess.CreateRenderingBackend(0, { renderingBackendIdentifier: renderingBackendIdentifier, connectionHandle: connection });
const remoteBackend = connection.newInterface("RemoteRenderingBackend", renderingBackendIdentifier);
const didInitializeReply = connection.connection.waitForMessage(renderingBackendIdentifier, IPC.messages.RemoteRenderingBackendProxy_DidInitialize.name, 1)
connection.connection.setSemaphores(didInitializeReply[0].value, didInitializeReply[1].value);
// The pixel formats to test
const pixelFormats = [
0, // BGRX8
1, // BGRA8
2, // RGB10
3, // RGB10A8
4 // RGBA16F (if HDR_SUPPORT is enabled)
];
// Iterate through each pixel format and create image buffer
for (let format of pixelFormats) {
try {
remoteBackend.CreateImageBuffer({
logicalSize: { width: 69, height: 67 },
renderingMode: 1,
renderingPurpose: 2,
resolutionScale: 96,
colorSpace: {
serializableColorSpace: {
alias: {
m_cgColorSpace: {
alias: {
variantType: 'RetainPtr<CFStringRef>',
variant: 'A'
}
}
}
}
},
pixelFormat: format,
renderingResourceIdentifier: 393230 + format
});
} catch {}
}
connection.connection.invalidate();
window.testRunner?.notifyDone();
}, 10);
</script>