Bug 1441531 - Make waitForMultipleChildrenUpdates an async function r=pbro

MozReview-Commit-ID: 9qK1FwV0Dgy

--HG--
extra : rebase_source : 28983255c37f96e33f8fc9c5c9308a98ab74415f
This commit is contained in:
yulia 2018-02-28 12:14:06 +01:00
parent 36a2994346
commit b9ea4d1569
3 changed files with 6 additions and 9 deletions

View File

@ -71,10 +71,9 @@ add_task(function* () {
"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"),
@ -90,9 +89,8 @@ add_task(function* () {
"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");

View File

@ -49,7 +49,6 @@ add_task(function* () {
info("Inspect element via context menu");
let markupLoaded = inspector.once("markuploaded");
let multipleChildrenUpdates = waitForMultipleChildrenUpdates(inspector);
yield chooseWithInspectElementContextMenu("img", tab);
info("Wait for load");
@ -58,7 +57,7 @@ add_task(function* () {
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");

View File

@ -533,13 +533,13 @@ const getHighlighterHelperFor = (type) => Task.async(
// 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;
}