зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1750227 - [devtools] Register cleanup function in initBrowserToolboxTask. r=ochameau.
If a test involving the Browser Toolbox times out, the Browser Toolbox would not close and could have impact on next tests. In this patch we register a cleanup function to make sure we always close the Browser Toolbox. Differential Revision: https://phabricator.services.mozilla.com/D136096
This commit is contained in:
Родитель
7dfca66f06
Коммит
a73d337ea1
|
@ -172,7 +172,13 @@ async function initBrowserToolboxTask({
|
|||
}
|
||||
}
|
||||
|
||||
let destroyed = false;
|
||||
async function destroy() {
|
||||
// No need to do anything if `destroy` was already called.
|
||||
if (destroyed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const closePromise = process._dbgProcess.wait();
|
||||
evaluateExpression("gToolbox.destroy()").catch(e => {
|
||||
// Ignore connection close as the toolbox destroy may destroy
|
||||
|
@ -194,8 +200,14 @@ async function initBrowserToolboxTask({
|
|||
);
|
||||
|
||||
await client.close();
|
||||
destroyed = true;
|
||||
}
|
||||
|
||||
// When tests involving using this task fail, the spawned Browser Toolbox is not
|
||||
// destroyed and might impact the next tests (e.g. pausing the content process before
|
||||
// the debugger from the content toolbox does). So make sure to cleanup everything.
|
||||
registerCleanupFunction(destroy);
|
||||
|
||||
return {
|
||||
importFunctions,
|
||||
importScript,
|
||||
|
|
Загрузка…
Ссылка в новой задаче