bug-1284486.js (920B)
1 // This tests that module instantiation can succeed when executed a second 2 // time after a failure. 3 // 4 // The first attempt fails becuase module 'a' is not available. The second 5 // attempt succeeds as 'a' is now available. 6 // 7 // This test exercises the path where the previously instantiated module is 8 // encountered as an import. 9 10 let b = registerModule('b', parseModule("export var b = 3; export var c = 4;")); 11 let c = registerModule('c', parseModule("export * from 'a'; export * from 'b';")); 12 13 let e1; 14 let threw = false; 15 try { 16 moduleLink(c); 17 } catch (exc) { 18 threw = true; 19 e1 = exc; 20 } 21 assertEq(threw, true); 22 assertEq(typeof e1 === "undefined", false); 23 24 let a = registerModule('a', parseModule("export var a = 1; export var b = 2;")); 25 let d = registerModule('d', parseModule("import { a } from 'c'; a;")); 26 27 threw = false; 28 try { 29 moduleLink(d); 30 } catch (exc) { 31 threw = true; 32 } 33 assertEq(threw, false);