js/src/jit-test/tests/debug/Source-introductionScript-03.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.

michael@0 1 // We don't record introduction scripts in a different global from the
michael@0 2 // introduced script, even if they're both debuggees.
michael@0 3
michael@0 4 var dbg = new Debugger;
michael@0 5
michael@0 6 var g1 = newGlobal();
michael@0 7 g1.g1 = g1;
michael@0 8 var g1DO = dbg.addDebuggee(g1);
michael@0 9
michael@0 10 var g2 = newGlobal();
michael@0 11 g2.g1 = g1;
michael@0 12
michael@0 13 var log = '';
michael@0 14 dbg.onDebuggerStatement = function (frame) {
michael@0 15 log += 'd';
michael@0 16 assertEq(frame.script.source.introductionScript, undefined);
michael@0 17 assertEq(frame.script.source.introductionOffset, undefined);
michael@0 18 };
michael@0 19
michael@0 20 g2.eval('g1.eval("debugger;");');
michael@0 21 assertEq(log, 'd');
michael@0 22
michael@0 23 // Just for sanity: when it's not cross-global, we do note the introducer.
michael@0 24 log = '';
michael@0 25 dbg.onDebuggerStatement = function (frame) {
michael@0 26 log += 'd';
michael@0 27 assertEq(frame.script.source.introductionScript instanceof Debugger.Script, true);
michael@0 28 assertEq(typeof frame.script.source.introductionOffset, "number");
michael@0 29 };
michael@0 30 // Exactly as above, but with g1 instead of g2.
michael@0 31 g1.eval('g1.eval("debugger;");');
michael@0 32 assertEq(log, 'd');

mercurial