js/src/jit-test/tests/debug/Source-introductionScript-03.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/js/src/jit-test/tests/debug/Source-introductionScript-03.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,32 @@
     1.4 +// We don't record introduction scripts in a different global from the
     1.5 +// introduced script, even if they're both debuggees.
     1.6 +
     1.7 +var dbg = new Debugger;
     1.8 +
     1.9 +var g1 = newGlobal();
    1.10 +g1.g1 = g1;
    1.11 +var g1DO = dbg.addDebuggee(g1);
    1.12 +
    1.13 +var g2 = newGlobal();
    1.14 +g2.g1 = g1;
    1.15 +
    1.16 +var log = '';
    1.17 +dbg.onDebuggerStatement = function (frame) {
    1.18 +  log += 'd';
    1.19 +  assertEq(frame.script.source.introductionScript, undefined);
    1.20 +  assertEq(frame.script.source.introductionOffset, undefined);
    1.21 +};
    1.22 +
    1.23 +g2.eval('g1.eval("debugger;");');
    1.24 +assertEq(log, 'd');
    1.25 +
    1.26 +// Just for sanity: when it's not cross-global, we do note the introducer.
    1.27 +log = '';
    1.28 +dbg.onDebuggerStatement = function (frame) {
    1.29 +  log += 'd';
    1.30 +  assertEq(frame.script.source.introductionScript instanceof Debugger.Script, true);
    1.31 +  assertEq(typeof frame.script.source.introductionOffset, "number");
    1.32 +};
    1.33 +// Exactly as above, but with g1 instead of g2.
    1.34 +g1.eval('g1.eval("debugger;");');
    1.35 +assertEq(log, 'd');

mercurial