Bug 1442153 - Convert browser_inspector_expand-collaps.js to async await and getNodeFrontForSelector in test/head. r=ochameau draft
authoryulia <ystartsev@mozilla.com>
Fri, 16 Mar 2018 18:23:17 +0100
changeset 768671 76136bbbcbb4ceeb4b8af274e2afde1f3c2ccecb
parent 768670 3fd46975362706efb961df9c56cacb8cdad73681
push id102953
push userbmo:ystartsev@mozilla.com
push dateFri, 16 Mar 2018 17:23:47 +0000
reviewersochameau
bugs1442153
milestone61.0a1
Bug 1442153 - Convert browser_inspector_expand-collaps.js to async await and getNodeFrontForSelector in test/head. r=ochameau MozReview-Commit-ID: 4ZuOjgjeZSo
devtools/client/inspector/test/browser_inspector_expand-collapse.js
devtools/client/inspector/test/head.js
--- 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.