1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/devtools/server/tests/unit/test_framebindings-06.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +var gDebuggee; 1.8 +var gClient; 1.9 +var gThreadClient; 1.10 + 1.11 +function run_test() 1.12 +{ 1.13 + initTestDebuggerServer(); 1.14 + gDebuggee = addTestGlobal("test-grips"); 1.15 + 1.16 + gClient = new DebuggerClient(DebuggerServer.connectPipe()); 1.17 + gClient.connect(function() { 1.18 + attachTestTabAndResume(gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { 1.19 + gThreadClient = aThreadClient; 1.20 + test_banana_environment(); 1.21 + }); 1.22 + }); 1.23 + do_test_pending(); 1.24 +} 1.25 + 1.26 +function test_banana_environment() 1.27 +{ 1.28 + 1.29 + gThreadClient.addOneTimeListener("paused", 1.30 + function(aEvent, aPacket) { 1.31 + do_check_matches({type:"paused", frame: 1.32 + {environment: 1.33 + {type: "function", function: {name: "banana3"}, 1.34 + parent: 1.35 + {type: "block", bindings: {variables: {banana3:undefined}}, 1.36 + parent: 1.37 + {type: "function", function: {name: "banana2"}, 1.38 + parent: 1.39 + {type:"block", bindings: {variables: {banana2:undefined}}, 1.40 + parent: 1.41 + {type:"block", bindings: {variables: {banana2:undefined}}, 1.42 + parent: 1.43 + {type:"function", function: {name: "banana"}}}}}}}}}, 1.44 + aPacket, 1.45 + { Object:Object, Array:Array }); 1.46 + gThreadClient.resume(function () { 1.47 + finishClient(gClient); 1.48 + }); 1.49 + }); 1.50 + 1.51 + gDebuggee.eval("\ 1.52 + function banana(x) { \n\ 1.53 + return function banana2(y) { \n\ 1.54 + return function banana3(z) { \n\ 1.55 + debugger; \n\ 1.56 + }; \n\ 1.57 + }; \n\ 1.58 + } \n\ 1.59 + banana('x')('y')('z'); \n\ 1.60 + "); 1.61 +}