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.

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

mercurial