1<!doctype html> 2<title>Cyclic linking between JavaScript and WebAssembly (JS higher)</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 "Check cyclic linking between JavaScript and WebAssembly where JavaScript is higher in the module graph."); 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, 10); 20 assert_equals(log[1], 1); 21 assert_equals(log[3], 2); 22 assert_equals(log[5], 3); 23 assert_equals(log[7], 4); 24 assert_equals(log[9], 5); 25 })); 26 27 function unreachable() { log.push("unexpected"); } 28</script> 29<script type="module" src="./resources/js-wasm-cycle-value.js" 30 onerror="unreachable()" onload="log.push(1)"></script> 31<script type="module" src="./resources/js-wasm-cycle-global.js" 32 onerror="unreachable()" onload="log.push(2)"></script> 33<script type="module" src="./resources/js-wasm-cycle-memory.js" 34 onerror="unreachable()" onload="log.push(3)"></script> 35<script type="module" src="./resources/js-wasm-cycle-table.js" 36 onerror="unreachable()" onload="log.push(4)"></script> 37<script type="module" src="./resources/js-wasm-cycle-function-error.js" 38 onerror="unreachable()" onload="log.push(5)"></script> 39