Bug 1442153 - Convert browser_inspector_expand-collaps.js to async await and getNodeFrontForSelector in test/head. r=ochameau
MozReview-Commit-ID: 4ZuOjgjeZSo
--- a/devtools/client/inspector/test/browser_inspector_expand-collapse.js
+++ b/devtools/client/inspector/test/browser_inspector_expand-collapse.js
@@ -4,17 +4,17 @@
"use strict";
// Tests that context menu items exapnd all and collapse are shown properly.
const TEST_URL = "data:text/html;charset=utf-8," +
"<div id='parent-node'><div id='child-node'></div></div>";
-add_task(async function () {
+add_task(async function() {
// Test is often exceeding time-out threshold, similar to Bug 1137765
requestLongerTimeout(2);
let {inspector} = await openInspectorForURL(TEST_URL);
info("Selecting the parent node");
let front = await getNodeFrontForSelector("#parent-node", inspector);
--- a/devtools/client/inspector/test/head.js
+++ b/devtools/client/inspector/test/head.js
@@ -362,24 +362,24 @@ function redoChange(inspector) {
inspector.markup.undo.redo();
return mutated;
}
/**
* A helper that fetches a front for a node that matches the given selector or
* doctype node if the selector is falsy.
*/
-function* getNodeFrontForSelector(selector, inspector) {
+async function getNodeFrontForSelector(selector, inspector) {
if (selector) {
info("Retrieving front for selector " + selector);
return getNodeFront(selector, inspector);
}
info("Retrieving front for doctype node");
- let {nodes} = yield inspector.walker.children(inspector.walker.rootNode);
+ let {nodes} = await inspector.walker.children(inspector.walker.rootNode);
return nodes[0];
}
/**
* A simple polling helper that executes a given function until it returns true.
* @param {Function} check A generator function that is expected to return true at some
* stage.
* @param {String} desc A text description to be displayed when the polling starts.