js/src/jit-test/tests/debug/Frame-arguments-01.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // Frame.prototype.arguments with primitive values
     3 var g = newGlobal();
     4 g.args = null;
     5 var dbg = new Debugger(g);
     6 var hits;
     7 var v;
     8 dbg.onDebuggerStatement = function (frame) {
     9     hits++;
    10     var args = frame.arguments;
    11     assertEq(args instanceof Array, true);
    12     assertEq(Array.isArray(args), false);
    13     assertEq(args, frame.arguments);
    14     assertEq(args.length, g.args.length);
    15     for (var i = 0; i < args.length; i++)
    16         assertEq(args[i], g.args[i]);
    17 };
    19 // no formal parameters
    20 g.eval("function f() { debugger; }");
    22 hits = 0;
    23 g.eval("args = []; f();");
    24 g.eval("this.f();");
    25 g.eval("args = ['hello', 3.14, true, false, null, undefined]; f.apply(undefined, args);");
    26 g.eval("f('hello', 3.14, true, false, null, undefined);");
    27 g.eval("args = [-0, NaN, -1/0]; this.f(-0, NaN, -1/0);");
    28 assertEq(hits, 5);
    30 // with formal parameters
    31 g.eval("function f(a, b) { debugger; }");
    33 hits = 0;
    34 g.eval("args = []; f();");
    35 g.eval("this.f();");
    36 g.eval("args = ['a', 'b']; f('a', 'b');");
    37 g.eval("this.f('a', 'b');");
    38 g.eval("f.bind(null, 'a')('b');");
    39 assertEq(hits, 5);

mercurial