1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/devtools/server/tests/unit/test_breakpoint-15.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 +/** 1.8 + * Check that adding a breakpoint in the same place returns the same actor. 1.9 + */ 1.10 + 1.11 +var gDebuggee; 1.12 +var gClient; 1.13 +var gThreadClient; 1.14 + 1.15 +function run_test() 1.16 +{ 1.17 + initTestDebuggerServer(); 1.18 + gDebuggee = addTestGlobal("test-stack"); 1.19 + gClient = new DebuggerClient(DebuggerServer.connectPipe()); 1.20 + gClient.connect(function () { 1.21 + attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { 1.22 + gThreadClient = aThreadClient; 1.23 + test_same_breakpoint(); 1.24 + }); 1.25 + }); 1.26 + do_test_pending(); 1.27 +} 1.28 + 1.29 +function test_same_breakpoint() 1.30 +{ 1.31 + gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { 1.32 + let path = getFilePath('test_breakpoint-01.js'); 1.33 + let location = { 1.34 + url: path, 1.35 + line: gDebuggee.line0 + 3 1.36 + }; 1.37 + gThreadClient.setBreakpoint(location, function (aResponse, bpClient) { 1.38 + gThreadClient.setBreakpoint(location, function (aResponse, secondBpClient) { 1.39 + do_check_eq(bpClient.actor, secondBpClient.actor, 1.40 + "Should get the same actor w/ whole line breakpoints"); 1.41 + let location = { 1.42 + url: path, 1.43 + line: gDebuggee.line0 + 2, 1.44 + column: 6 1.45 + }; 1.46 + gThreadClient.setBreakpoint(location, function (aResponse, bpClient) { 1.47 + gThreadClient.setBreakpoint(location, function (aResponse, secondBpClient) { 1.48 + do_check_eq(bpClient.actor, secondBpClient.actor, 1.49 + "Should get the same actor column breakpoints"); 1.50 + finishClient(gClient); 1.51 + }); 1.52 + }); 1.53 + }); 1.54 + }); 1.55 + 1.56 + }); 1.57 + 1.58 + Components.utils.evalInSandbox("var line0 = Error().lineNumber;\n" + 1.59 + "debugger;\n" + // line0 + 1 1.60 + "var a = 1;\n" + // line0 + 2 1.61 + "var b = 2;\n", // line0 + 3 1.62 + gDebuggee); 1.63 +}