# HG changeset patch # User Tooru Fujisawa # Date 1480410466 -32400 # Tue Nov 29 18:07:46 2016 +0900 # Node ID 089fb2555ce262e2591c2025984cb3f34e0039d4 # Parent 80f8b4d26107a6c841280e0f79294e4149bab60e Bug ? - Remove legacy generator from testing/. diff --git a/testing/marionette/driver.js b/testing/marionette/driver.js --- a/testing/marionette/driver.js +++ b/testing/marionette/driver.js @@ -876,17 +876,17 @@ GeckoDriver.prototype.executeScript = fu * JavaScript notion of null or undefined. * * @throws ScriptTimeoutError * If the script was interrupted due to reaching the {@code * scriptTimeout} or default timeout. * @throws JavaScriptError * If an Error was thrown whilst evaluating the script. */ -GeckoDriver.prototype.executeAsyncScript = function(cmd, resp) { +GeckoDriver.prototype.executeAsyncScript = function*(cmd, resp) { let {script, args, scriptTimeout} = cmd.parameters; scriptTimeout = scriptTimeout || this.scriptTimeout; let opts = { sandboxName: cmd.parameters.sandbox, newSandbox: !!(typeof cmd.parameters.newSandbox == "undefined") || cmd.parameters.newSandbox, filename: cmd.parameters.filename, @@ -926,17 +926,17 @@ GeckoDriver.prototype.execute_ = functio }; /** * Execute pure JavaScript. Used to execute simpletest harness tests, * which are like mochitests only injected using Marionette. * * Scripts are expected to call the {@code finish} global when done. */ -GeckoDriver.prototype.executeJSScript = function(cmd, resp) { +GeckoDriver.prototype.executeJSScript = function*(cmd, resp) { let {script, args, scriptTimeout} = cmd.parameters; scriptTimeout = scriptTimeout || this.scriptTimeout; let opts = { filename: cmd.parameters.filename, line: cmd.parameters.line, async: cmd.parameters.async, }; diff --git a/testing/mochitest/server.js b/testing/mochitest/server.js --- a/testing/mochitest/server.js +++ b/testing/mochitest/server.js @@ -366,17 +366,17 @@ function serverDebug(metadata, response) // // DIRECTORY LISTINGS // /** * Creates a generator that iterates over the contents of * an nsIFile directory. */ -function dirIter(dir) +function* dirIter(dir) { var en = dir.directoryEntries; while (en.hasMoreElements()) { var file = en.getNext(); yield file.QueryInterface(Ci.nsILocalFile); } } diff --git a/testing/mochitest/tests/browser/browser_add_task.js b/testing/mochitest/tests/browser/browser_add_task.js --- a/testing/mochitest/tests/browser/browser_add_task.js +++ b/testing/mochitest/tests/browser/browser_add_task.js @@ -10,22 +10,22 @@ function executeWithTimeout() { return new Promise(resolve => executeSoon(function() { ok(true, "we get here after a timeout"); resolve(); }) ); } -add_task(function asyncTest_no1() { +add_task(function* asyncTest_no1() { yield executeWithTimeout(); test1Complete = true; }); -add_task(function asyncTest_no2() { +add_task(function* asyncTest_no2() { yield executeWithTimeout(); test2Complete = true; }); add_task(function() { ok(test1Complete, "We have been through test 1"); ok(test2Complete, "We have been through test 2"); });