Commit f5c17f37 authored by Hiroshige Hayashizaki's avatar Hiroshige Hayashizaki Committed by Commit Bot

[WPT] Avoid timeout in workers/interfaces/WorkerGlobalScope/onerror/message.html

To avoid timeout, this CL

- Removes arbitrary timeout of 2 seconds, and
- Splits `message.html` into multiple test files.

This is to unblock V8 roll:
https://chromium-review.googlesource.com/c/chromium/src/+/2401062

Bug: 590219, 1127235
Change-Id: I86a750f3b158797a393506bf7be32ecc573e73f8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2405726
Commit-Queue: Hiroshige Hayashizaki <hiroshige@chromium.org>
Reviewed-by: default avatarKenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806098}
parent 011c27ce
This is a testharness.js-based test. This is a testharness.js-based test.
PASS Throw Error in toplevel: classic: listener
PASS Throw Error in toplevel: classic: handler
PASS Throw Error in toplevel: module: listener
PASS Throw Error in toplevel: module: handler
FAIL Throw DOMException-TypeError in toplevel: classic: listener assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught " FAIL Throw DOMException-TypeError in toplevel: classic: listener assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
FAIL Throw DOMException-TypeError in toplevel: classic: handler assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught " FAIL Throw DOMException-TypeError in toplevel: classic: handler assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
FAIL Throw DOMException-TypeError in toplevel: module: listener assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
FAIL Throw DOMException-TypeError in toplevel: module: handler assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
PASS Throw Error in setTimeout-function: classic: listener
PASS Throw Error in setTimeout-function: classic: handler
PASS Throw Error in setTimeout-function: module: listener
PASS Throw Error in setTimeout-function: module: handler
PASS Throw DOMException-TypeError in setTimeout-function: classic: listener PASS Throw DOMException-TypeError in setTimeout-function: classic: listener
PASS Throw DOMException-TypeError in setTimeout-function: classic: handler PASS Throw DOMException-TypeError in setTimeout-function: classic: handler
PASS Throw DOMException-TypeError in setTimeout-function: module: listener
PASS Throw DOMException-TypeError in setTimeout-function: module: handler
PASS Throw Error in setTimeout-string: classic: listener
PASS Throw Error in setTimeout-string: classic: handler
PASS Throw Error in setTimeout-string: module: listener
PASS Throw Error in setTimeout-string: module: handler
FAIL Throw DOMException-TypeError in setTimeout-string: classic: listener assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught " FAIL Throw DOMException-TypeError in setTimeout-string: classic: listener assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
FAIL Throw DOMException-TypeError in setTimeout-string: classic: handler assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught " FAIL Throw DOMException-TypeError in setTimeout-string: classic: handler assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
FAIL Throw DOMException-TypeError in setTimeout-string: module: listener assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
FAIL Throw DOMException-TypeError in setTimeout-string: module: handler assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
PASS Throw Error in onmessage: classic: listener
PASS Throw Error in onmessage: classic: handler
PASS Throw Error in onmessage: module: listener
PASS Throw Error in onmessage: module: handler
PASS Throw DOMException-TypeError in onmessage: classic: listener PASS Throw DOMException-TypeError in onmessage: classic: listener
PASS Throw DOMException-TypeError in onmessage: classic: handler PASS Throw DOMException-TypeError in onmessage: classic: handler
PASS Throw DOMException-TypeError in onmessage: module: listener
PASS Throw DOMException-TypeError in onmessage: module: handler
PASS Throw Error in onerror: classic: listener
PASS Throw Error in onerror: classic: handler
PASS Throw Error in onerror: module: listener
PASS Throw Error in onerror: module: handler
PASS Throw DOMException-TypeError in onerror: classic: listener PASS Throw DOMException-TypeError in onerror: classic: listener
PASS Throw DOMException-TypeError in onerror: classic: handler PASS Throw DOMException-TypeError in onerror: classic: handler
PASS Throw DOMException-TypeError in onerror: module: listener
PASS Throw DOMException-TypeError in onerror: module: handler
Harness: the test ran to completion. Harness: the test ran to completion.
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./message-helper.js"></script>
<script>
runTest('classic', 'DOMException-TypeError');
</script>
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./message-helper.js"></script>
<script>
runTest('classic', 'Error');
</script>
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
// The error's `message` values in Worker error event handlers are tested. // The error's `message` values in Worker error event handlers are tested.
// While not explicitly specified in the HTML spec, we expect some information // While not explicitly specified in the HTML spec, we expect some information
// about thrown errors (e.g. original message, the string "TypeError", etc.) // about thrown errors (e.g. original message, the string "TypeError", etc.)
// to appear in the `message`. // to appear in the `message`.
function prepareHandler(t, error, expectedCount) { function prepareHandler(t, error, expectedCount) {
t.step_timeout(() => assert_unreached('timeout'), 2000);
let count = 0; let count = 0;
return t.step_func(e => { return t.step_func(e => {
e.preventDefault(); e.preventDefault();
...@@ -39,31 +34,28 @@ function expectErrors(worker, error, expectedCount, title) { ...@@ -39,31 +34,28 @@ function expectErrors(worker, error, expectedCount, title) {
}, title + ': handler'); }, title + ': handler');
} }
for (const location of ['toplevel', function runTest(type, error) {
'setTimeout-function', for (const location of ['toplevel',
'setTimeout-string', 'setTimeout-function',
'onmessage', 'setTimeout-string',
'onerror']) { 'onmessage',
for (const error of ['Error', 'DOMException-TypeError']) { 'onerror']) {
for (const type of ['classic', 'module']) { const worker = new Worker(
const worker = new Worker( 'throw.js?throw-in-' + location + '&error=' + error,
'throw.js?throw-in-' + location + '&error=' + error, {type});
{type}); let expectedCount = 1;
let expectedCount = 1; if (location === 'onmessage') {
if (location === 'onmessage') { // This makes the worker's message handler to throw an error.
// This makes the worker's message handler to throw an error. worker.postMessage('foo');
worker.postMessage('foo'); }
} if (location === 'onerror') {
if (location === 'onerror') { // This makes the worker's message handler to throw an error,
// This makes the worker's message handler to throw an error, // AND worker's error handler to throw another error.
// AND worker's error handler to throw another error. // Therefore we expect two errors here.
// Therefore we expect two errors here. worker.postMessage('foo');
worker.postMessage('foo'); expectedCount = 2;
expectedCount = 2;
}
expectErrors(worker, error, expectedCount,
'Throw ' + error + ' in ' + location + ': ' + type);
} }
expectErrors(worker, error, expectedCount,
'Throw ' + error + ' in ' + location + ': ' + type);
} }
} }
</script>
This is a testharness.js-based test.
FAIL Throw DOMException-TypeError in toplevel: module: listener assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
FAIL Throw DOMException-TypeError in toplevel: module: handler assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
PASS Throw DOMException-TypeError in setTimeout-function: module: listener
PASS Throw DOMException-TypeError in setTimeout-function: module: handler
FAIL Throw DOMException-TypeError in setTimeout-string: module: listener assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
FAIL Throw DOMException-TypeError in setTimeout-string: module: handler assert_regexp_match: e.message should contain the message of the thrown error expected object "/Throw in/" but got "Uncaught "
PASS Throw DOMException-TypeError in onmessage: module: listener
PASS Throw DOMException-TypeError in onmessage: module: handler
PASS Throw DOMException-TypeError in onerror: module: listener
PASS Throw DOMException-TypeError in onerror: module: handler
Harness: the test ran to completion.
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./message-helper.js"></script>
<script>
runTest('module', 'DOMException-TypeError');
</script>
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="./message-helper.js"></script>
<script>
runTest('module', 'Error');
</script>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment