michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: /** michael@0: * Check that adding a breakpoint in the same place returns the same actor. michael@0: */ michael@0: michael@0: var gDebuggee; michael@0: var gClient; michael@0: var gThreadClient; michael@0: michael@0: function run_test() michael@0: { michael@0: initTestDebuggerServer(); michael@0: gDebuggee = addTestGlobal("test-stack"); michael@0: gClient = new DebuggerClient(DebuggerServer.connectPipe()); michael@0: gClient.connect(function () { michael@0: attachTestTabAndResume(gClient, "test-stack", function (aResponse, aTabClient, aThreadClient) { michael@0: gThreadClient = aThreadClient; michael@0: test_same_breakpoint(); michael@0: }); michael@0: }); michael@0: do_test_pending(); michael@0: } michael@0: michael@0: function test_same_breakpoint() michael@0: { michael@0: gThreadClient.addOneTimeListener("paused", function (aEvent, aPacket) { michael@0: let path = getFilePath('test_breakpoint-01.js'); michael@0: let location = { michael@0: url: path, michael@0: line: gDebuggee.line0 + 3 michael@0: }; michael@0: gThreadClient.setBreakpoint(location, function (aResponse, bpClient) { michael@0: gThreadClient.setBreakpoint(location, function (aResponse, secondBpClient) { michael@0: do_check_eq(bpClient.actor, secondBpClient.actor, michael@0: "Should get the same actor w/ whole line breakpoints"); michael@0: let location = { michael@0: url: path, michael@0: line: gDebuggee.line0 + 2, michael@0: column: 6 michael@0: }; michael@0: gThreadClient.setBreakpoint(location, function (aResponse, bpClient) { michael@0: gThreadClient.setBreakpoint(location, function (aResponse, secondBpClient) { michael@0: do_check_eq(bpClient.actor, secondBpClient.actor, michael@0: "Should get the same actor column breakpoints"); michael@0: finishClient(gClient); michael@0: }); michael@0: }); michael@0: }); michael@0: }); michael@0: michael@0: }); michael@0: michael@0: Components.utils.evalInSandbox("var line0 = Error().lineNumber;\n" + michael@0: "debugger;\n" + // line0 + 1 michael@0: "var a = 1;\n" + // line0 + 2 michael@0: "var b = 2;\n", // line0 + 3 michael@0: gDebuggee); michael@0: }