зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1440093
- Breakpoints at the end of a line are missed. r=jimb
This commit is contained in:
Родитель
b741bb7d3c
Коммит
134c4753f6
|
@ -928,14 +928,20 @@ let SourceActor = ActorClassWithSpec(sourceSpec, {
|
|||
}
|
||||
}
|
||||
|
||||
// If we don't find any matching entrypoints, then
|
||||
// we should check to see if the breakpoint is to the left of the first offset.
|
||||
// If we don't find any matching entrypoints,
|
||||
// then we should see if the breakpoint comes before or after the column offsets.
|
||||
if (entryPoints.length === 0) {
|
||||
for (let [script, columnToOffsetMap] of columnToOffsetMaps) {
|
||||
if (columnToOffsetMap.length > 0) {
|
||||
let { columnNumber: column, offset } = columnToOffsetMap[0];
|
||||
if (generatedColumn < column) {
|
||||
entryPoints.push({ script, offsets: [offset] });
|
||||
const firstColumnOffset = columnToOffsetMap[0];
|
||||
const lastColumnOffset = columnToOffsetMap[columnToOffsetMap.length - 1];
|
||||
|
||||
if (generatedColumn < firstColumnOffset.columnNumber) {
|
||||
entryPoints.push({ script, offsets: [firstColumnOffset.offset] });
|
||||
}
|
||||
|
||||
if (generatedColumn > lastColumnOffset.columnNumber) {
|
||||
entryPoints.push({ script, offsets: [lastColumnOffset.offset] });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
function f() {
|
||||
var a = 1; var b = 2;
|
||||
var c = 3;
|
||||
}
|
|
@ -2,63 +2,58 @@
|
|||
|
||||
var SOURCE_URL = getFileUrl("setBreakpoint-on-column.js");
|
||||
|
||||
function run_test() {
|
||||
return async function () {
|
||||
do_test_pending();
|
||||
async function run_test() {
|
||||
do_test_pending();
|
||||
DebuggerServer.registerModule("xpcshell-test/testactors");
|
||||
DebuggerServer.init(() => true);
|
||||
let global = createTestGlobal("test");
|
||||
DebuggerServer.addTestGlobal(global);
|
||||
|
||||
DebuggerServer.registerModule("xpcshell-test/testactors");
|
||||
DebuggerServer.init(() => true);
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await connect(client);
|
||||
|
||||
let global = createTestGlobal("test");
|
||||
DebuggerServer.addTestGlobal(global);
|
||||
let { tabs } = await listTabs(client);
|
||||
let tab = findTab(tabs, "test");
|
||||
let [, tabClient] = await attachTab(client, tab);
|
||||
let [, threadClient] = await attachThread(tabClient);
|
||||
await resume(threadClient);
|
||||
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await connect(client);
|
||||
let promise = waitForNewSource(threadClient, SOURCE_URL);
|
||||
loadSubScript(SOURCE_URL, global);
|
||||
let { source } = await promise;
|
||||
let sourceClient = threadClient.source(source);
|
||||
|
||||
let { tabs } = await listTabs(client);
|
||||
let tab = findTab(tabs, "test");
|
||||
let [, tabClient] = await attachTab(client, tab);
|
||||
let [, threadClient] = await attachThread(tabClient);
|
||||
await resume(threadClient);
|
||||
let location = { line: 4, column: 2 };
|
||||
let [packet, breakpointClient] = await setBreakpoint(
|
||||
sourceClient,
|
||||
location
|
||||
);
|
||||
|
||||
let promise = waitForNewSource(threadClient, SOURCE_URL);
|
||||
loadSubScript(SOURCE_URL, global);
|
||||
let { source } = await promise;
|
||||
let sourceClient = threadClient.source(source);
|
||||
Assert.ok(!packet.isPending);
|
||||
Assert.equal(false, "actualLocation" in packet);
|
||||
|
||||
let location = { line: 4, column: 2 };
|
||||
let [packet, breakpointClient] = await setBreakpoint(
|
||||
sourceClient,
|
||||
location
|
||||
);
|
||||
packet = await executeOnNextTickAndWaitForPause(function () {
|
||||
Cu.evalInSandbox("f()", global);
|
||||
}, client);
|
||||
|
||||
Assert.ok(!packet.isPending);
|
||||
Assert.equal(false, "actualLocation" in packet);
|
||||
Assert.equal(packet.type, "paused");
|
||||
let why = packet.why;
|
||||
Assert.equal(why.type, "breakpoint");
|
||||
Assert.equal(why.actors.length, 1);
|
||||
Assert.equal(why.actors[0], breakpointClient.actor);
|
||||
|
||||
packet = await executeOnNextTickAndWaitForPause(function () {
|
||||
Cu.evalInSandbox("f()", global);
|
||||
}, client);
|
||||
let frame = packet.frame;
|
||||
let where = frame.where;
|
||||
Assert.equal(where.source.actor, source.actor);
|
||||
Assert.equal(where.line, location.line);
|
||||
Assert.equal(where.column, 6);
|
||||
|
||||
Assert.equal(packet.type, "paused");
|
||||
let why = packet.why;
|
||||
Assert.equal(why.type, "breakpoint");
|
||||
Assert.equal(why.actors.length, 1);
|
||||
Assert.equal(why.actors[0], breakpointClient.actor);
|
||||
let variables = frame.environment.bindings.variables;
|
||||
Assert.equal(variables.a.value.type, "undefined");
|
||||
Assert.equal(variables.b.value.type, "undefined");
|
||||
Assert.equal(variables.c.value.type, "undefined");
|
||||
|
||||
let frame = packet.frame;
|
||||
let where = frame.where;
|
||||
Assert.equal(where.source.actor, source.actor);
|
||||
Assert.equal(where.line, location.line);
|
||||
Assert.equal(where.column, 6);
|
||||
|
||||
let variables = frame.environment.bindings.variables;
|
||||
Assert.equal(variables.a.value.type, "undefined");
|
||||
Assert.equal(variables.b.value.type, "undefined");
|
||||
Assert.equal(variables.c.value.type, "undefined");
|
||||
|
||||
await resume(threadClient);
|
||||
await close(client);
|
||||
|
||||
do_test_finished();
|
||||
};
|
||||
await resume(threadClient);
|
||||
await close(client);
|
||||
do_test_finished();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,62 @@
|
|||
"use strict";
|
||||
|
||||
var SOURCE_URL = getFileUrl("setBreakpoint-on-column.js");
|
||||
|
||||
async function run_test() {
|
||||
do_test_pending();
|
||||
|
||||
DebuggerServer.registerModule("xpcshell-test/testactors");
|
||||
DebuggerServer.init(() => true);
|
||||
|
||||
let global = createTestGlobal("test");
|
||||
DebuggerServer.addTestGlobal(global);
|
||||
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await connect(client);
|
||||
|
||||
let { tabs } = await listTabs(client);
|
||||
let tab = findTab(tabs, "test");
|
||||
let [, tabClient] = await attachTab(client, tab);
|
||||
let [, threadClient] = await attachThread(tabClient);
|
||||
await resume(threadClient);
|
||||
|
||||
let promise = waitForNewSource(threadClient, SOURCE_URL);
|
||||
loadSubScript(SOURCE_URL, global);
|
||||
let { source } = await promise;
|
||||
let sourceClient = threadClient.source(source);
|
||||
|
||||
let location = { line: 4, column: 42 };
|
||||
let [packet, breakpointClient] = await setBreakpoint(
|
||||
sourceClient,
|
||||
location
|
||||
);
|
||||
|
||||
Assert.ok(!packet.isPending);
|
||||
Assert.equal(false, "actualLocation" in packet);
|
||||
|
||||
packet = await executeOnNextTickAndWaitForPause(function () {
|
||||
Cu.evalInSandbox("f()", global);
|
||||
}, client);
|
||||
|
||||
Assert.equal(packet.type, "paused");
|
||||
let why = packet.why;
|
||||
Assert.equal(why.type, "breakpoint");
|
||||
Assert.equal(why.actors.length, 1);
|
||||
Assert.equal(why.actors[0], breakpointClient.actor);
|
||||
|
||||
let frame = packet.frame;
|
||||
let where = frame.where;
|
||||
Assert.equal(where.source.actor, source.actor);
|
||||
Assert.equal(where.line, location.line);
|
||||
Assert.equal(where.column, 28);
|
||||
|
||||
let variables = frame.environment.bindings.variables;
|
||||
Assert.equal(variables.a.value, 1);
|
||||
Assert.equal(variables.b.value, 2);
|
||||
Assert.equal(variables.c.value.type, "undefined");
|
||||
|
||||
await resume(threadClient);
|
||||
await close(client);
|
||||
|
||||
do_test_finished();
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
"use strict";
|
||||
|
||||
var SOURCE_URL = getFileUrl("setBreakpoint-on-column-with-no-offsets-at-end-of-line.js");
|
||||
|
||||
function run_test() {
|
||||
return (async function () {
|
||||
do_test_pending();
|
||||
|
||||
DebuggerServer.registerModule("xpcshell-test/testactors");
|
||||
DebuggerServer.init(() => true);
|
||||
|
||||
let global = createTestGlobal("test");
|
||||
DebuggerServer.addTestGlobal(global);
|
||||
|
||||
let client = new DebuggerClient(DebuggerServer.connectPipe());
|
||||
await connect(client);
|
||||
|
||||
let { tabs } = await listTabs(client);
|
||||
let tab = findTab(tabs, "test");
|
||||
let [, tabClient] = await attachTab(client, tab);
|
||||
let [, threadClient] = await attachThread(tabClient);
|
||||
await resume(threadClient);
|
||||
|
||||
let promise = waitForNewSource(threadClient, SOURCE_URL);
|
||||
loadSubScript(SOURCE_URL, global);
|
||||
let { source } = await promise;
|
||||
let sourceClient = threadClient.source(source);
|
||||
|
||||
let location = { line: 4, column: 23 };
|
||||
let [packet, ] = await setBreakpoint(sourceClient, location);
|
||||
Assert.ok(packet.isPending);
|
||||
Assert.equal(false, "actualLocation" in packet);
|
||||
|
||||
Cu.evalInSandbox("f()", global);
|
||||
await close(client);
|
||||
|
||||
do_test_finished();
|
||||
})();
|
||||
}
|
|
@ -21,7 +21,6 @@ support-files =
|
|||
setBreakpoint-on-column.js
|
||||
setBreakpoint-on-column-in-gcd-script.js
|
||||
setBreakpoint-on-column-with-no-offsets.js
|
||||
setBreakpoint-on-column-with-no-offsets-at-end-of-line.js
|
||||
setBreakpoint-on-column-with-no-offsets-in-gcd-script.js
|
||||
setBreakpoint-on-line.js
|
||||
setBreakpoint-on-line-in-gcd-script.js
|
||||
|
@ -223,9 +222,9 @@ reason = bug 937197
|
|||
[test_xpcshell_debugging.js]
|
||||
support-files = xpcshell_debugging_script.js
|
||||
[test_setBreakpoint-at-the-beginning-of-a-line.js]
|
||||
[test_setBreakpoint-at-the-end-of-a-line.js]
|
||||
[test_setBreakpoint-on-column.js]
|
||||
[test_setBreakpoint-on-column-in-gcd-script.js]
|
||||
[test_setBreakpoint-on-column-with-no-offsets-at-end-of-line.js]
|
||||
[test_setBreakpoint-on-line.js]
|
||||
[test_setBreakpoint-on-line-in-gcd-script.js]
|
||||
[test_setBreakpoint-on-line-with-multiple-offsets.js]
|
||||
|
|
Загрузка…
Ссылка в новой задаче