diff --git a/test/harness/sth.js b/test/harness/sth.js index cd05685e18..d100e160da 100644 --- a/test/harness/sth.js +++ b/test/harness/sth.js @@ -91,6 +91,9 @@ function BrowserRunner() { currentTest.code = codeString; } + function isAsyncTest(code) { + return /\$DONE()/.test(code)); + } /* Run the test. */ this.run = function (test, code) { @@ -208,8 +211,8 @@ function BrowserRunner() { //this is mainly applicable for consoles that do not have setTimeout support //idoc.writeln(""); - if(setTimeout === undefined && /\$DONE()/.test(code)){ - idoc.writeln(""); } @@ -225,15 +228,15 @@ function BrowserRunner() { idoc.writeln(""); idoc.close(); diff --git a/test/harness/timer.js b/test/harness/timer.js index 69762d83f5..4dddbb3a1b 100644 --- a/test/harness/timer.js +++ b/test/harness/timer.js @@ -12,7 +12,7 @@ if(Promise !== undefined && this.setTimeout === undefined) var end = start + delay; function check(){ var timeLeft = end - Date.now(); - if(timeLeft) + if(timeLeft > 0) p.then(check); else callback(); diff --git a/tools/packaging/test262.py b/tools/packaging/test262.py index 5a1917eaa8..1e7ad1689e 100755 --- a/tools/packaging/test262.py +++ b/tools/packaging/test262.py @@ -260,11 +260,14 @@ class TestCase(object): # "var testDescrip = " + str(self.testRecord) + ';\n\n' + \ source = self.suite.GetInclude("cth.js") + \ self.suite.GetInclude("sta.js") + \ - self.suite.GetInclude("ed.js") + \ - self.suite.GetInclude("testBuiltInObject.js") + \ - self.suite.GetInclude("testIntl.js") + \ - self.suite.GetInclude("timer.js") + \ - self.suite.GetInclude("doneprintHandle.js").replace('print', self.suite.print_handle) + \ + self.suite.GetInclude("ed.js") + + if self.IsAsyncTest(): + source = source + \ + self.suite.GetInclude("timer.js") + \ + self.suite.GetInclude("doneprintHandle.js").replace('print', self.suite.print_handle) + + source = source + \ self.GetAdditionalIncludes() + \ self.test + '\n'