11cb0ef41Sopenharmony_ci<!DOCTYPE html> 21cb0ef41Sopenharmony_ci<title>Handling of importing invalid WebAssembly modules</title> 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ci<script src="/resources/testharness.js"></script> 51cb0ef41Sopenharmony_ci<script src="/resources/testharnessreport.js"></script> 61cb0ef41Sopenharmony_ci<script> 71cb0ef41Sopenharmony_ci setup({allow_uncaught_exception: true}); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci window.log = []; 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_ci window.addEventListener("error", ev => log.push(ev.error)); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci const test_load = async_test( 141cb0ef41Sopenharmony_ci "Test that imports of invalid WebAssembly modules leads to WebAssembly.CompileError on window."); 151cb0ef41Sopenharmony_ci window.addEventListener("load", test_load.step_func_done(ev => { 161cb0ef41Sopenharmony_ci assert_equals(log.length, 2); 171cb0ef41Sopenharmony_ci assert_equals(log[0].constructor, WebAssembly.CompileError); 181cb0ef41Sopenharmony_ci assert_equals(log[1].constructor, WebAssembly.CompileError); 191cb0ef41Sopenharmony_ci })); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci function unreachable() { log.push("unexpected"); } 221cb0ef41Sopenharmony_ci</script> 231cb0ef41Sopenharmony_ci<script type="module" src="./resources/invalid-bytecode.wasm" onerror="unreachable()"></script> 241cb0ef41Sopenharmony_ci<script type="module" src="./resources/invalid-module.wasm" onerror="unreachable()"></script> 25