1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
// Test that we show a breakpoint in the UI when there is an old pending
// breakpoint with an invalid original location.
"use strict";
add_task(async function () {
clearDebuggerPreferences();
const pending = {
bp1: {
location: {
sourceId: "",
sourceUrl: `${EXAMPLE_URL}nowhere2.js`,
line: 5,
column: 0,
},
generatedLocation: {
sourceUrl: `${EXAMPLE_URL}simple1.js`,
line: 4,
column: 0,
},
options: {},
disabled: false,
},
bp2: {
location: {
sourceId: "",
sourceUrl: `${EXAMPLE_URL}nowhere.js`,
line: 5,
column: 0,
},
generatedLocation: {
sourceUrl: `${EXAMPLE_URL}simple3.js`,
line: 2,
column: 0,
},
options: {},
disabled: false,
},
};
asyncStorage.setItem("debugger.pending-breakpoints", pending);
const toolbox = await openNewTabAndToolbox(
`${EXAMPLE_URL}doc-scripts.html`,
"jsdebugger"
);
const dbg = createDebuggerContext(toolbox);
const onBreakpoint = waitForDispatch(dbg.store, "SET_BREAKPOINT", 2);
// Pending breakpoints are installed asynchronously, keep invoking the entry
// function until the debugger pauses.
await waitUntil(() => {
invokeInTab("main");
return isPaused(dbg);
});
await onBreakpoint;
ok(true, "paused at unmapped breakpoint");
await waitForState(
dbg,
state => dbg.selectors.getBreakpointCount(state) == 2
);
ok(true, "unmapped breakpoints shown in UI");
});
// Test that if we show a breakpoint with an old generated location, it is
// removed after we load the original source and find the new generated
// location.
add_task(async function () {
clearDebuggerPreferences();
const pending = {
bp1: {
location: {
sourceId: "",
sourceUrl: "webpack:///entry.js",
line: 15,
column: 0,
},
generatedLocation: {
sourceUrl: `${EXAMPLE_URL}sourcemaps/bundle.js`,
line: 47,
column: 16,
},
options: {},
disabled: false,
},
};
asyncStorage.setItem("debugger.pending-breakpoints", pending);
const toolbox = await openNewTabAndToolbox(
`${EXAMPLE_URL}doc-sourcemaps.html`,
"jsdebugger"
);
const dbg = createDebuggerContext(toolbox);
await waitForState(dbg, state => {
const bps = dbg.selectors.getBreakpointsList(state);
return (
bps.length == 1 &&
bps[0].location.source.url.includes("entry.js") &&
bps[0].location.line == 15
);
});
ok(true, "removed old breakpoint during sync");
await waitForRequestsToSettle(dbg);
});
|