1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/devtools/server/tests/unit/test_frameclient-02.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 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-stack"); 1.15 + gClient = new DebuggerClient(DebuggerServer.connectPipe()); 1.16 + gClient.connect(function() { 1.17 + attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) { 1.18 + gThreadClient = aThreadClient; 1.19 + test_pause_frame(); 1.20 + }); 1.21 + }); 1.22 + do_test_pending(); 1.23 +} 1.24 + 1.25 +function test_pause_frame() 1.26 +{ 1.27 + gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { 1.28 + // Ask for exactly the number of frames we expect. 1.29 + gThreadClient.addOneTimeListener("framesadded", function() { 1.30 + do_check_false(gThreadClient.moreFrames); 1.31 + gThreadClient.resume(function() { 1.32 + finishClient(gClient); 1.33 + }); 1.34 + }); 1.35 + do_check_true(gThreadClient.fillFrames(3)); 1.36 + }); 1.37 + 1.38 + gDebuggee.eval("(" + function() { 1.39 + var recurseLeft = 1; 1.40 + function recurse() { 1.41 + if (--recurseLeft == 0) { 1.42 + debugger; 1.43 + return; 1.44 + } 1.45 + recurse(); 1.46 + }; 1.47 + recurse(); 1.48 + } + ")()"); 1.49 +}