Skip to content

Commit fa089d6

Browse files
nodejs-github-bottargos
authored andcommitted
test: update WPT for dom/abort to dc928169ee
PR-URL: #58644 Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Ethan Arrowood <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent 9b28f40 commit fa089d6

File tree

7 files changed

+48
-31
lines changed

7 files changed

+48
-31
lines changed

test/fixtures/wpt/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Last update:
1313
- common: https://github.com/web-platform-tests/wpt/tree/dbd648158d/common
1414
- compression: https://github.com/web-platform-tests/wpt/tree/67880a4eb8/compression
1515
- console: https://github.com/web-platform-tests/wpt/tree/e48251b778/console
16-
- dom/abort: https://github.com/web-platform-tests/wpt/tree/0143fe244b/dom/abort
16+
- dom/abort: https://github.com/web-platform-tests/wpt/tree/dc928169ee/dom/abort
1717
- dom/events: https://github.com/web-platform-tests/wpt/tree/0a811c5161/dom/events
1818
- encoding: https://github.com/web-platform-tests/wpt/tree/1ac8deee08/encoding
1919
- fetch/data-urls/resources: https://github.com/web-platform-tests/wpt/tree/7c79d998ff/fetch/data-urls/resources
Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// META: global=window,dedicatedworker,shadowrealm
2+
13
test(t => {
24
const signal = AbortSignal.abort();
35
assert_true(signal instanceof AbortSignal, "returned object is an AbortSignal");
@@ -10,31 +12,3 @@ async_test(t => {
1012
s.onabort = t.unreached_func("abort event handler called");
1113
t.step_timeout(() => { t.done(); }, 2000);
1214
}, "signal returned by AbortSignal.abort() should not fire abort event");
13-
14-
test(t => {
15-
const signal = AbortSignal.timeout(0);
16-
assert_true(signal instanceof AbortSignal, "returned object is an AbortSignal");
17-
assert_false(signal.aborted, "returned signal is not already aborted");
18-
}, "AbortSignal.timeout() returns a non-aborted signal");
19-
20-
async_test(t => {
21-
const signal = AbortSignal.timeout(5);
22-
signal.onabort = t.step_func_done(() => {
23-
assert_true(signal.aborted, "signal is aborted");
24-
assert_true(signal.reason instanceof DOMException, "signal.reason is a DOMException");
25-
assert_equals(signal.reason.name, "TimeoutError", "signal.reason is a TimeoutError");
26-
});
27-
}, "Signal returned by AbortSignal.timeout() times out");
28-
29-
async_test(t => {
30-
let result = "";
31-
for (const value of ["1", "2", "3"]) {
32-
const signal = AbortSignal.timeout(5);
33-
signal.onabort = t.step_func(() => { result += value; });
34-
}
35-
36-
const signal = AbortSignal.timeout(5);
37-
signal.onabort = t.step_func_done(() => {
38-
assert_equals(result, "123", "Timeout order should be 123");
39-
});
40-
}, "AbortSignal timeouts fire in order");

test/fixtures/wpt/dom/abort/event.any.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// META: global=window,dedicatedworker,shadowrealm
2+
13
test(t => {
24
const c = new AbortController(),
35
s = c.signal;
@@ -141,9 +143,12 @@ test(t => {
141143

142144
test(t => {
143145
const reason = new Error('boom');
146+
const message = reason.message;
144147
const signal = AbortSignal.abort(reason);
145148
assert_true(signal.aborted);
146149
assert_throws_exactly(reason, () => signal.throwIfAborted());
150+
assert_equals(reason.message, message,
151+
"abort.reason should not be changed by throwIfAborted()");
147152
}, "throwIfAborted() should throw abort.reason if signal aborted");
148153

149154
test(t => {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// META: global=shadowrealm
2+
3+
test(t => {
4+
assert_not_own_property(AbortSignal, "timeout", "AbortSignal does not have a 'timeout' property");
5+
}, "AbortSignal.timeout() is not exposed in ShadowRealm");
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// META: global=window,dedicatedworker
2+
3+
test(t => {
4+
const signal = AbortSignal.timeout(0);
5+
assert_true(signal instanceof AbortSignal, "returned object is an AbortSignal");
6+
assert_false(signal.aborted, "returned signal is not already aborted");
7+
}, "AbortSignal.timeout() returns a non-aborted signal");
8+
9+
async_test(t => {
10+
const signal = AbortSignal.timeout(5);
11+
signal.onabort = t.step_func_done(() => {
12+
assert_true(signal.aborted, "signal is aborted");
13+
assert_true(signal.reason instanceof DOMException, "signal.reason is a DOMException");
14+
assert_equals(signal.reason.name, "TimeoutError", "signal.reason is a TimeoutError");
15+
});
16+
}, "Signal returned by AbortSignal.timeout() times out");
17+
18+
async_test(t => {
19+
let result = "";
20+
for (const value of ["1", "2", "3"]) {
21+
const signal = AbortSignal.timeout(5);
22+
signal.onabort = t.step_func(() => { result += value; });
23+
}
24+
25+
const signal = AbortSignal.timeout(5);
26+
signal.onabort = t.step_func_done(() => {
27+
assert_equals(result, "123", "Timeout order should be 123");
28+
});
29+
}, "AbortSignal timeouts fire in order");

test/fixtures/wpt/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"path": "console"
1313
},
1414
"dom/abort": {
15-
"commit": "0143fe244b3d622441717ce630e0114eb204f9a7",
15+
"commit": "dc928169ee38969433af668319a73ed9196ffbee",
1616
"path": "dom/abort"
1717
},
1818
"dom/events": {

test/wpt/status/dom/abort.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
{}
1+
{
2+
"timeout-shadowrealm.any.js": {
3+
"skip": "ShadowRealm support is not enabled"
4+
}
5+
}

0 commit comments

Comments
 (0)