Skip to content
This repository was archived by the owner on Jan 11, 2023. It is now read-only.

Commit 7e496bc

Browse files
committed
Revert "Revert "[breakpoints] syncing when the breakpoint is removed … (#5232)
1 parent fa58a03 commit 7e496bc

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

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-reloading.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
/* Any copyright is dedicated to the Public Domain.
22
* http://creativecommons.org/publicdomain/zero/1.0/ */
33

4+
async function waitForBreakpointCount(dbg, count) {
5+
return waitForState(dbg, state => dbg.selectors.getBreakpoints(state).size === count)
6+
}
7+
48
add_task(async function() {
59
// NOTE: the CORS call makes the test run times inconsistent
610
requestLongerTimeout(2);
@@ -22,12 +26,14 @@ add_task(async function() {
2226
// should not move anywhere.
2327
await addBreakpoint(dbg, entrySrc, 13);
2428
is(getBreakpoints(getState()).size, 1, "One breakpoint exists");
29+
2530
ok(
2631
getBreakpoint(getState(), { sourceId: entrySrc.id, line: 13 }),
2732
"Breakpoint has correct line"
2833
);
2934

3035
await addBreakpoint(dbg, entrySrc, 5);
36+
3137
await addBreakpoint(dbg, entrySrc, 15);
3238
await disableBreakpoint(dbg, entrySrc, 15);
3339

@@ -38,6 +44,7 @@ add_task(async function() {
3844
await waitForPaused(dbg);
3945
assertPausedLocation(dbg);
4046

47+
await waitForBreakpointCount(dbg, 3);
4148
is(getBreakpoints(getState()).size, 3, "Three breakpoints exist");
4249

4350
ok(

0 commit comments

Comments
 (0)