Bug 1441531 - Make waitForMultipleChildrenUpdates an async function
MozReview-Commit-ID: 9qK1FwV0Dgy
--- a/devtools/client/inspector/markup/test/browser_markup_accessibility_semantics.js
+++ b/devtools/client/inspector/markup/test/browser_markup_accessibility_semantics.js
@@ -66,35 +66,33 @@ add_task(function* () {
ok(!spanContainer.tagLine.hasAttribute("aria-expanded"),
"Non expandable tree items should not have aria-expanded attribute");
ok(!headerContainer.tagLine.hasAttribute("aria-expanded"),
"Non expandable tree items should not have aria-expanded attribute");
is(listContainer.tagLine.getAttribute("aria-expanded"), "false",
"Closed tree item should have aria-expanded unset");
info("Selecting and expanding list container");
- let updated = waitForMultipleChildrenUpdates(inspector);
yield selectNode("ul", inspector);
EventUtils.synthesizeKey("VK_RIGHT", {}, win);
- yield updated;
+ yield waitForMultipleChildrenUpdates(inspector);
is(rootElt.getAttribute("aria-activedescendant"),
listContainer.tagLine.getAttribute("id"),
"Active descendant should not be set to list container tagLine");
is(listContainer.tagLine.getAttribute("aria-expanded"), "true",
"Open tree item should have aria-expanded set");
let listItemContainer = yield getContainerForSelector("li", inspector);
is(listItemContainer.tagLine.getAttribute("aria-level"),
TOP_CONTAINER_LEVEL + 1,
"Grand child container tagLine should have nested level up to date");
is(listItemContainer.children.getAttribute("role"), "presentation",
"Container with no children should have its children element ignored by " +
"accessibility");
info("Collapsing list container");
- updated = waitForMultipleChildrenUpdates(inspector);
EventUtils.synthesizeKey("VK_LEFT", {}, win);
- yield updated;
+ yield waitForMultipleChildrenUpdates(inspector);
is(listContainer.tagLine.getAttribute("aria-expanded"), "false",
"Closed tree item should have aria-expanded unset");
});
--- a/devtools/client/inspector/markup/test/browser_markup_load_01.js
+++ b/devtools/client/inspector/markup/test/browser_markup_load_01.js
@@ -44,26 +44,25 @@ add_task(function* () {
// Select an element while the tab is in the middle of a slow reload.
testActor.eval("location.reload()");
info("Wait for DOMContentLoaded");
yield domContentLoaded;
info("Inspect element via context menu");
let markupLoaded = inspector.once("markuploaded");
- let multipleChildrenUpdates = waitForMultipleChildrenUpdates(inspector);
yield chooseWithInspectElementContextMenu("img", tab);
info("Wait for load");
yield pageLoaded;
info("Wait for markup-loaded after element inspection");
yield markupLoaded;
info("Wait for multiple children updates after element inspection");
- yield multipleChildrenUpdates;
+ yield waitForMultipleChildrenUpdates(inspector);
ok(inspector.markup, "There is a markup view");
is(inspector.markup._elt.children.length, 1, "The markup view is rendering");
});
function* chooseWithInspectElementContextMenu(selector, tab) {
yield BrowserTestUtils.synthesizeMouseAtCenter(selector, {
type: "contextmenu",
--- a/devtools/client/inspector/test/head.js
+++ b/devtools/client/inspector/test/head.js
@@ -528,23 +528,23 @@ const getHighlighterHelperFor = (type) =
}
};
}
);
// The expand all operation of the markup-view calls itself recursively and
// there's not one event we can wait for to know when it's done so use this
// helper function to wait until all recursive children updates are done.
-function* waitForMultipleChildrenUpdates(inspector) {
+async function waitForMultipleChildrenUpdates(inspector) {
// As long as child updates are queued up while we wait for an update already
// wait again
if (inspector.markup._queuedChildUpdates &&
inspector.markup._queuedChildUpdates.size) {
- yield waitForChildrenUpdated(inspector);
- return yield waitForMultipleChildrenUpdates(inspector);
+ await waitForChildrenUpdated(inspector);
+ return waitForMultipleChildrenUpdates(inspector);
}
return null;
}
/**
* Using the markupview's _waitForChildren function, wait for all queued
* children updates to be handled.
* @param {InspectorPanel} inspector The instance of InspectorPanel currently