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

Commit

Permalink
Revert "Revert "[breakpoints] syncing when the breakpoint is removed … (
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonLaster committed Feb 20, 2018
1 parent fa58a03 commit 7e496bc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/client/firefox/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import type {
BPClients
} from "./types";

import { makeLocationId } from "../../utils/breakpoint";
import { makePendingLocationId } from "../../utils/breakpoint";

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

Expand Down Expand Up @@ -86,7 +86,7 @@ function sourceContents(sourceId: SourceId): Source {
}

function getBreakpointByLocation(location: Location) {
const id = makeLocationId(location);
const id = makePendingLocationId(location);
const bpClient = bpClients[id];

if (bpClient) {
Expand Down Expand Up @@ -121,7 +121,7 @@ function setBreakpoint(
})
.then(([{ actualLocation }, bpClient]) => {
actualLocation = createBreakpointLocation(location, actualLocation);
const id = makeLocationId(actualLocation);
const id = makePendingLocationId(actualLocation);
bpClients[id] = bpClient;
bpClient.location.line = actualLocation.line;
bpClient.location.column = actualLocation.column;
Expand All @@ -135,7 +135,7 @@ function removeBreakpoint(
generatedLocation: Location
): Promise<void> | ?BreakpointResult {
try {
const id = makeLocationId(generatedLocation);
const id = makePendingLocationId(generatedLocation);
const bpClient = bpClients[id];
if (!bpClient) {
console.warn("No breakpoint to delete on server");
Expand Down
4 changes: 4 additions & 0 deletions src/reducers/breakpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ function update(
case "REMAP_BREAKPOINTS": {
return remapBreakpoints(state, action);
}

case "NAVIGATE": {
return initialState();
}
}

return state;
Expand Down
7 changes: 7 additions & 0 deletions src/test/mochitest/browser_dbg-sourcemaps-reloading.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */

async function waitForBreakpointCount(dbg, count) {
return waitForState(dbg, state => dbg.selectors.getBreakpoints(state).size === count)
}

add_task(async function() {
// NOTE: the CORS call makes the test run times inconsistent
requestLongerTimeout(2);
Expand All @@ -22,12 +26,14 @@ add_task(async function() {
// should not move anywhere.
await addBreakpoint(dbg, entrySrc, 13);
is(getBreakpoints(getState()).size, 1, "One breakpoint exists");

ok(
getBreakpoint(getState(), { sourceId: entrySrc.id, line: 13 }),
"Breakpoint has correct line"
);

await addBreakpoint(dbg, entrySrc, 5);

await addBreakpoint(dbg, entrySrc, 15);
await disableBreakpoint(dbg, entrySrc, 15);

Expand All @@ -38,6 +44,7 @@ add_task(async function() {
await waitForPaused(dbg);
assertPausedLocation(dbg);

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

ok(
Expand Down

0 comments on commit 7e496bc

Please sign in to comment.