summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/modules/bug1449153.js
blob: 4c321854bbb3a538157c7ab68a46c2e547985f53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Test performing GetModuleNamespace on an errored module.

class MyError {}

async function assertThrowsMyError(f)
{
    let caught = false;
    try {
        await f();
    } catch (e) {
        caught = true;
        assertEq(e.constructor, MyError);
    }
    assertEq(caught, true);
}

registerModule("a", parseModule(`
    throw new MyError();
`));

let c = registerModule("c", parseModule(`
    import "a";
`));
moduleLink(c);
assertThrowsMyError(() => moduleEvaluate(c));

let b = registerModule('b', parseModule(`
    import * as ns0 from 'a'
`));
moduleLink(b);
assertThrowsMyError(() => moduleEvaluate(b));

drainJobQueue();