Bug 1709794 - [devtools] Fix SpecialPowsers.spawn throwing when navigating while being paused by the debugger. r=nchevobbe

Differential Revision: https://phabricator.services.mozilla.com/D114465
This commit is contained in:
Alexandre Poirot 2021-05-11 11:40:50 +00:00
Родитель 7a648a32c3
Коммит c7c9143e76
1 изменённых файлов: 7 добавлений и 1 удалений

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

@ -1073,7 +1073,13 @@ function clickElementInTab(selector) {
gBrowser.selectedBrowser,
[{ selector }],
function({ selector }) {
content.wrappedJSObject.document.querySelector(selector).click();
const element = content.document.querySelector(selector);
// Run the click in another event loop in order to immediately resolve spawn's promise.
// Otherwise if we pause on click and navigate, the JSWindowActor used by spawn will
// be destroyed while its query is still pending. And this would reject the promise.
content.setTimeout(() => {
element.click();
});
}
);
}