js/src/jit-test/tests/debug/Debugger-findScripts-14.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 // Debugger.prototype.findScripts can find the innermost script at a given
michael@0 2 // source location.
michael@0 3 var g = newGlobal();
michael@0 4 var dbg = new Debugger();
michael@0 5 var gw = dbg.addDebuggee(g);
michael@0 6
michael@0 7 function script(f) {
michael@0 8 return gw.makeDebuggeeValue(f).script;
michael@0 9 }
michael@0 10
michael@0 11 function arrayIsOnly(array, element) {
michael@0 12 return array.length == 1 && array[0] === element;
michael@0 13 }
michael@0 14
michael@0 15 url = scriptdir + 'Debugger-findScripts-14.script1';
michael@0 16 g.load(url);
michael@0 17
michael@0 18 var scripts;
michael@0 19
michael@0 20 // When we're doing 'innermost' queries, we don't have to worry about finding
michael@0 21 // random eval scripts: we should get exactly one script, for the function
michael@0 22 // covering that line.
michael@0 23 scripts = dbg.findScripts({url:url, line:4, innermost:true});
michael@0 24 assertEq(arrayIsOnly(scripts, script(g.f)), true);
michael@0 25
michael@0 26 scripts = dbg.findScripts({url:url, line:6, innermost:true});
michael@0 27 assertEq(arrayIsOnly(scripts, script(g.f())), true);
michael@0 28
michael@0 29 scripts = dbg.findScripts({url:url, line:8, innermost:true});
michael@0 30 assertEq(arrayIsOnly(scripts, script(g.f()())), true);

mercurial