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() {
const breakpoints = await asyncStore.pendingBreakpoints;
const breakpointValues = Object.values(breakpoints);
breakpointValues.forEach(({ disabled, options, generatedLocation }) => {
if (!disabled) {
firefox.clientCommands.setBreakpoint(generatedLocation, options);
}
});
return Promise.all(
breakpointValues.map(({ disabled, options, generatedLocation }) => {
if (!disabled) {
return firefox.clientCommands.setBreakpoint(generatedLocation, options);
}
})
);
}
function syncXHRBreakpoints() {
asyncStore.xhrBreakpoints.then(bps => {
bps.forEach(({ path, method, disabled }) => {
async function syncXHRBreakpoints() {
const breakpoints = await asyncStore.xhrBreakpoints;
return Promise.all(
breakpoints.map(({ path, method, disabled }) => {
if (!disabled) {
firefox.clientCommands.setXHRBreakpoint(path, method);
}
});
});
})
);
}
function setPauseOnExceptions() {
const { pauseOnExceptions, pauseOnCaughtException } = prefs;
firefox.clientCommands.pauseOnExceptions(
return firefox.clientCommands.pauseOnExceptions(
pauseOnExceptions,
pauseOnCaughtException
);
@ -90,7 +93,7 @@ export async function bootstrap({
);
await syncBreakpoints();
syncXHRBreakpoints();
await syncXHRBreakpoints();
await setPauseOnExceptions();
setupHelper({