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

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:5c5ed82ddb06
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 var gDebuggee;
5 var gClient;
6 var gThreadClient;
7
8 function run_test()
9 {
10 initTestDebuggerServer();
11 gDebuggee = addTestGlobal("test-grips");
12 gDebuggee.eval(function stopMe(arg1) {
13 debugger;
14 }.toString());
15
16 gClient = new DebuggerClient(DebuggerServer.connectPipe());
17 gClient.connect(function() {
18 attachTestTabAndResume(
19 gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) {
20 gThreadClient = aThreadClient;
21 test_longstring_grip();
22 });
23 });
24 do_test_pending();
25 }
26
27 function test_longstring_grip()
28 {
29 DebuggerServer.LONG_STRING_LENGTH = 200;
30
31 gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) {
32 try {
33 let fakeLongStringGrip = {
34 type: "longString",
35 length: 1000000,
36 actor: "123fakeActor123",
37 initial: ""
38 };
39 let longStringClient = gThreadClient.pauseLongString(fakeLongStringGrip);
40 longStringClient.substring(22, 28, function (aResponse) {
41 try {
42 do_check_true(!!aResponse.error,
43 "We should not get a response, but an error.");
44 } finally {
45 gThreadClient.resume(function() {
46 finishClient(gClient);
47 });
48 }
49 });
50 } catch(error) {
51 gThreadClient.resume(function() {
52 finishClient(gClient);
53 do_throw(error);
54 });
55 }
56 });
57
58 gDebuggee.eval('stopMe()');
59 }
60

mercurial