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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 // Debugger.Frame.prototype.this in functions, with object values
     3 function classOf(obj) {
     4     return Object.prototype.toString.call(obj).match(/^\[object (.*)\]$/)[1];
     5 }
     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 };
    16 g.eval("function f() { debugger; }");
    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