js/src/jit-test/tests/debug/Debugger-findScripts-14.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial