blob: 64cf2bbfb1293e90a67df02cebddeee51ae0ef78 (
plain)
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
|
// META: script=/common/get-host-info.sub.js
// META: script=resources/create-wasm-module.js
// META: timeout=long
const { HTTPS_NOTSAMESITE_ORIGIN } = get_host_info();
const iframe = document.createElement('iframe');
iframe.src = `${HTTPS_NOTSAMESITE_ORIGIN}/streams/transferable/resources/deserialize-error-frame.html`;
window.addEventListener('message', async evt => {
// Tests are serialized to make the results deterministic.
switch (evt.data) {
case 'init done': {
const ws = new WritableStream();
iframe.contentWindow.postMessage(ws, '*', [ws]);
return;
}
case 'ws done': {
const module = await createWasmModule();
const rs = new ReadableStream({
start(controller) {
controller.enqueue(module);
}
});
iframe.contentWindow.postMessage(rs, '*', [rs]);
return;
}
case 'rs done': {
iframe.remove();
}
}
});
// Need to do this after adding the listener to ensure we catch the first
// message.
document.body.appendChild(iframe);
fetch_tests_from_window(iframe.contentWindow);
|