Skip to content

Commit 3318fb1

Browse files
after review
Signed-off-by: marcopiraccini <marco.piraccini@gmail.com>
1 parent d094730 commit 3318fb1

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

‎test/common/wpt/worker.js‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ function run(workerData) {
130130
// eslint-disable-next-line no-undef
131131
add_completion_callback((_, status) => {
132132
clearTimeout(timeout);
133-
// Match WPT semantics: exceptions thrown after done() do not fail the
134-
// test. This also replaces the reporting handler of the process backend.
135-
process.removeAllListeners('uncaughtException');
136-
process.on('uncaughtException', () => {});
137133
send({
138134
type: 'completion',
139135
status,

‎test/wpt/test-timers.js‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
'use strict';
22

3+
const assert = require('assert');
4+
const { basename } = require('path');
35
const { WPTRunner } = require('../common/wpt');
46

57
const runner = new WPTRunner('html/webappapis/timers', { concurrency: 1 });
68

9+
runner.setScriptModifier((script) => {
10+
if (!['type-long-settimeout.any.js', 'type-long-setinterval.any.js']
11+
.includes(basename(script.filename))) return;
12+
13+
// Cancel the failure timer when the test completes so it cannot throw
14+
// while the runner is still processing the completion message.
15+
const failureTimer = 'setTimeout(assert_unreached, 100);';
16+
assert(script.code.includes(failureTimer), `Unexpected contents of ${script.filename}`);
17+
script.code = script.code.replace(failureTimer,
18+
'const failureTimer = setTimeout(assert_unreached, 100);\n' +
19+
'add_completion_callback(() => clearTimeout(failureTimer));');
20+
});
21+
722
runner.runJsTests();

0 commit comments

Comments
 (0)