Debian Codegraph @

js/src/jit-test/tests/debug/Frame-this-06.js

raw
1 // Frame.this and evalInFrame with missing this, strict and non-strict.
2 var g = newGlobal({newCompartment: true});
3 var dbg = new Debugger(g);
4 var evalThis, frameThis;
5 dbg.onEnterFrame = function (frame) {
6 if (frame.type === "eval")
7 return;
8 assertEq(frame.type, "call");
9 evalThis = frame.eval("this");
10 frameThis = frame.this;
11 };
12
13 // Strict, this is primitive.
14 g.eval("var foo = function() { 'use strict'; }; foo.call(33);");
15 assertEq(evalThis.return, 33);
16 assertEq(frameThis, 33);
17
18 // Non-strict, this has to be boxed.
19 g.eval("var bar = function() { }; bar.call(22);");
20 assertEq(typeof evalThis.return, "object");
21 assertEq(evalThis.return.unsafeDereference().valueOf(), 22);
22 assertEq(frameThis.unsafeDereference().valueOf(), 22);