Skip to content

Commit e79b8f1

Browse files
jasonLasterbomsy
authored andcommitted
[breakpoints] syncing when the breakpoint is removed (firefox-devtools#5176)
1 parent b5bb064 commit e79b8f1

3 files changed

Lines changed: 12 additions & 9 deletions

File tree

src/client/firefox/commands.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import type {
2525
BPClients
2626
} from "./types";
2727

28-
import { makeLocationId } from "../../utils/breakpoint";
28+
import { makePendingLocationId } from "../../utils/breakpoint";
2929

3030
import { createSource, createBreakpointLocation } from "./create";
3131

@@ -86,7 +86,7 @@ function sourceContents(sourceId: SourceId): Source {
8686
}
8787

8888
function getBreakpointByLocation(location: Location) {
89-
const id = makeLocationId(location);
89+
const id = makePendingLocationId(location);
9090
const bpClient = bpClients[id];
9191

9292
if (bpClient) {
@@ -121,7 +121,7 @@ function setBreakpoint(
121121
})
122122
.then(([{ actualLocation }, bpClient]) => {
123123
actualLocation = createBreakpointLocation(location, actualLocation);
124-
const id = makeLocationId(actualLocation);
124+
const id = makePendingLocationId(actualLocation);
125125
bpClients[id] = bpClient;
126126
bpClient.location.line = actualLocation.line;
127127
bpClient.location.column = actualLocation.column;
@@ -135,7 +135,7 @@ function removeBreakpoint(
135135
generatedLocation: Location
136136
): Promise<void> | ?BreakpointResult {
137137
try {
138-
const id = makeLocationId(generatedLocation);
138+
const id = makePendingLocationId(generatedLocation);
139139
const bpClient = bpClients[id];
140140
if (!bpClient) {
141141
console.warn("No breakpoint to delete on server");

src/reducers/breakpoints.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,10 @@ function update(
6666
case "REMAP_BREAKPOINTS": {
6767
return remapBreakpoints(state, action);
6868
}
69+
70+
case "NAVIGATE": {
71+
return initialState();
72+
}
6973
}
7074

7175
return state;

src/test/mochitest/browser_dbg-sourcemaps-reload.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ add_task(async function() {
3434
let breakpoint = getBreakpoints(dbg)[0];
3535
is(breakpoint.location.line, 6);
3636

37-
let syncBp = waitForDispatch(dbg, "SYNC_BREAKPOINT")
37+
let syncBp = waitForDispatch(dbg, "SYNC_BREAKPOINT");
3838
await reload(dbg);
3939

4040
await waitForPaused(dbg);
@@ -46,14 +46,13 @@ add_task(async function() {
4646
is(breakpoint.generatedLocation.line, 73);
4747

4848
await resume(dbg);
49+
syncBp = waitForDispatch(dbg, "SYNC_BREAKPOINT", 2)
50+
await selectSource(dbg, "v1");
51+
await addBreakpoint(dbg, "v1", 13);
4952

50-
syncBp = waitForDispatch(dbg, "SYNC_BREAKPOINT")
5153
await reload(dbg);
52-
5354
await waitForSource(dbg, "v1");
5455
await syncBp;
55-
56-
await selectSource(dbg, "v1")
5756
await waitForSelectedSource(dbg, "v1");
5857

5958
is(getBreakpoints(dbg).length, 0, "No breakpoints")

0 commit comments

Comments
 (0)