Debian Codegraph @

js/src/jit-test/tests/modules/bug-1284486-2.js

raw
1 // This tests that attempting to perform ModuleDeclarationInstantation a
2 // second time after a failure still fails. (It no longer stores and rethrows
3 // the same error; the spec changed in that regard and the implementation was
4 // updated in bug 1420420).
5 //
6 // The attempts fails becuase module 'a' is not available.
7 //
8 // This test exercises the path where the previously instantiated module is
9 // re-instantiated directly.
10
11 let b = registerModule('b', parseModule("export var b = 3; export var c = 4;"));
12 let c = registerModule('c', parseModule("export * from 'a'; export * from 'b';"));
13
14 let e1;
15 let threw = false;
16 try {
17 moduleLink(c);
18 } catch (exc) {
19 threw = true;
20 e1 = exc;
21 }
22 assertEq(threw, true);
23 assertEq(typeof e1 === "undefined", false);
24
25 threw = false;
26 let e2;
27 try {
28 moduleLink(c);
29 } catch (exc) {
30 threw = true;
31 e2 = exc;
32 }
33 assertEq(threw, true);
34 assertEq(e1.toString(), e2.toString());