summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/parser/stencil-laziness-validate.js
blob: 78bcb80910a4b1bc71b7fbf8ae9a40bc83b5327c (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
// |jit-test| skip-if: isLcovEnabled()

load(libdir + "asserts.js");

const gWithSource = newGlobal({discardSource: false});
const gWithoutSource = newGlobal({discardSource: true});

const stencil = compileToStencil("");

gWithSource.evalStencil(stencil);
assertThrowsInstanceOf(() => gWithoutSource.evalStencil(stencil), gWithoutSource.Error);

const xdr = compileToStencilXDR("");
gWithSource.evalStencilXDR(xdr);
assertThrowsInstanceOf(() => gWithoutSource.evalStencilXDR(xdr), gWithoutSource.Error);

const code = cacheEntry("");

evaluate(code, { global: gWithSource, saveIncrementalBytecode: true});
evaluate(code, { global: gWithSource, loadBytecode: true});
assertThrowsInstanceOf(() => evaluate(code, { global: gWithoutSource, loadBytecode: true}), gWithoutSource.Error);

const moduleStencil = compileToStencil("", { module: true });
gWithSource.instantiateModuleStencil(moduleStencil);
assertThrowsInstanceOf(() => gWithoutSource.instantiateModuleStencil(moduleStencil), gWithoutSource.Error);

const moduleXDR = compileToStencilXDR("", { module: true });
gWithSource.instantiateModuleStencilXDR(moduleXDR);
assertThrowsInstanceOf(() => gWithoutSource.instantiateModuleStencilXDR(moduleXDR), gWithoutSource.Error);