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

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     1 // When argument[x] is assigned, where x > callee.length, frame.arguments reflects the change.
     3 var g = newGlobal();
     4 g.eval("function f(a, b) {\n" +
     5        "    for (var i = 0; i < arguments.length; i++)\n" +
     6        "        arguments[i] = i;\n" +
     7        "    debugger;\n" +
     8        "}\n");
    10 var dbg = Debugger(g);
    11 var hits = 0;
    12 dbg.onDebuggerStatement = function (frame) {
    13     var argc = frame.eval("arguments.length").return;
    14     var args = frame.arguments;
    15     assertEq(args.length, argc);
    16     for (var i = 0; i < argc; i++)
    17         assertEq(args[i], i);
    18     hits++;
    19 }
    21 g.f(9);
    22 g.f(9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9);
    23 assertEq(hits, 2);

mercurial