Debian Codegraph @

js/src/jit-test/tests/parser/bug1887176.js

raw
1
2 // This tests a case where TokenStreamAnyChars::fillExceptingContext
3 // mishandled a wasm frame, leading to an assertion failure.
4
5 if (!wasmIsSupported())
6 quit();
7
8 const v0 = `
9 const o6 = {
10 f() {
11 function F2() {
12 if (!new.target) { throw 'must be called with new'; }
13 }
14 return F2();
15 return {}; // This can be anything, but it must be present
16 },
17 };
18
19 const o7 = {
20 "main": o6,
21 };
22
23 const v15 = new WebAssembly.Module(wasmTextToBinary(\`
24 (module
25 (import "main" "f" (func))
26 (func (export "go")
27 call 0
28 )
29 )\`));
30 const v16 = new WebAssembly.Instance(v15, o7);
31 v16.exports.go();
32 `;
33
34 const o27 = {
35 // Both "fileName" and null are necessary
36 "fileName": null,
37 };
38
39 let caught = false;
40 try {
41 evaluate(v0, o27);
42 } catch (e) {
43 assertEq(e, "must be called with new");
44 caught = true;
45 }
46 assertEq(caught, true);