Bug 1233537 - remove support for generatorTest, r?jmaher
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -782,26 +782,16 @@ Tester.prototype = {
let result = new testResult(isExpected, name, ex, false, stack);
currentTest.addResult(result);
}
Promise.Debugging.flushUncaughtErrors();
this.SimpleTest.info("Leaving test " + task.name);
}
this.finish();
}.bind(currentScope));
- } else if ("generatorTest" in this.currentTest.scope) {
- if ("test" in this.currentTest.scope) {
- throw "Cannot run both a generator test and a normal test at the same time.";
- }
-
- // This test is a generator. It will not finish immediately.
- this.currentTest.scope.waitForExplicitFinish();
- var result = this.currentTest.scope.generatorTest();
- this.currentTest.scope.__generator = result;
- result.next();
} else if (typeof this.currentTest.scope.test == "function") {
this.currentTest.scope.test();
} else {
throw "This test didn't call add_task, nor did it define a generatorTest() function, nor did it define a test() function, so we don't know how to run it.";
}
} catch (ex) {
let isExpected = !!this.SimpleTest.isExpectingUncaughtException();
if (!this.SimpleTest.isIgnoringAllUncaughtExceptions()) {
@@ -981,45 +971,16 @@ function testScope(aTester, aTest, expec
this.executeSoon = function test_executeSoon(func) {
Services.tm.mainThread.dispatch({
run: function() {
func();
}
}, Ci.nsIThread.DISPATCH_NORMAL);
};
- this.nextStep = function test_nextStep(arg) {
- if (self.__done) {
- aTest.addResult(new testResult(false, "nextStep was called too many times", "", false));
- return;
- }
-
- if (!self.__generator) {
- aTest.addResult(new testResult(false, "nextStep called with no generator", "", false));
- self.finish();
- return;
- }
-
- try {
- self.__generator.send(arg);
- } catch (ex if ex instanceof StopIteration) {
- // StopIteration means test is finished.
- self.finish();
- } catch (ex) {
- var isExpected = !!self.SimpleTest.isExpectingUncaughtException();
- if (!self.SimpleTest.isIgnoringAllUncaughtExceptions()) {
- aTest.addResult(new testResult(isExpected, "Exception thrown", ex, false));
- self.SimpleTest.expectUncaughtException(false);
- } else {
- aTest.addResult(new testMessage("Exception thrown: " + ex));
- }
- self.finish();
- }
- };
-
this.waitForExplicitFinish = function test_waitForExplicitFinish() {
self.__done = false;
};
this.waitForFocus = function test_waitForFocus(callback, targetWindow, expectBlankPage) {
self.SimpleTest.waitForFocus(callback, targetWindow, expectBlankPage);
};
@@ -1089,17 +1050,16 @@ function testScope(aTester, aTest, expec
self.__tester.dumper.structuredLogger.deactivateBuffering();
self.registerCleanupFunction(function() {
self.__tester.dumper.structuredLogger.activateBuffering();
})
};
}
testScope.prototype = {
__done: true,
- __generator: null,
__tasks: null,
__waitTimer: null,
__cleanupFunctions: [],
__timeoutFactor: 1,
__expectedMinAsserts: 0,
__expectedMaxAsserts: 0,
__expected: 'pass',