1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/debug/Debugger-onNewGlobalObject-08.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,26 @@ 1.4 +// Creating a global within an onNewGlobalObject handler causes a recursive handler invocation. 1.5 +// 1.6 +// This isn't really desirable behavior, as presumably a global created while a 1.7 +// handler is running is one the debugger is creating for its own purposes and 1.8 +// should not be observed, but if this behavior changes, we sure want to know. 1.9 + 1.10 +var dbg = new Debugger; 1.11 +var log; 1.12 +var depth; 1.13 + 1.14 +dbg.onNewGlobalObject = function (global) { 1.15 + log += '('; depth++; 1.16 + 1.17 + assertEq(global.seen, undefined); 1.18 + global.seen = true; 1.19 + 1.20 + if (depth < 3) 1.21 + newGlobal(); 1.22 + 1.23 + log += ')'; depth--; 1.24 +}; 1.25 + 1.26 +log = ''; 1.27 +depth = 0; 1.28 +newGlobal(); 1.29 +assertEq(log, '((()))');