wasm-import.tentative.html (1288B)
1 <!doctype html> 2 <title>Errors for imports of WebAssembly modules</title> 3 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script> 7 setup({allow_uncaught_exception: true}); 8 9 const test_load = async_test( 10 "Invalid imports for WebAssembly modules should error."); 11 12 window.log = []; 13 window.addEventListener("error", ev => { 14 test_load.step(() => assert_equals(ev.error.constructor, WebAssembly.LinkError)); 15 log.push(ev.message); 16 }); 17 18 window.addEventListener("load", test_load.step_func_done(ev => { 19 assert_equals(log[1], 1); 20 assert_equals(log[3], 2); 21 assert_equals(log[5], 3); 22 assert_equals(log[7], 4); 23 })); 24 25 function unreachable() { log.push("unexpected"); } 26 </script> 27 <script type="module" src="./resources/wasm-import-func.wasm" 28 onerror="unreachable()" onload="log.push(1)"></script> 29 <script type="module" src="./resources/wasm-import-memory.wasm" 30 onerror="unreachable()" onload="log.push(2)"></script> 31 <script type="module" src="./resources/wasm-import-table.wasm" 32 onerror="unreachable()" onload="log.push(3)"></script> 33 <script type="module" src="./resources/wasm-import-global.wasm" 34 onerror="unreachable()" onload="log.push(4)"></script>