js/src/jit-test/tests/debug/Script-getChildScripts-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 // Basic getChildScripts tests.
michael@0 2
michael@0 3 var g = newGlobal();
michael@0 4 var dbg = new Debugger(g);
michael@0 5 var log;
michael@0 6 function note(s) {
michael@0 7 assertEq(s instanceof Debugger.Script, true);
michael@0 8 log += 'S';
michael@0 9 var c = s.getChildScripts();
michael@0 10 if (c.length > 0) {
michael@0 11 log += '[';
michael@0 12 for (var i = 0; i < c.length; i++)
michael@0 13 note(c[i]);
michael@0 14 log += ']';
michael@0 15 }
michael@0 16 }
michael@0 17 dbg.onDebuggerStatement = function (frame) { note(frame.script); };
michael@0 18
michael@0 19 function test(code, expected) {
michael@0 20 log = '';
michael@0 21 g.eval(code);
michael@0 22 assertEq(log, expected);
michael@0 23 }
michael@0 24
michael@0 25 test("debugger;",
michael@0 26 "S");
michael@0 27 test("function f() {} debugger;",
michael@0 28 "S[S]");
michael@0 29 test("function g() { function h() { function k() {} return k; } return h; } debugger;",
michael@0 30 "S[S[S[S]]]");
michael@0 31 test("function q() {} function qq() {} debugger;",
michael@0 32 "S[SS]");
michael@0 33 test("[0].map(function id(a) { return a; }); debugger;",
michael@0 34 "S[S]");
michael@0 35 test("Function('return 2+2;')(); debugger;",
michael@0 36 "S");
michael@0 37 test("var obj = {get x() { return 0; }, set x(v) {}}; debugger;",
michael@0 38 "S[SS]");
michael@0 39 test("function r(n) { for (var i = 0; i < n; i++) yield i; } debugger;",
michael@0 40 "S[S]");
michael@0 41 test("function* qux(n) { for (var i = 0; i < n; i++) yield i; } debugger;",
michael@0 42 "S[S]");
michael@0 43 test("var it = (3 for (p in obj)); debugger;",
michael@0 44 "S[S]");

mercurial