1// META: script=/common/get-host-info.sub.js 2// META: script=resources/create-wasm-module.js 3// META: timeout=long 4 5const { HTTPS_NOTSAMESITE_ORIGIN } = get_host_info(); 6const iframe = document.createElement('iframe'); 7iframe.src = `${HTTPS_NOTSAMESITE_ORIGIN}/streams/transferable/resources/deserialize-error-frame.html`; 8 9window.addEventListener('message', async evt => { 10 // Tests are serialized to make the results deterministic. 11 switch (evt.data) { 12 case 'init done': { 13 const ws = new WritableStream(); 14 iframe.contentWindow.postMessage(ws, '*', [ws]); 15 return; 16 } 17 18 case 'ws done': { 19 const module = await createWasmModule(); 20 const rs = new ReadableStream({ 21 start(controller) { 22 controller.enqueue(module); 23 } 24 }); 25 iframe.contentWindow.postMessage(rs, '*', [rs]); 26 return; 27 } 28 29 case 'rs done': { 30 iframe.remove(); 31 } 32 } 33}); 34 35// Need to do this after adding the listener to ensure we catch the first 36// message. 37document.body.appendChild(iframe); 38 39fetch_tests_from_window(iframe.contentWindow); 40