From bc07f56597878b6fcdb71bad2ffacda07e92b5f3 Mon Sep 17 00:00:00 2001 From: Jason Laster Date: Tue, 23 Jan 2018 19:51:42 -0500 Subject: [PATCH] [breakpoints] syncing when the breakpoint is removed --- src/client/firefox/commands.js | 8 ++++---- src/reducers/breakpoints.js | 4 ++++ src/test/mochitest/browser_dbg-sourcemaps-reload.js | 9 ++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/client/firefox/commands.js b/src/client/firefox/commands.js index ceef74ffcb..4b5440cb16 100644 --- a/src/client/firefox/commands.js +++ b/src/client/firefox/commands.js @@ -25,7 +25,7 @@ import type { BPClients } from "./types"; -import { makeLocationId } from "../../utils/breakpoint"; +import { makePendingLocationId } from "../../utils/breakpoint"; import { createSource, createBreakpointLocation } from "./create"; @@ -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) { @@ -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; @@ -135,7 +135,7 @@ function removeBreakpoint( generatedLocation: Location ): Promise | ?BreakpointResult { try { - const id = makeLocationId(generatedLocation); + const id = makePendingLocationId(generatedLocation); const bpClient = bpClients[id]; if (!bpClient) { console.warn("No breakpoint to delete on server"); diff --git a/src/reducers/breakpoints.js b/src/reducers/breakpoints.js index 206215144a..22e3774440 100644 --- a/src/reducers/breakpoints.js +++ b/src/reducers/breakpoints.js @@ -66,6 +66,10 @@ function update( case "REMAP_BREAKPOINTS": { return remapBreakpoints(state, action); } + + case "NAVIGATE": { + return initialState(); + } } return state; diff --git a/src/test/mochitest/browser_dbg-sourcemaps-reload.js b/src/test/mochitest/browser_dbg-sourcemaps-reload.js index c0c607cba2..cc7a3dfb88 100644 --- a/src/test/mochitest/browser_dbg-sourcemaps-reload.js +++ b/src/test/mochitest/browser_dbg-sourcemaps-reload.js @@ -34,7 +34,7 @@ add_task(async function() { let breakpoint = getBreakpoints(dbg)[0]; is(breakpoint.location.line, 6); - let syncBp = waitForDispatch(dbg, "SYNC_BREAKPOINT") + let syncBp = waitForDispatch(dbg, "SYNC_BREAKPOINT"); await reload(dbg); await waitForPaused(dbg); @@ -46,14 +46,13 @@ add_task(async function() { is(breakpoint.generatedLocation.line, 73); await resume(dbg); + syncBp = waitForDispatch(dbg, "SYNC_BREAKPOINT", 2) + await selectSource(dbg, "v1"); + await addBreakpoint(dbg, "v1", 13); - syncBp = waitForDispatch(dbg, "SYNC_BREAKPOINT") await reload(dbg); - await waitForSource(dbg, "v1"); await syncBp; - - await selectSource(dbg, "v1") await waitForSelectedSource(dbg, "v1"); is(getBreakpoints(dbg).length, 0, "No breakpoints")