Bug 1717739 - Ensure waiting for all breakpoint to be set while loading the debugger. r=nchevobbe

This will prevent these pending request during toolbox shutdown highlighted in browser_keybindings_01.js.

Differential Revision: https://phabricator.services.mozilla.com/D119393
This commit is contained in:
Alexandre Poirot 2021-07-08 16:40:41 +00:00
Родитель 1d0551a941
Коммит a8b63322a6
1 изменённых файлов: 15 добавлений и 12 удалений

Просмотреть файл

@ -21,26 +21,29 @@ import { initialSourcesState } from "./reducers/sources";
async function syncBreakpoints() { async function syncBreakpoints() {
const breakpoints = await asyncStore.pendingBreakpoints; const breakpoints = await asyncStore.pendingBreakpoints;
const breakpointValues = Object.values(breakpoints); const breakpointValues = Object.values(breakpoints);
breakpointValues.forEach(({ disabled, options, generatedLocation }) => { return Promise.all(
if (!disabled) { breakpointValues.map(({ disabled, options, generatedLocation }) => {
firefox.clientCommands.setBreakpoint(generatedLocation, options); if (!disabled) {
} return firefox.clientCommands.setBreakpoint(generatedLocation, options);
}); }
})
);
} }
function syncXHRBreakpoints() { async function syncXHRBreakpoints() {
asyncStore.xhrBreakpoints.then(bps => { const breakpoints = await asyncStore.xhrBreakpoints;
bps.forEach(({ path, method, disabled }) => { return Promise.all(
breakpoints.map(({ path, method, disabled }) => {
if (!disabled) { if (!disabled) {
firefox.clientCommands.setXHRBreakpoint(path, method); firefox.clientCommands.setXHRBreakpoint(path, method);
} }
}); })
}); );
} }
function setPauseOnExceptions() { function setPauseOnExceptions() {
const { pauseOnExceptions, pauseOnCaughtException } = prefs; const { pauseOnExceptions, pauseOnCaughtException } = prefs;
firefox.clientCommands.pauseOnExceptions( return firefox.clientCommands.pauseOnExceptions(
pauseOnExceptions, pauseOnExceptions,
pauseOnCaughtException pauseOnCaughtException
); );
@ -90,7 +93,7 @@ export async function bootstrap({
); );
await syncBreakpoints(); await syncBreakpoints();
syncXHRBreakpoints(); await syncXHRBreakpoints();
await setPauseOnExceptions(); await setPauseOnExceptions();
setupHelper({ setupHelper({