diff options
Diffstat (limited to 'js/src/jit-test/tests/parser/stencil-laziness-validate.js')
-rw-r--r-- | js/src/jit-test/tests/parser/stencil-laziness-validate.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/parser/stencil-laziness-validate.js b/js/src/jit-test/tests/parser/stencil-laziness-validate.js new file mode 100644 index 0000000000..78bcb80910 --- /dev/null +++ b/js/src/jit-test/tests/parser/stencil-laziness-validate.js @@ -0,0 +1,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); |