js/src/jit-test/tests/debug/Frame-eval-14.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 // Test the corner case of accessing an unaliased variable of a block
michael@0 2 // while the block is not live.
michael@0 3
michael@0 4 var g = newGlobal();
michael@0 5 g.eval("function h() { debugger }");
michael@0 6 g.eval("function f() { let (x = 1, y) { (function() { y = 0 })(); h() } }");
michael@0 7 g.eval("var surprise = null");
michael@0 8
michael@0 9 var dbg = new Debugger(g);
michael@0 10 dbg.onDebuggerStatement = function(hFrame) {
michael@0 11 var fFrame = hFrame.older;
michael@0 12 assertEq(fFrame.environment.getVariable('x'), 1);
michael@0 13 assertEq(fFrame.environment.getVariable('y'), 0);
michael@0 14 fFrame.eval("surprise = function() { return ++x }");
michael@0 15 assertEq(g.surprise(), 2);
michael@0 16 }
michael@0 17 g.f();
michael@0 18 assertEq(g.surprise !== null, true);
michael@0 19
michael@0 20 // Either succeed or throw an error about 'x' not being live
michael@0 21 try {
michael@0 22 assertEq(g.surprise(), 3);
michael@0 23 } catch (e) {
michael@0 24 assertEq(e+'', 'Error: x is not live');
michael@0 25 }

mercurial