diff --git a/dom/quota/test/xpcshell/common/head.js b/dom/quota/test/xpcshell/common/head.js index 57fb23349014..dc751868d532 100644 --- a/dom/quota/test/xpcshell/common/head.js +++ b/dom/quota/test/xpcshell/common/head.js @@ -11,16 +11,9 @@ const NS_ERROR_FILE_NO_DEVICE_SPACE = Cr.NS_ERROR_FILE_NO_DEVICE_SPACE; const loggingEnabled = false; var testGenerator; -var childScriptPaths = []; loadScript("dom/quota/test/common/xpcshell.js"); -// Adds a test that will run in a child process (besides the main test that will -// run in the main process). -function loadChildScript(path) { - childScriptPaths.push(depth + path); -} - function log(msg) { if (loggingEnabled) { info(msg); @@ -40,34 +33,15 @@ function todo(cond, msg) { } function run_test() { - let testHarnessGenerator; + runTest(); +} - function nextTestHarnessStep(val) { - testHarnessGenerator.next(val); - } +if (!this.runTest) { + this.runTest = function() { + do_get_profile(); - function* testHarnessSteps() { - do_test_pending("testHarnessSteps"); - - if (Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) { - do_get_profile(); - - enableStorageTesting(); - enableTesting(); - - registerCleanupFunction(function() { - resetStorageTesting(); - resetTesting(); - }); - - if (childScriptPaths.length) { - // We currently allow defining multiple child tests by calling - // loadChildScript multiple times, but run_test_in_child supports - // loading of one test only. - run_test_in_child(childScriptPaths[0]).then(nextTestHarnessStep); - yield undefined; - } - } + enableStorageTesting(); + enableTesting(); Cu.importGlobalProperties(["indexedDB", "File", "Blob", "FileReader"]); @@ -79,6 +53,13 @@ function run_test() { "There should be a testSteps function" ); if (testSteps.constructor.name === "AsyncFunction") { + // Do run our existing cleanup function that would normally be called by + // the generator's call to finishTest(). + registerCleanupFunction(function() { + resetStorageTesting(); + resetTesting(); + }); + add_task(testSteps); // Since we defined run_test, we must invoke run_next_test() to start the @@ -90,22 +71,20 @@ function run_test() { "Unsupported function type" ); - do_test_pending("testSteps"); + do_test_pending(); testGenerator = testSteps(); testGenerator.next(); } - - do_test_finished("testHarnessSteps"); - } - - testHarnessGenerator = testHarnessSteps(); - testHarnessGenerator.next(); + }; } function finishTest() { + resetStorageTesting(); + resetTesting(); + executeSoon(function() { - do_test_finished("testSteps"); + do_test_finished(); }); } diff --git a/dom/quota/test/xpcshell/test_listOrigins.js b/dom/quota/test/xpcshell/test_listOrigins.js index cf926f989357..9a683eedbbb2 100644 --- a/dom/quota/test/xpcshell/test_listOrigins.js +++ b/dom/quota/test/xpcshell/test_listOrigins.js @@ -3,8 +3,6 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -loadChildScript("dom/quota/test/xpcshell/test_listOrigins.js"); - async function testSteps() { const origins = [ "https://example.com", diff --git a/dom/quota/test/xpcshell/test_originWithCaret.js b/dom/quota/test/xpcshell/test_originWithCaret.js index 5ec53637a683..7afce4f5cccf 100644 --- a/dom/quota/test/xpcshell/test_originWithCaret.js +++ b/dom/quota/test/xpcshell/test_originWithCaret.js @@ -5,8 +5,6 @@ "use strict"; -loadChildScript("dom/quota/test/xpcshell/test_originWithCaret.js"); - async function testSteps() { Assert.throws( () => { diff --git a/dom/quota/test/xpcshell/test_simpledb.js b/dom/quota/test/xpcshell/test_simpledb.js index a3f42aa7d927..b698d778e090 100644 --- a/dom/quota/test/xpcshell/test_simpledb.js +++ b/dom/quota/test/xpcshell/test_simpledb.js @@ -3,7 +3,4 @@ * http://creativecommons.org/publicdomain/zero/1.0/ */ -const commonScriptPath = "dom/quota/test/common/test_simpledb.js"; - -loadScript(commonScriptPath); -loadChildScript(commonScriptPath); +loadScript("dom/quota/test/common/test_simpledb.js");