1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/devtools/server/tests/unit/test_longstringgrips-02.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 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 + gDebuggee.eval(function stopMe(arg1) { 1.16 + debugger; 1.17 + }.toString()); 1.18 + 1.19 + gClient = new DebuggerClient(DebuggerServer.connectPipe()); 1.20 + gClient.connect(function() { 1.21 + attachTestTabAndResume( 1.22 + gClient, "test-grips", function(aResponse, aTabClient, aThreadClient) { 1.23 + gThreadClient = aThreadClient; 1.24 + test_longstring_grip(); 1.25 + }); 1.26 + }); 1.27 + do_test_pending(); 1.28 +} 1.29 + 1.30 +function test_longstring_grip() 1.31 +{ 1.32 + DebuggerServer.LONG_STRING_LENGTH = 200; 1.33 + 1.34 + gThreadClient.addOneTimeListener("paused", function(aEvent, aPacket) { 1.35 + try { 1.36 + let fakeLongStringGrip = { 1.37 + type: "longString", 1.38 + length: 1000000, 1.39 + actor: "123fakeActor123", 1.40 + initial: "" 1.41 + }; 1.42 + let longStringClient = gThreadClient.pauseLongString(fakeLongStringGrip); 1.43 + longStringClient.substring(22, 28, function (aResponse) { 1.44 + try { 1.45 + do_check_true(!!aResponse.error, 1.46 + "We should not get a response, but an error."); 1.47 + } finally { 1.48 + gThreadClient.resume(function() { 1.49 + finishClient(gClient); 1.50 + }); 1.51 + } 1.52 + }); 1.53 + } catch(error) { 1.54 + gThreadClient.resume(function() { 1.55 + finishClient(gClient); 1.56 + do_throw(error); 1.57 + }); 1.58 + } 1.59 + }); 1.60 + 1.61 + gDebuggee.eval('stopMe()'); 1.62 +} 1.63 +