Bug 1699619 - [devtools] Wait for a11y panel initialization in browser_aboutdebugging_devtoolstoolbox_reload r=ochameau

Differential Revision: https://phabricator.services.mozilla.com/D110345
This commit is contained in:
Julian Descottes 2021-03-31 11:38:59 +00:00
Родитель 9408355c3c
Коммит 1e32445f35
2 изменённых файлов: 21 добавлений и 1 удалений

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

@ -61,12 +61,25 @@ async function testReloadAboutDevToolsToolbox(toolId) {
const toolbox = getToolbox(devtoolsWindow);
await toolbox.selectTool(toolId);
// The a11y panel finishes its initialization after selectTool resolves.
// TODO: The a11y panel init should only resolve when the UI is ready and all
// initial requests are completed. See Bug 1702078.
if (toolId === "accessibility") {
await waitForA11yPanel(toolbox);
}
info("Wait for requests to settle before reloading");
await toolbox.target.client.waitForRequestsToSettle();
info("Reload about:devtools-toolbox page");
devtoolsBrowser.reload();
await gDevTools.once("toolbox-ready");
const newToolbox = await gDevTools.once("toolbox-ready");
// Again, wait for the delayed a11y panel initialization.
if (toolId === "accessibility") {
await waitForA11yPanel(newToolbox);
}
ok(true, "Toolbox is re-created again");
// Check that about:devtools-toolbox is still selected tab. See Bug 1570692.
@ -85,3 +98,8 @@ async function testReloadAboutDevToolsToolbox(toolId) {
await closeAboutDevtoolsToolbox(document, devtoolsTab, window);
await removeTab(tab);
}
async function waitForA11yPanel(toolbox) {
const panel = toolbox.getPanel("accessibility");
await panel._accessibilityViewInitialized;
}

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

@ -103,6 +103,8 @@ AccessibilityPanel.prototype = {
EVENTS.ACCESSIBILITY_INSPECTOR_UPDATED,
this.onAccessibilityInspectorUpdated
);
// Expose a promise so that tests can wait for the UI to be ready.
this._accessibilityViewInitialized = this.panelWin.once(EVENTS.INITIALIZED);
this.shouldRefresh = true;