toolkit/devtools/server/tests/unit/test_pause_exceptions-02.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:f710ae9a9772
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 /**
5 * Test that setting pauseOnExceptions to true when the debugger isn't in a
6 * paused state will cause the debuggee to pause when an exceptions is thrown.
7 */
8
9 var gDebuggee;
10 var gClient;
11 var gThreadClient;
12
13 function run_test()
14 {
15 initTestDebuggerServer();
16 gDebuggee = addTestGlobal("test-stack");
17 gClient = new DebuggerClient(DebuggerServer.connectPipe());
18 gClient.connect(function() {
19 attachTestTabAndResume(gClient, "test-stack", function(aResponse, aTabClient, aThreadClient) {
20 gThreadClient = aThreadClient;
21 test_pause_frame();
22 });
23 });
24 do_test_pending();
25 }
26
27 function test_pause_frame()
28 {
29 gThreadClient.pauseOnExceptions(true, false, function () {
30 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
31 do_check_eq(aPacket.why.type, "exception");
32 do_check_eq(aPacket.why.exception, 42);
33 gThreadClient.resume(function () {
34 finishClient(gClient);
35 });
36 });
37
38 gDebuggee.eval("(" + function() {
39 function stopMe() {
40 throw 42;
41 };
42 try {
43 stopMe();
44 } catch (e) {}
45 } + ")()");
46 });
47 }

mercurial