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