Bug 1239132 - Remove CPOW access from 'wait' function in shared-head.js. r=pbro, a=test-only
authorJarda Snajdr <jsnajdr@gmail.com>
Mon, 12 Sep 2016 06:26:48 +0200
changeset 350219 2dadc5e11d6298faa2e7b11cdf8ca37f0187cc80
parent 350218 69979d468f59d8f2f1aa475784119ec715ee6bd3
child 350220 f35ba1281407025c188ab7f1aa0cf56f0d5e940c
push id1230
push userjlund@mozilla.com
push dateMon, 31 Oct 2016 18:13:35 +0000
treeherdermozilla-release@5e06e3766db2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro, test-only
bugs1239132
milestone50.0a2
Bug 1239132 - Remove CPOW access from 'wait' function in shared-head.js. r=pbro, a=test-only MozReview-Commit-ID: 1oifs1zuPZw
devtools/client/framework/test/shared-head.js
devtools/client/inspector/markup/test/head.js
devtools/client/responsivedesign/test/head.js
--- a/devtools/client/framework/test/shared-head.js
+++ b/devtools/client/framework/test/shared-head.js
@@ -285,19 +285,17 @@ function waitForTick() {
  * This shouldn't be used in the tests, but is useful when writing new tests or
  * debugging existing tests in order to introduce delays in the test steps
  *
  * @param {Number} ms
  *        The time to wait
  * @return A promise that resolves when the time is passed
  */
 function wait(ms) {
-  let def = defer();
-  content.setTimeout(def.resolve, ms);
-  return def.promise;
+  return new promise(resolve => setTimeout(resolve, ms));
 }
 
 /**
  * Open the toolbox in a given tab.
  * @param {XULNode} tab The tab the toolbox should be opened in.
  * @param {String} toolId Optional. The ID of the tool to be selected.
  * @param {String} hostType Optional. The type of toolbox host to be used.
  * @return {Promise} Resolves with the toolbox, when it has been opened.
--- a/devtools/client/inspector/markup/test/head.js
+++ b/devtools/client/inspector/markup/test/head.js
@@ -267,28 +267,16 @@ function searchUsingSelectorSearch(selec
   info("Entering \"" + selector + "\" into the selector-search input field");
   let field = getSelectorSearchBox(inspector);
   field.focus();
   field.value = selector;
   EventUtils.sendKey("return", inspector.panelWin);
 }
 
 /**
- * This shouldn't be used in the tests, but is useful when writing new tests or
- * debugging existing tests in order to introduce delays in the test steps
- * @param {Number} ms The time to wait
- * @return A promise that resolves when the time is passed
- */
-function wait(ms) {
-  let def = defer();
-  setTimeout(def.resolve, ms);
-  return def.promise;
-}
-
-/**
  * Check to see if the inspector menu items for editing are disabled.
  * Things like Edit As HTML, Delete Node, etc.
  * @param {NodeFront} nodeFront
  * @param {InspectorPanel} inspector
  * @param {Boolean} assert Should this function run assertions inline.
  * @return A promise that resolves with a boolean indicating whether
  *         the menu items are disabled once the menu has been checked.
  */
--- a/devtools/client/responsivedesign/test/head.js
+++ b/devtools/client/responsivedesign/test/head.js
@@ -196,22 +196,16 @@ var addTab = Task.async(function* (url) 
   let browser = tab.linkedBrowser;
 
   yield once(browser, "load", true);
   info("URL '" + url + "' loading complete");
 
   return tab;
 });
 
-function wait(ms) {
-  let def = promise.defer();
-  setTimeout(def.resolve, ms);
-  return def.promise;
-}
-
 /**
  * Waits for the next load to complete in the current browser.
  *
  * @return promise
  */
 function waitForDocLoadComplete(aBrowser = gBrowser) {
   let deferred = promise.defer();
   let progressListener = {