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

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     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