// worker.mjs: the page's worker for one module (run-browser.mjs). It compiles the module, // decodes every case through sink.mjs in order, and posts each case's start and result; the // page ends it from outside when a case passes the wall-clock limit. import { decode } from '/sink.mjs'; self.onmessage = async (e) => { const { moduleBytes, cases } = e.data; const module = await WebAssembly.compile(moduleBytes); for (let i = 0; i < cases.length; i++) { const c = cases[i]; self.postMessage({ start: i }); const r = await decode(module, c.cap, c.payload, c.set); self.postMessage({ done: i, r }); } self.postMessage({ end: true }); };