test: update WPT for dom/abort to dc928169ee
PR-URL: https://github.com/nodejs/node/pull/58644 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Ethan Arrowood <ethan@arrowood.dev> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
parent
6584d5f811
commit
fce45024bf
2
test/fixtures/wpt/README.md
vendored
2
test/fixtures/wpt/README.md
vendored
@ -13,7 +13,7 @@ Last update:
|
||||
- common: https://github.com/web-platform-tests/wpt/tree/dbd648158d/common
|
||||
- compression: https://github.com/web-platform-tests/wpt/tree/67880a4eb8/compression
|
||||
- console: https://github.com/web-platform-tests/wpt/tree/e48251b778/console
|
||||
- dom/abort: https://github.com/web-platform-tests/wpt/tree/0143fe244b/dom/abort
|
||||
- dom/abort: https://github.com/web-platform-tests/wpt/tree/dc928169ee/dom/abort
|
||||
- dom/events: https://github.com/web-platform-tests/wpt/tree/0a811c5161/dom/events
|
||||
- encoding: https://github.com/web-platform-tests/wpt/tree/1ac8deee08/encoding
|
||||
- fetch/data-urls/resources: https://github.com/web-platform-tests/wpt/tree/7c79d998ff/fetch/data-urls/resources
|
||||
|
30
test/fixtures/wpt/dom/abort/AbortSignal.any.js
vendored
30
test/fixtures/wpt/dom/abort/AbortSignal.any.js
vendored
@ -1,3 +1,5 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
|
||||
test(t => {
|
||||
const signal = AbortSignal.abort();
|
||||
assert_true(signal instanceof AbortSignal, "returned object is an AbortSignal");
|
||||
@ -10,31 +12,3 @@ async_test(t => {
|
||||
s.onabort = t.unreached_func("abort event handler called");
|
||||
t.step_timeout(() => { t.done(); }, 2000);
|
||||
}, "signal returned by AbortSignal.abort() should not fire abort event");
|
||||
|
||||
test(t => {
|
||||
const signal = AbortSignal.timeout(0);
|
||||
assert_true(signal instanceof AbortSignal, "returned object is an AbortSignal");
|
||||
assert_false(signal.aborted, "returned signal is not already aborted");
|
||||
}, "AbortSignal.timeout() returns a non-aborted signal");
|
||||
|
||||
async_test(t => {
|
||||
const signal = AbortSignal.timeout(5);
|
||||
signal.onabort = t.step_func_done(() => {
|
||||
assert_true(signal.aborted, "signal is aborted");
|
||||
assert_true(signal.reason instanceof DOMException, "signal.reason is a DOMException");
|
||||
assert_equals(signal.reason.name, "TimeoutError", "signal.reason is a TimeoutError");
|
||||
});
|
||||
}, "Signal returned by AbortSignal.timeout() times out");
|
||||
|
||||
async_test(t => {
|
||||
let result = "";
|
||||
for (const value of ["1", "2", "3"]) {
|
||||
const signal = AbortSignal.timeout(5);
|
||||
signal.onabort = t.step_func(() => { result += value; });
|
||||
}
|
||||
|
||||
const signal = AbortSignal.timeout(5);
|
||||
signal.onabort = t.step_func_done(() => {
|
||||
assert_equals(result, "123", "Timeout order should be 123");
|
||||
});
|
||||
}, "AbortSignal timeouts fire in order");
|
||||
|
5
test/fixtures/wpt/dom/abort/event.any.js
vendored
5
test/fixtures/wpt/dom/abort/event.any.js
vendored
@ -1,3 +1,5 @@
|
||||
// META: global=window,dedicatedworker,shadowrealm
|
||||
|
||||
test(t => {
|
||||
const c = new AbortController(),
|
||||
s = c.signal;
|
||||
@ -141,9 +143,12 @@ test(t => {
|
||||
|
||||
test(t => {
|
||||
const reason = new Error('boom');
|
||||
const message = reason.message;
|
||||
const signal = AbortSignal.abort(reason);
|
||||
assert_true(signal.aborted);
|
||||
assert_throws_exactly(reason, () => signal.throwIfAborted());
|
||||
assert_equals(reason.message, message,
|
||||
"abort.reason should not be changed by throwIfAborted()");
|
||||
}, "throwIfAborted() should throw abort.reason if signal aborted");
|
||||
|
||||
test(t => {
|
||||
|
5
test/fixtures/wpt/dom/abort/timeout-shadowrealm.any.js
vendored
Normal file
5
test/fixtures/wpt/dom/abort/timeout-shadowrealm.any.js
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
// META: global=shadowrealm
|
||||
|
||||
test(t => {
|
||||
assert_not_own_property(AbortSignal, "timeout", "AbortSignal does not have a 'timeout' property");
|
||||
}, "AbortSignal.timeout() is not exposed in ShadowRealm");
|
29
test/fixtures/wpt/dom/abort/timeout.any.js
vendored
Normal file
29
test/fixtures/wpt/dom/abort/timeout.any.js
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
// META: global=window,dedicatedworker
|
||||
|
||||
test(t => {
|
||||
const signal = AbortSignal.timeout(0);
|
||||
assert_true(signal instanceof AbortSignal, "returned object is an AbortSignal");
|
||||
assert_false(signal.aborted, "returned signal is not already aborted");
|
||||
}, "AbortSignal.timeout() returns a non-aborted signal");
|
||||
|
||||
async_test(t => {
|
||||
const signal = AbortSignal.timeout(5);
|
||||
signal.onabort = t.step_func_done(() => {
|
||||
assert_true(signal.aborted, "signal is aborted");
|
||||
assert_true(signal.reason instanceof DOMException, "signal.reason is a DOMException");
|
||||
assert_equals(signal.reason.name, "TimeoutError", "signal.reason is a TimeoutError");
|
||||
});
|
||||
}, "Signal returned by AbortSignal.timeout() times out");
|
||||
|
||||
async_test(t => {
|
||||
let result = "";
|
||||
for (const value of ["1", "2", "3"]) {
|
||||
const signal = AbortSignal.timeout(5);
|
||||
signal.onabort = t.step_func(() => { result += value; });
|
||||
}
|
||||
|
||||
const signal = AbortSignal.timeout(5);
|
||||
signal.onabort = t.step_func_done(() => {
|
||||
assert_equals(result, "123", "Timeout order should be 123");
|
||||
});
|
||||
}, "AbortSignal timeouts fire in order");
|
2
test/fixtures/wpt/versions.json
vendored
2
test/fixtures/wpt/versions.json
vendored
@ -12,7 +12,7 @@
|
||||
"path": "console"
|
||||
},
|
||||
"dom/abort": {
|
||||
"commit": "0143fe244b3d622441717ce630e0114eb204f9a7",
|
||||
"commit": "dc928169ee38969433af668319a73ed9196ffbee",
|
||||
"path": "dom/abort"
|
||||
},
|
||||
"dom/events": {
|
||||
|
@ -1 +1,5 @@
|
||||
{}
|
||||
{
|
||||
"timeout-shadowrealm.any.js": {
|
||||
"skip": "ShadowRealm support is not enabled"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user