1<!doctype html>
2<title>Errors for linking WebAssembly module scripts</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        "Link errors for imports between WebAssembly modules should be reported.");
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.length, 2);
20      assert_equals(log[1], 1);
21    }));
22
23    function unreachable() { log.push("unexpected"); }
24</script>
25<script type="module" src="./resources/wasm-import-error-from-wasm.wasm"
26    onerror="unreachable()" onload="log.push(1)"></script>
27