Bug 1673974 - [devtools] Remove defer usage in browser_console_webconsole_ctrlw_close_tab.js. r=nchevobbe.

Differential Revision: https://phabricator.services.mozilla.com/D95080
This commit is contained in:
Ben Delevingne 2020-10-29 14:41:32 +00:00
Родитель bc7a07bac7
Коммит 8745656461
1 изменённых файлов: 17 добавлений и 30 удалений

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

@ -13,36 +13,27 @@ add_task(async function() {
let hud = await openNewTabAndConsole(TEST_URI);
const tabClosed = defer();
const toolboxDestroyed = defer();
const tabSelected = defer();
const target = await TargetFactory.forTab(gBrowser.selectedTab);
const toolbox = gDevTools.getToolbox(target);
gBrowser.tabContainer.addEventListener(
"TabClose",
function() {
info("tab closed");
tabClosed.resolve(null);
},
{ once: true }
);
const tabClosed = once(gBrowser.tabContainer, "TabClose");
tabClosed.then(() => info("tab closed"));
gBrowser.tabContainer.addEventListener(
"TabSelect",
function() {
if (gBrowser.selectedTab == firstTab) {
info("tab selected");
tabSelected.resolve(null);
}
},
{ once: true }
);
const tabSelected = new Promise(resolve => {
gBrowser.tabContainer.addEventListener(
"TabSelect",
function() {
if (gBrowser.selectedTab == firstTab) {
info("tab selected");
resolve(null);
}
},
{ once: true }
);
});
toolbox.once("destroyed", () => {
const toolboxDestroyed = toolbox.once("destroyed", () => {
info("toolbox destroyed");
toolboxDestroyed.resolve(null);
});
// Get out of the web console initialization.
@ -50,12 +41,8 @@ add_task(async function() {
EventUtils.synthesizeKey("w", { accelKey: true });
});
await promise.all([
tabClosed.promise,
toolboxDestroyed.promise,
tabSelected.promise,
]);
info("promise.all resolved. start testing the Browser Console");
await Promise.all([tabClosed, toolboxDestroyed, tabSelected]);
info("Promise.all resolved. start testing the Browser Console");
hud = await BrowserConsoleManager.toggleBrowserConsole();
ok(hud, "Browser Console opened");