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

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:ec37772c8a16
1 // Debugger.Frame.prototype.this in functions, with object values
2
3 function classOf(obj) {
4 return Object.prototype.toString.call(obj).match(/^\[object (.*)\]$/)[1];
5 }
6
7 var g = newGlobal();
8 var dbg = new Debugger(g);
9 var hits = 0;
10 dbg.onDebuggerStatement = function (frame) {
11 hits++;
12 assertEq(frame.this instanceof Debugger.Object, true);
13 assertEq(frame.this.class, classOf(Object(g.v)));
14 };
15
16 g.eval("function f() { debugger; }");
17
18 g.eval("v = {}; f.call(v);");
19 g.eval("v.f = f; v.f();");
20 g.eval("v = new Date; f.call(v);");
21 g.eval("v.f = f; v.f();");
22 g.eval("v = []; f.call(v);");
23 g.eval("Object.prototype.f = f; v.f();");
24 g.eval("v = this; f();");
25 assertEq(hits, 7);

mercurial