--- a/dom/tests/mochitest/bugs/test_bug1171215.html
+++ b/dom/tests/mochitest/bugs/test_bug1171215.html
@@ -23,17 +23,17 @@ https://bugzilla.mozilla.org/show_bug.cg
// Set a cookie in example.org so we can test that we can't read it in
// third-party cases.
f.contentWindow.location =
"http://example.org/tests/dom/tests/mochitest/bugs/file_prime_cookie.html";
waitForLoad().then(function() {
// Cookies are set up, disallow third-party cookies and start the test.
SpecialPowers.pushPrefEnv({ set: [[ 'network.cookie.cookieBehavior', 1 ]] },
- () => { spawn_task(continueTest); });
+ () => { continueTest(); });
}).catch((e) => { ok(false, `Got exception: ${e}`) });
}
function waitForLoad() {
return new Promise((resolve) => {
window.addEventListener("message", function(msg) {
info(`got message ${msg.data}`);
resolve(msg.data);
--- a/editor/libeditor/tests/test_selection_move_commands.html
+++ b/editor/libeditor/tests/test_selection_move_commands.html
@@ -8,18 +8,18 @@
<iframe id="edit" width="200" height="100" src="about:blank"></iframe>
<script>
SimpleTest.waitForExplicitFinish();
SimpleTest.requestFlakyTimeout("Legacy test, possibly no good reason");
var winUtils = SpecialPowers.getDOMWindowUtils(window);
-function* setup() {
- yield SpecialPowers.pushPrefEnv({set: [["general.smoothScroll", false]]});
+async function setup() {
+ await SpecialPowers.pushPrefEnv({set: [["general.smoothScroll", false]]});
winUtils.advanceTimeAndRefresh(100);
}
function* runTests() {
var e = document.getElementById("edit");
var doc = e.contentDocument;
var win = e.contentWindow;
var root = doc.documentElement;
@@ -200,13 +200,13 @@ async function testRunner() {
if (curTest.next().done) {
break;
}
winUtils.advanceTimeAndRefresh(100);
await new Promise(resolve => setTimeout(resolve, 20));
}
}
-spawn_task(setup)
- .then(() => spawn_task(testRunner))
- .then(() => spawn_task(cleanup))
+setup()
+ .then(() => testRunner())
+ .then(() => cleanup())
.catch(err => ok(false, err));
</script>
--- a/layout/style/test/chrome/bug418986-2.js
+++ b/layout/style/test/chrome/bug418986-2.js
@@ -281,18 +281,17 @@ var testOSXFontSmoothing = function (res
var sleep = function (timeoutMs) {
return new Promise(function(resolve, reject) {
window.setTimeout(resolve);
});
};
// __testMediaQueriesInPictureElements(resisting)__.
// Test to see if media queries are properly spoofed in picture elements
-// when we are resisting fingerprinting. A generator function
-// to be used with SpawnTask.js.
+// when we are resisting fingerprinting.
var testMediaQueriesInPictureElements = async function(resisting) {
let picture = document.createElementNS(HTML_NS, "picture");
for (let [key, offVal, onVal] of expected_values) {
let expected = resisting ? onVal : offVal;
if (expected) {
let query = constructQuery(key, expected);
let source = document.createElementNS(HTML_NS, "source");
@@ -322,18 +321,17 @@ var testMediaQueriesInPictureElements =
// when it succeeds.
var pushPref = function (key, value) {
return new Promise(function(resolve, reject) {
SpecialPowers.pushPrefEnv({"set": [[key, value]]}, resolve);
});
};
// __test(isContent)__.
-// Run all tests. A generator function to be used
-// with SpawnTask.js.
+// Run all tests.
var test = async function(isContent) {
for (prefValue of [false, true]) {
await pushPref("privacy.resistFingerprinting", prefValue);
let resisting = prefValue && isContent;
expected_values.forEach(
function ([key, offVal, onVal]) {
testMatch(key, resisting ? onVal : offVal);
});
--- a/layout/style/test/chrome/test_bug418986-2.xul
+++ b/layout/style/test/chrome/test_bug418986-2.xul
@@ -17,14 +17,14 @@ https://bugzilla.mozilla.org/show_bug.cg
<p id="pictures"></p>
</body>
<script type="text/javascript" src="bug418986-2.js"></script>
<!-- test code goes here -->
<script type="text/javascript">
// Run all tests now.
window.onload = function () {
- add_task(function* () {
- yield test(false);
+ add_task(async function() {
+ await test(false);
});
};
</script>
</window>
--- a/testing/mochitest/chrome/chrome.ini
+++ b/testing/mochitest/chrome/chrome.ini
@@ -1,18 +1,16 @@
[DEFAULT]
skip-if = os == 'android'
support-files = test-dir/test-file
[test_sample.xul]
-[test_sanityAddTask.xul]
[test_sanityEventUtils.xul]
[test_sanityPluginUtils.html]
[test_sanityException.xul]
[test_sanityException2.xul]
[test_sanityManifest.xul]
fail-if = true
[test_sanityManifest_pf.xul]
fail-if = true
-[test_sanitySpawnTask.xul]
[test_chromeGetTestFile.xul]
[test_tasks_skip.xul]
[test_tasks_skipall.xul]
deleted file mode 100644
--- a/testing/mochitest/chrome/test_sanityAddTask.xul
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-<window title="Test spawnTawk function"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"/>
- <script type="application/javascript">
- <![CDATA[
-
- // Check that we can 'add_task' a few times and all tasks run asynchronously before test finishes.
-
- add_task(async function() {
- var x = await Promise.resolve(1);
- is(x, 1, "task yields Promise value as expected");
- });
-
- add_task(function* () {
- var x = yield [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)];
- is(x.join(""), "123", "task yields Promise value as expected");
- });
-
- add_task(function* () {
- var x = yield (function* () {
- return 3;
- }());
- is(x, 3, "task yields generator function return value as expected");
- });
-
- ]]>
- </script>
- <body xmlns="http://www.w3.org/1999/xhtml" >
- </body>
-</window>
-
-
-
-
deleted file mode 100644
--- a/testing/mochitest/chrome/test_sanitySpawnTask.xul
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
- type="text/css"?>
-<window title="Test spawnTawk function"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"/>
- <script type="application/javascript">
- <![CDATA[
- SimpleTest.waitForExplicitFinish();
-
- var externalGeneratorFunction = function* () {
- return 8;
- };
-
- var nestedFunction = function* () {
- return yield function* () {
- return yield function* () {
- return yield function* () {
- return yield Promise.resolve(9);
- }();
- }();
- }();
- }
-
- var variousTests = function* () {
- var val1 = yield [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)];
- is(val1.join(""), "123", "Array of promises -> Promise.all");
- var val2 = yield Promise.resolve(2);
- is(val2, 2, "Resolved promise yields value.");
- var val3 = yield function* () { return 3; };
- is(val3, 3, "Generator functions are spawned.");
- //var val4 = yield function () { return 4; };
- //is(val4, 4, "Plain functions run and return.");
- var val5 = yield (function* () { return 5; }());
- is(val5, 5, "Generators are spawned.");
- try {
- var val6 = yield Promise.reject(Error("error6"));
- ok(false, "Shouldn't reach this line.");
- } catch (error) {
- is(error.message, "error6", "Rejected promise throws error.");
- }
- try {
- var val7 = yield function* () { throw Error("error7"); };
- ok(false, "Shouldn't reach this line.");
- } catch (error) {
- is(error.message, "error7", "Thrown error propagates.");
- }
- var val8 = yield externalGeneratorFunction();
- is(val8, 8, "External generator also spawned.");
- var val9 = yield nestedFunction();
- is(val9, 9, "Nested generator functions work.");
- return 10;
- };
-
- spawn_task(variousTests).then(function(result) {
- is(result, 10, "spawn_task(...) returns promise");
- SimpleTest.finish();
- });
- ]]>
- </script>
-
- <body xmlns="http://www.w3.org/1999/xhtml" >
- </body>
-</window>
--- a/testing/mochitest/tests/Harness_sanity/mochitest.ini
+++ b/testing/mochitest/tests/Harness_sanity/mochitest.ini
@@ -1,12 +1,11 @@
[DEFAULT]
[test_TestsRunningAfterSimpleTestFinish.html]
skip-if = true #depends on fix for bug 1048446
-[test_add_task.html]
[test_createFiles.html]
[test_importInMainProcess.html]
support-files = importtesting_chromescript.js
[test_sanity.html]
[test_sanityException.html]
[test_sanityException2.html]
[test_sanityParams.html]
[test_sanityRegisteredServiceWorker.html]
@@ -35,10 +34,9 @@ skip-if = toolkit == 'android' # bug 68
subsuite = clipboard
skip-if = toolkit == 'android' # bug 688052
[test_sanity_manifest.html]
skip-if = toolkit == 'android' # we use the old manifest style on android
fail-if = true
[test_sanity_manifest_pf.html]
skip-if = toolkit == 'android' # we use the old manifest style on android
fail-if = true
-[test_spawn_task.html]
[test_sanity_waitForCondition.html]
deleted file mode 100644
--- a/testing/mochitest/tests/Harness_sanity/test_add_task.html
+++ /dev/null
@@ -1,38 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test for mochitest add_task, found in SpawnTask.js</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug 1187701</a>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-// Check that we can 'add_task' a few times and all tasks run asynchronously before test finishes.
-
-add_task(async function() {
- var x = await Promise.resolve(1);
- is(x, 1, "task yields Promise value as expected");
-});
-
-add_task(function* () {
- var x = yield [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)];
- is(x.join(""), "123", "task yields Promise value as expected");
-});
-
-add_task(function* () {
- var x = yield (function* () {
- return 3;
- }());
- is(x, 3, "task yields generator function return value as expected");
-});
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/testing/mochitest/tests/Harness_sanity/test_spawn_task.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test for mochitest SpawnTask.js sanity</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug 1078657</a>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for sanity **/
-SimpleTest.waitForExplicitFinish();
-
-var externalGeneratorFunction = function* () {
- return 8;
-};
-
-var nestedFunction = function* () {
- return yield function* () {
- return yield function* () {
- return yield function* () {
- return yield Promise.resolve(9);
- }();
- }();
- }();
-}
-
-var variousTests = function* () {
- var val1 = yield [Promise.resolve(1), Promise.resolve(2), Promise.resolve(3)];
- is(val1.join(""), "123", "Array of promises -> Promise.all");
- var val2 = yield Promise.resolve(2);
- is(val2, 2, "Resolved promise yields value.");
- var val3 = yield function* () { return 3; };
- is(val3, 3, "Generator functions are spawned.");
- //var val4 = yield function () { return 4; };
- //is(val4, 4, "Plain functions run and return.");
- var val5 = yield (function* () { return 5; }());
- is(val5, 5, "Generators are spawned.");
- try {
- var val6 = yield Promise.reject(Error("error6"));
- ok(false, "Shouldn't reach this line.");
- } catch (error) {
- is(error.message, "error6", "Rejected promise throws error.");
- }
- try {
- var val7 = yield function* () { throw Error("error7"); };
- ok(false, "Shouldn't reach this line.");
- } catch (error) {
- is(error.message, "error7", "Thrown error propagates.");
- }
- var val8 = yield externalGeneratorFunction();
- is(val8, 8, "External generator also spawned.");
- var val9 = yield nestedFunction();
- is(val9, 9, "Nested generator functions work.");
- return 10;
-};
-
-spawn_task(variousTests).then(function(result) {
- is(result, 10, "spawn_task(...) returns promise");
- SimpleTest.finish();
-});
-
-
-</script>
-</pre>
-</body>
-</html>
-
deleted file mode 100644
--- a/testing/mochitest/tests/SimpleTest/LICENSE_SpawnTask
+++ /dev/null
@@ -1,24 +0,0 @@
-LICENSE for SpawnTask.js (the co library):
-
-(The MIT License)
-
-Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca>
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-'Software'), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- a/testing/mochitest/tests/SimpleTest/SpawnTask.js
+++ b/testing/mochitest/tests/SimpleTest/SpawnTask.js
@@ -1,280 +1,39 @@
-// # SpawnTask.js
-// Directly copied from the "co" library by TJ Holowaychuk.
-// See https://github.com/tj/co/tree/4.6.0
-// For use with mochitest-plain and mochitest-chrome.
-
-// spawn_task(generatorFunction):
-// Expose only the `co` function, which is very similar to Task.spawn in Task.jsm.
-// We call this function spawn_task to make its purpose more plain, and to
-// reduce the chance of name collisions.
-var spawn_task = (function () {
-
-/**
- * slice() reference.
- */
-
-var slice = Array.prototype.slice;
-
-/**
- * Wrap the given generator `fn` into a
- * function that returns a promise.
- * This is a separate function so that
- * every `co()` call doesn't create a new,
- * unnecessary closure.
- *
- * @param {GeneratorFunction} fn
- * @return {Function}
- * @api public
- */
-
-co.wrap = function (fn) {
- createPromise.__generatorFunction__ = fn;
- return createPromise;
- function createPromise() {
- return co.call(this, fn.apply(this, arguments));
- }
-};
-
-/**
- * Execute the generator function or a generator
- * and return a promise.
- *
- * @param {Function} fn
- * @return {Promise}
- * @api public
- */
-
-function co(gen) {
- var ctx = this;
- var args = slice.call(arguments, 1)
-
- // we wrap everything in a promise to avoid promise chaining,
- // which leads to memory leak errors.
- // see https://github.com/tj/co/issues/180
- return new Promise(function(resolve, reject) {
- if (typeof gen === 'function') gen = gen.apply(ctx, args);
- if (!gen || typeof gen.next !== 'function') return resolve(gen);
-
- onFulfilled();
-
- /**
- * @param {Mixed} res
- * @return {Promise}
- * @api private
- */
-
- function onFulfilled(res) {
- var ret;
- try {
- ret = gen.next(res);
- } catch (e) {
- return reject(e);
- }
- next(ret);
- }
-
- /**
- * @param {Error} err
- * @return {Promise}
- * @api private
- */
-
- function onRejected(err) {
- var ret;
- try {
- ret = gen.throw(err);
- } catch (e) {
- return reject(e);
- }
- next(ret);
- }
-
- /**
- * Get the next value in the generator,
- * return a promise.
- *
- * @param {Object} ret
- * @return {Promise}
- * @api private
- */
-
- function next(ret) {
- if (ret.done) return resolve(ret.value);
- var value = toPromise.call(ctx, ret.value);
- if (value && isPromise(value)) return value.then(onFulfilled, onRejected);
- return onRejected(new TypeError('You may only yield a function, promise, generator, array, or object, '
- + 'but the following object was passed: "' + String(ret.value) + '"'));
- }
- });
-}
-
-/**
- * Convert a `yield`ed value into a promise.
- *
- * @param {Mixed} obj
- * @return {Promise}
- * @api private
- */
-
-function toPromise(obj) {
- if (!obj) return obj;
- if (isPromise(obj)) return obj;
- if (isGeneratorFunction(obj) || isGenerator(obj)) return co.call(this, obj);
- if ('function' == typeof obj) return thunkToPromise.call(this, obj);
- if (Array.isArray(obj)) return arrayToPromise.call(this, obj);
- if (isObject(obj)) return objectToPromise.call(this, obj);
- return obj;
-}
-
-/**
- * Convert a thunk to a promise.
- *
- * @param {Function}
- * @return {Promise}
- * @api private
- */
-
-function thunkToPromise(fn) {
- var ctx = this;
- return new Promise(function (resolve, reject) {
- fn.call(ctx, function (err, res) {
- if (err) return reject(err);
- if (arguments.length > 2) res = slice.call(arguments, 1);
- resolve(res);
- });
- });
-}
-
-/**
- * Convert an array of "yieldables" to a promise.
- * Uses `Promise.all()` internally.
- *
- * @param {Array} obj
- * @return {Promise}
- * @api private
- */
-
-function arrayToPromise(obj) {
- return Promise.all(obj.map(toPromise, this));
-}
-
-/**
- * Convert an object of "yieldables" to a promise.
- * Uses `Promise.all()` internally.
- *
- * @param {Object} obj
- * @return {Promise}
- * @api private
- */
-
-function objectToPromise(obj){
- var results = new obj.constructor();
- var keys = Object.keys(obj);
- var promises = [];
- for (var i = 0; i < keys.length; i++) {
- var key = keys[i];
- var promise = toPromise.call(this, obj[key]);
- if (promise && isPromise(promise)) defer(promise, key);
- else results[key] = obj[key];
- }
- return Promise.all(promises).then(function () {
- return results;
- });
-
- function defer(promise, key) {
- // predefine the key in the result
- results[key] = undefined;
- promises.push(promise.then(function (res) {
- results[key] = res;
- }));
- }
-}
-
-/**
- * Check if `obj` is a promise.
- *
- * @param {Object} obj
- * @return {Boolean}
- * @api private
- */
-
-function isPromise(obj) {
- return 'function' == typeof obj.then;
-}
-
-/**
- * Check if `obj` is a generator.
- *
- * @param {Mixed} obj
- * @return {Boolean}
- * @api private
- */
-
-function isGenerator(obj) {
- return 'function' == typeof obj.next && 'function' == typeof obj.throw;
-}
-
-/**
- * Check if `obj` is a generator function.
- *
- * @param {Mixed} obj
- * @return {Boolean}
- * @api private
- */
-function isGeneratorFunction(obj) {
- var constructor = obj.constructor;
- if (!constructor) return false;
- if ('GeneratorFunction' === constructor.name || 'GeneratorFunction' === constructor.displayName) return true;
- return isGenerator(constructor.prototype);
-}
-
-/**
- * Check for plain object.
- *
- * @param {Mixed} val
- * @return {Boolean}
- * @api private
- */
-
-function isObject(val) {
- return Object == val.constructor;
-}
-
-return co;
-})();
-
// add_task(generatorFunction):
// Call `add_task(generatorFunction)` for each separate
// asynchronous task in a mochitest. Tasks are run consecutively.
// Before the first task, `SimpleTest.waitForExplicitFinish()`
// will be called automatically, and after the last task,
// `SimpleTest.finish()` will be called.
var add_task = (function () {
// The list of tasks to run.
var task_list = [];
var run_only_this_task = null;
+ function isGenerator(value) {
+ return value && typeof value === "object" && typeof value.next === "function";
+ }
+
// The "add_task" function
return function (generatorFunction) {
if (task_list.length === 0) {
// This is the first time add_task has been called.
// First, confirm that SimpleTest is available.
if (!SimpleTest) {
throw new Error("SimpleTest not available.");
}
// Don't stop tests until asynchronous tasks are finished.
SimpleTest.waitForExplicitFinish();
// Because the client is using add_task for this set of tests,
// we need to spawn a "master task" that calls each task in succesion.
// Use setTimeout to ensure the master task runs after the client
// script finishes.
setTimeout(function () {
- spawn_task(function* () {
+ (async () => {
// Allow for a task to be skipped; we need only use the structured logger
// for this, whilst deactivating log buffering to ensure that messages
// are always printed to stdout.
function skipTask(name) {
let logger = parentRunner && parentRunner.structuredLogger;
if (!logger) {
info("SpawnTask.js | Skipping test " + name);
return;
@@ -290,30 +49,33 @@ var add_task = (function () {
try {
for (var task of task_list) {
var name = task.name || "";
if (task.__skipMe || (run_only_this_task && task != run_only_this_task)) {
skipTask(name);
continue;
}
info("SpawnTask.js | Entering test " + name);
- yield task();
+ let result = await task();
+ if (isGenerator(result)) {
+ ok(false, "Task returned a generator");
+ }
info("SpawnTask.js | Leaving test " + name);
}
} catch (ex) {
try {
ok(false, "" + ex, "Should not throw any errors", ex.stack);
} catch (ex2) {
ok(false, "(The exception cannot be converted to string.)",
"Should not throw any errors", ex.stack);
}
}
// All tasks are finished.
SimpleTest.finish();
- });
+ })();
});
}
generatorFunction.skip = () => generatorFunction.__skipMe = true;
generatorFunction.only = () => run_only_this_task = generatorFunction;
// Add the task to the list of tasks to run after
// the main thread is finished.
task_list.push(generatorFunction);
return generatorFunction;
--- a/toolkit/components/contentprefs/tests/mochitest/test_remoteContentPrefs.html
+++ b/toolkit/components/contentprefs/tests/mochitest/test_remoteContentPrefs.html
@@ -319,18 +319,18 @@
let deferred = Defer();
iframe.addEventListener("mozbrowserloadend", function() {
info("Got iframe load event.");
let mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
mm.loadFrameScript("data:,(" + childFrameScript.toString() + ")(" + isPrivate + ");",
false);
// Chain testStructure to runTests's promise.
- spawn_task(testStructure(mm, isPrivate)).then(deferred.resolve)
- .catch((e) => { info(`caught failing test ${e}`); });
+ testStructure(mm, isPrivate).then(deferred.resolve)
+ .catch((e) => { info(`caught failing test ${e}`); });
});
document.body.appendChild(iframe);
return deferred.promise;
}
function runTests() {
info("Browser prefs set.");
--- a/toolkit/components/places/tests/chrome/browser_disableglobalhistory.xul
+++ b/toolkit/components/places/tests/chrome/browser_disableglobalhistory.xul
@@ -1,14 +1,13 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window title="Test disableglobalhistory attribute on remote browsers"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- onload="run_test();">
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
<browser id="inprocess_disabled" src="about:blank" type="content" disableglobalhistory="true" />
<browser id="inprocess_enabled" src="about:blank" type="content" />
@@ -23,21 +22,20 @@
function expectUseGlobalHistory(id, expected) {
let browser = document.getElementById(id);
return ContentTask.spawn(browser, {id, expected}, function({id, expected}) {
Assert.equal(docShell.useGlobalHistory, expected,
"Got the right useGlobalHistory state in the docShell of " + id);
});
}
- function run_test() {
- spawn_task(function*() {
- yield expectUseGlobalHistory("inprocess_disabled", false);
- yield expectUseGlobalHistory("inprocess_enabled", true);
+ add_task(async function() {
+ await expectUseGlobalHistory("inprocess_disabled", false);
+ await expectUseGlobalHistory("inprocess_enabled", true);
- yield expectUseGlobalHistory("remote_disabled", false);
- yield expectUseGlobalHistory("remote_enabled", true);
- window.opener.done();
- });
- };
+ await expectUseGlobalHistory("remote_disabled", false);
+ await expectUseGlobalHistory("remote_enabled", true);
+ window.opener.done();
+ ok(true);
+ });
</script>
</window>
--- a/toolkit/components/places/tests/chrome/test_browser_disableglobalhistory.xul
+++ b/toolkit/components/places/tests/chrome/test_browser_disableglobalhistory.xul
@@ -14,13 +14,12 @@
<script type="text/javascript">
SimpleTest.waitForExplicitFinish();
let w = window.open('browser_disableglobalhistory.xul', '_blank', 'chrome,resizable=yes,width=400,height=600');
function done() {
w.close();
- SimpleTest.finish();
}
</script>
-</window>
\ No newline at end of file
+</window>
--- a/toolkit/components/satchel/test/test_datalist_with_caching.html
+++ b/toolkit/components/satchel/test/test_datalist_with_caching.html
@@ -36,17 +36,17 @@ Form History test: form field autocomple
let input = $_(1, "field1");
function setupFormHistory(aCallback) {
updateFormHistory([
{ op: "remove" },
{ op: "add", fieldname: "field1", value: "Sec" },
], () => {
- spawn_task(aCallback);
+ aCallback();
});
}
function setForm(value) {
input.value = value;
input.focus();
}