We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c9fe83b commit 9d7257fCopy full SHA for 9d7257f
4 files changed
assets/panel/prefs.js
@@ -35,6 +35,7 @@ pref("devtools.debugger.expressions-visible", true);
35
pref("devtools.debugger.start-panel-collapsed", false);
36
pref("devtools.debugger.end-panel-collapsed", false);
37
pref("devtools.debugger.tabs", "[]");
38
+pref("devtools.debugger.tabsBlackBoxed", "[]");
39
pref("devtools.debugger.pending-selected-location", "{}");
40
pref("devtools.debugger.pending-breakpoints", "{}");
41
pref("devtools.debugger.expressions", "[]");
src/actions/sources/newSources.js
@@ -8,14 +8,15 @@
8
* Redux actions for the sources state
9
* @module actions/sources
10
*/
11
-
+import { toggleBlackBox } from "./blackbox";
12
import { syncBreakpoint } from "../breakpoints";
13
import { loadSourceText } from "./loadSourceText";
14
import { togglePrettyPrint } from "./prettyPrint";
15
import { selectLocation } from "../sources";
16
import { getRawSourceURL, isPrettyURL } from "../../utils/source";
17
18
import {
19
+ getBlackBoxList,
20
getSource,
21
getPendingSelectedLocation,
22
getPendingBreakpointsForSource
@@ -124,6 +125,20 @@ function checkPendingBreakpoints(sourceId: string) {
124
125
};
126
}
127
128
+function restoreBlackBoxedSources(sources: Source[]) {
129
+ return async ({ dispatch }: ThunkArgs) => {
130
+ const tabs = getBlackBoxList();
131
+ if (tabs.length == 0) {
132
+ return;
133
+ }
134
+ for (const source of sources) {
135
+ if (tabs.includes(source.url) && !source.isBlackBoxed) {
136
+ dispatch(toggleBlackBox(source));
137
138
139
+ };
140
+}
141
+
142
/**
143
* Handler for the debugger client's unsolicited newSource notification.
144
* @memberof actions/sources
@@ -155,8 +170,11 @@ export function newSources(sources: Source[]) {
155
170
dispatch(checkPendingBreakpoints(source.id));
156
171
157
172
158
- return Promise.all(
173
+ await Promise.all(
159
174
filteredSources.map(source => dispatch(loadSourceMap(source)))
160
175
);
176
+ // We would like to restore the blackboxed state
177
+ // after loading all states to make sure the correctness.
178
+ dispatch(restoreBlackBoxedSources(filteredSources));
161
179
162
180
src/reducers/sources.js
@@ -138,9 +138,12 @@ function update(
case "BLACKBOX":
if (action.status === "done") {
+ const url = action.source.url;
+ const isBlackBoxed = action.value.isBlackBoxed;
+ updateBlackBoxList(url, isBlackBoxed);
return state.setIn(
145
["sources", action.source.id, "isBlackBoxed"],
- action.value.isBlackBoxed
146
+ isBlackBoxed
147
148
149
break;
@@ -237,6 +240,23 @@ function updateTabList(state: OuterState, url: ?string, tabIndex?: number) {
237
240
return tabs;
238
241
239
242
243
+function updateBlackBoxList(url, isBlackBoxed) {
244
245
+ const i = tabs.indexOf(url);
246
+ if (i >= 0) {
247
+ if (!isBlackBoxed) {
248
+ tabs.splice(i, 1);
249
250
+ } else if (isBlackBoxed) {
251
+ tabs.push(url);
252
253
+ prefs.tabsBlackBoxed = tabs;
254
255
256
+export function getBlackBoxList() {
257
+ return prefs.tabsBlackBoxed || [];
258
259
260
261
* Gets the next tab to select when a tab closes. Heuristics:
262
* 1. if the selected tab is available, it remains selected
src/utils/prefs.js
@@ -25,6 +25,7 @@ if (isDevelopment()) {
25
26
27
28
+ pref("devtools.debugger.tabsBlackBoxed", "[]");
29
pref("devtools.debugger.ui.framework-grouping-on", true);
30
31
@@ -67,6 +68,7 @@ export const prefs = new PrefsHelper("devtools", {
67
68
endPanelCollapsed: ["Bool", "debugger.end-panel-collapsed"],
69
frameworkGroupingOn: ["Bool", "debugger.ui.framework-grouping-on"],
70
tabs: ["Json", "debugger.tabs", []],
71
+ tabsBlackBoxed: ["Json", "debugger.tabsBlackBoxed", []],
72
pendingSelectedLocation: ["Json", "debugger.pending-selected-location", {}],
73
pendingBreakpoints: ["Json", "debugger.pending-breakpoints", {}],
74
expressions: ["Json", "debugger.expressions", []],
0 commit comments