diff options
Diffstat (limited to 'dom/worklet/tests/worklet_audioWorklet_WASM_features.js')
-rw-r--r-- | dom/worklet/tests/worklet_audioWorklet_WASM_features.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/dom/worklet/tests/worklet_audioWorklet_WASM_features.js b/dom/worklet/tests/worklet_audioWorklet_WASM_features.js new file mode 100644 index 0000000000..e9e4586f91 --- /dev/null +++ b/dom/worklet/tests/worklet_audioWorklet_WASM_features.js @@ -0,0 +1,44 @@ +class WasmProcessWorkletProcessor extends AudioWorkletProcessor { + constructor(...args) { + super(...args); + this.port.postMessage(testModules()); + } + + process(inputs, outputs, parameters) { + // Do nothing, output silence + return true; + } +} + +function testModule(binary) { + try { + let wasmModule = new WebAssembly.Module(binary); + } catch (error) { + if (error instanceof WebAssembly.CompileError) { + return error.message; + } + return "unknown error"; + } + return true; +} + +// TODO: test more features +function testModules() { + /* + js -e ' + t = wasmTextToBinary(` + (module + (tag) + ) + `); + print(t) + ' + */ + // eslint-disable-next-line + const exceptionHandlingCode = new Uint8Array([ + 0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 13, 3, 1, 0, 0, + ]); + return testModule(exceptionHandlingCode); +} + +registerProcessor("wasm", WasmProcessWorkletProcessor); |