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

Commit d805414

Browse files
committed
Support pausing immediately (#5076)
1 parent fb74a2c commit d805414

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

src/actions/navigation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ export function willNavigate(_: any, event: Object) {
4141
clearASTs();
4242
clearScopes();
4343
clearSources();
44-
sourceQueue.clear();
45-
4644
dispatch(navigate(event.url));
4745
};
4846
}
4947

5048
export function navigate(url: string) {
49+
sourceQueue.clear();
50+
5151
return {
5252
type: "NAVIGATE",
5353
url

src/client/firefox/events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ async function paused(_: "paused", packet: PausedPacket) {
6161

6262
if (why.type != "alreadyPaused") {
6363
const pause = createPause(packet, response);
64-
sourceQueue.flush();
64+
await sourceQueue.flush();
6565
actions.paused(pause);
6666
}
6767
}

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@ add_task(async function() {
2727
"Breakpoint has correct line"
2828
);
2929

30+
await addBreakpoint(dbg, entrySrc, 5);
3031
await addBreakpoint(dbg, entrySrc, 15);
3132
await disableBreakpoint(dbg, entrySrc, 15);
3233

3334
// Test reloading the debugger
3435
await reload(dbg, "opts.js");
3536
await waitForDispatch(dbg, "LOAD_SOURCE_TEXT");
3637

37-
is(getBreakpoints(getState()).size, 2, "One breakpoint exists");
38+
await waitForPaused(dbg);
39+
assertPausedLocation(dbg);
40+
41+
is(getBreakpoints(getState()).size, 3, "Three breakpoints exist");
3842

3943
ok(
4044
getBreakpoint(getState(), { sourceId: entrySrc.id, line: 13 }),

src/utils/source-queue.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@ import { throttle } from "lodash";
22

33
let newSources;
44
let createSource;
5-
let queuedSources;
65
let supportsWasm = false;
6+
let queuedSources;
77

8-
const queue = throttle(() => {
9-
if (!newSources || !createSource) {
10-
return;
11-
}
12-
newSources(
13-
queuedSources.map(source => {
14-
return createSource(source, { supportsWasm });
15-
})
16-
);
8+
async function dispatchNewSources() {
9+
const sources = queuedSources;
1710
queuedSources = [];
18-
}, 100);
11+
12+
await newSources(
13+
sources.map(source => createSource(source, { supportsWasm }))
14+
);
15+
}
16+
17+
const queue = throttle(dispatchNewSources, 100);
1918

2019
export default {
2120
initialize: options => {

0 commit comments

Comments
 (0)