Bug 1239132 - Remove CPOW access from 'wait' function in shared-head.js r?pbro
MozReview-Commit-ID: 1oifs1zuPZw
--- a/devtools/client/framework/test/shared-head.js
+++ b/devtools/client/framework/test/shared-head.js
@@ -286,19 +286,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 = {