summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/debug/Frame-this-13.js
blob: 4200cecc45c3aa9c5386729bf9429079f62bbadd (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
// Test that Debugger.Frame.prototype.this works on normal functions.

load(libdir + "asserts.js");

const g = newGlobal({ newCompartment: true });
const dbg = new Debugger();
const gDO = dbg.addDebuggee(g);

g.eval(`
var context = {};
var f = function() {
  return this;
}.bind(context);
`);

let frame;
dbg.onEnterFrame = f => {
  frame = f;
  assertEq(frame.this, gDO.makeDebuggeeValue(g.context));
  dbg.onEnterFrame = undefined;
};

g.f();

assertEq(!!frame, true);
assertThrowsInstanceOf(() => frame.this, Error);