Skip to content

Commit 34fef7b

Browse files
committed
test: update wpt
1 parent eab9729 commit 34fef7b

File tree

248 files changed

+8671
-1339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

248 files changed

+8671
-1339
lines changed

test/fixtures/wpt/FileAPI/BlobURL/cross-partition.tentative.https.html

+313-84
Large diffs are not rendered by default.

test/fixtures/wpt/FileAPI/blob/Blob-constructor.any.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -290,14 +290,22 @@ test_blob(function() {
290290
new Int16Array([0x4150, 0x5353]),
291291
new Uint32Array([0x53534150]),
292292
new Int32Array([0x53534150]),
293-
new Float16Array([2.65625, 58.59375]),
294293
new Float32Array([0xD341500000])
295294
]);
296295
}, {
297-
expected: "PASSPASSPASSPASSPASSPASSPASSPASS",
296+
expected: "PASSPASSPASSPASSPASSPASSPASS",
298297
type: "",
299298
desc: "Passing typed arrays as elements of the blobParts array should work."
300299
});
300+
test_blob(function() {
301+
return new Blob([
302+
new Float16Array([2.65625, 58.59375])
303+
]);
304+
}, {
305+
expected: "PASS",
306+
type: "",
307+
desc: "Passing a Float16Array as element of the blobParts array should work."
308+
});
301309
test_blob(function() {
302310
return new Blob([
303311
// 0x535 3415053534150

test/fixtures/wpt/README.md

+20-20
Original file line numberDiff line numberDiff line change
@@ -10,32 +10,32 @@ See [test/wpt](../../wpt/README.md) for information on how these tests are run.
1010

1111
Last update:
1212

13-
- common: https://github.com/web-platform-tests/wpt/tree/dbd648158d/common
14-
- compression: https://github.com/web-platform-tests/wpt/tree/5aa50dd415/compression
15-
- console: https://github.com/web-platform-tests/wpt/tree/767ae35464/console
16-
- dom/abort: https://github.com/web-platform-tests/wpt/tree/d1f1ecbd52/dom/abort
17-
- dom/events: https://github.com/web-platform-tests/wpt/tree/ab8999891c/dom/events
13+
- common: https://github.com/web-platform-tests/wpt/tree/d8da9d4d1d/common
14+
- compression: https://github.com/web-platform-tests/wpt/tree/da8d6860b2/compression
15+
- console: https://github.com/web-platform-tests/wpt/tree/e48251b778/console
16+
- dom/abort: https://github.com/web-platform-tests/wpt/tree/07a9d09a8f/dom/abort
17+
- dom/events: https://github.com/web-platform-tests/wpt/tree/0a811c5161/dom/events
1818
- encoding: https://github.com/web-platform-tests/wpt/tree/5aa50dd415/encoding
1919
- fetch/data-urls/resources: https://github.com/web-platform-tests/wpt/tree/7c79d998ff/fetch/data-urls/resources
20-
- FileAPI: https://github.com/web-platform-tests/wpt/tree/cceaf3628d/FileAPI
21-
- hr-time: https://github.com/web-platform-tests/wpt/tree/34cafd797e/hr-time
20+
- FileAPI: https://github.com/web-platform-tests/wpt/tree/1d5fb397da/FileAPI
21+
- hr-time: https://github.com/web-platform-tests/wpt/tree/614e81711c/hr-time
2222
- html/webappapis/atob: https://github.com/web-platform-tests/wpt/tree/f267e1dca6/html/webappapis/atob
23-
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing
24-
- html/webappapis/structured-clone: https://github.com/web-platform-tests/wpt/tree/47d3fb280c/html/webappapis/structured-clone
25-
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/5873f2d8f1/html/webappapis/timers
26-
- interfaces: https://github.com/web-platform-tests/wpt/tree/e90ece61d6/interfaces
27-
- performance-timeline: https://github.com/web-platform-tests/wpt/tree/17ebc3aea0/performance-timeline
28-
- resource-timing: https://github.com/web-platform-tests/wpt/tree/22d38586d0/resource-timing
29-
- resources: https://github.com/web-platform-tests/wpt/tree/1e140d63ec/resources
30-
- streams: https://github.com/web-platform-tests/wpt/tree/2bd26e124c/streams
31-
- url: https://github.com/web-platform-tests/wpt/tree/6a39784534/url
23+
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/22ecfc9bac/html/webappapis/microtask-queuing
24+
- html/webappapis/structured-clone: https://github.com/web-platform-tests/wpt/tree/c29dcddf37/html/webappapis/structured-clone
25+
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/7a0548ac47/html/webappapis/timers
26+
- interfaces: https://github.com/web-platform-tests/wpt/tree/ab18bf796b/interfaces
27+
- performance-timeline: https://github.com/web-platform-tests/wpt/tree/94caab7038/performance-timeline
28+
- resource-timing: https://github.com/web-platform-tests/wpt/tree/95e7763ca9/resource-timing
29+
- resources: https://github.com/web-platform-tests/wpt/tree/ff5b1bc4db/resources
30+
- streams: https://github.com/web-platform-tests/wpt/tree/b5f2d0c48a/streams
31+
- url: https://github.com/web-platform-tests/wpt/tree/30de089033/url
3232
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
33-
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
34-
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
33+
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/140f5c80fd/wasm/jsapi
34+
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/28456b73ca/wasm/webapi
3535
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/6748a0a246/WebCryptoAPI
3636
- webidl/ecmascript-binding/es-exceptions: https://github.com/web-platform-tests/wpt/tree/a370aad338/webidl/ecmascript-binding/es-exceptions
37-
- webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/e97fac4791/webmessaging/broadcastchannel
38-
- webstorage: https://github.com/web-platform-tests/wpt/tree/9dafa89214/webstorage
37+
- webmessaging/broadcastchannel: https://github.com/web-platform-tests/wpt/tree/6495c91853/webmessaging/broadcastchannel
38+
- webstorage: https://github.com/web-platform-tests/wpt/tree/1291340aaa/webstorage
3939

4040
[Web Platform Tests]: https://github.com/web-platform-tests/wpt
4141
[`git node wpt`]: https://github.com/nodejs/node-core-utils/blob/main/docs/git-node.md#git-node-wpt

test/fixtures/wpt/common/META.yml

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
suggested_reviewers:
2-
- zqzhang
32
- deniak

test/fixtures/wpt/common/dispatcher/dispatcher.js

+27-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,32 @@
11
// Define a universal message passing API. It works cross-origin and across
22
// browsing context groups.
33
const dispatcher_path = "/common/dispatcher/dispatcher.py";
4-
const dispatcher_url = new URL(dispatcher_path, location.href).href;
4+
5+
// Finds the nearest ancestor window that has a non srcdoc location. This should
6+
// give us a usable location for constructing further URLs.
7+
function findLocationFromAncestors(w) {
8+
if (w.location.href == 'about:srcdoc') {
9+
return findLocationFromAncestors(w.parent);
10+
}
11+
return w.location;
12+
}
13+
14+
// Handles differences between workers vs frames (src vs srcdoc).
15+
function findLocation() {
16+
if (location.href == 'about:srcdoc') {
17+
return findLocationFromAncestors(window.parent);
18+
}
19+
if (location.protocol == 'blob:' || location.protocol == 'data:') {
20+
// Allows working around blob and data URLs.
21+
if (self.document && self.document.baseURI) {
22+
return self.document.baseURI;
23+
}
24+
}
25+
return location;
26+
}
27+
28+
const dispatcherLocation = findLocation();
29+
const dispatcher_url = new URL(dispatcher_path, dispatcherLocation).href;
530

631
// Return a promise, limiting the number of concurrent accesses to a shared
732
// resources to |max_concurrent_access|.
@@ -138,7 +163,7 @@ const cacheableShowRequestHeaders = function(origin, uuid) {
138163
// protocol: (optional) Sets the returned URL's `protocol` property.
139164
// }
140165
function remoteExecutorUrl(uuid, options) {
141-
const url = new URL("/common/dispatcher/remote-executor.html", location);
166+
const url = new URL("/common/dispatcher/remote-executor.html", dispatcherLocation);
142167
url.searchParams.set("uuid", uuid);
143168

144169
if (options?.host) {

test/fixtures/wpt/common/dummy.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

test/fixtures/wpt/common/media.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ function getVideoURI(base)
99

1010
var videotag = document.createElement("video");
1111

12-
if ( videotag.canPlayType &&
13-
videotag.canPlayType('video/ogg; codecs="theora, vorbis"') )
12+
if ( videotag.canPlayType )
1413
{
15-
extension = '.ogv';
14+
if (videotag.canPlayType('video/webm; codecs="vp9, opus"') )
15+
{
16+
extension = '.webm';
17+
}
1618
}
1719

1820
return base + extension;
@@ -46,10 +48,10 @@ function getAudioURI(base)
4648
function getMediaContentType(url) {
4749
var extension = new URL(url, location).pathname.split(".").pop();
4850
var map = {
49-
"mp4": "video/mp4",
50-
"ogv": "application/ogg",
51-
"mp3": "audio/mp3",
52-
"oga": "application/ogg",
51+
"mp4" : "video/mp4",
52+
"webm": "video/webm",
53+
"mp3" : "audio/mp3",
54+
"oga" : "application/ogg",
5355
};
5456
return map[extension];
5557
}

test/fixtures/wpt/common/top-layer.js

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// This function is a version of test_driver.bless which works while there are
2+
// elements in the top layer:
3+
// https://github.com/web-platform-tests/wpt/issues/41218.
4+
// Pass it the element at the top of the top layer stack.
5+
window.blessTopLayer = async (topLayerElement) => {
6+
const button = document.createElement('button');
7+
topLayerElement.append(button);
8+
let wait_click = new Promise(resolve => button.addEventListener("click", resolve, {once: true}));
9+
await test_driver.click(button);
10+
await wait_click;
11+
button.remove();
12+
};
13+
14+
window.isTopLayer = (el) => {
15+
// A bit of a hack. Just test a few properties of the ::backdrop pseudo
16+
// element that change when in the top layer.
17+
const properties = ['right','background'];
18+
const testEl = document.createElement('div');
19+
document.body.appendChild(testEl);
20+
const computedStyle = getComputedStyle(testEl, '::backdrop');
21+
const nonTopLayerValues = properties.map(p => computedStyle[p]);
22+
testEl.remove();
23+
for(let i=0;i<properties.length;++i) {
24+
if (getComputedStyle(el,'::backdrop')[properties[i]] !== nonTopLayerValues[i]) {
25+
return true;
26+
}
27+
}
28+
return false;
29+
};

test/fixtures/wpt/compression/decompression-buffersource.tentative.any.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const bufferSourceChunksForDeflate = [
4949
},
5050
{
5151
name: 'Float16Array',
52-
value: new Float16Array(new Uint8Array(compressedBytesWithDeflate).buffer)
52+
value: () => new Float16Array(new Uint8Array(compressedBytesWithDeflate).buffer)
5353
},
5454
{
5555
name: 'Float32Array',
@@ -100,7 +100,7 @@ const bufferSourceChunksForGzip = [
100100
},
101101
{
102102
name: 'Float16Array',
103-
value: new Float16Array(new Uint8Array(compressedBytesWithGzip).buffer)
103+
value: () => new Float16Array(new Uint8Array(compressedBytesWithGzip).buffer)
104104
},
105105
{
106106
name: 'Float32Array',
@@ -151,7 +151,7 @@ const bufferSourceChunksForDeflateRaw = [
151151
},
152152
{
153153
name: 'Float16Array',
154-
value: new Float16Array(new Uint8Array(compressedBytesWithDeflateRaw).buffer)
154+
value: () => new Float16Array(new Uint8Array(compressedBytesWithDeflateRaw).buffer)
155155
},
156156
{
157157
name: 'Float32Array',
@@ -172,7 +172,7 @@ for (const chunk of bufferSourceChunksForDeflate) {
172172
const ds = new DecompressionStream('deflate');
173173
const reader = ds.readable.getReader();
174174
const writer = ds.writable.getWriter();
175-
const writePromise = writer.write(chunk.value);
175+
const writePromise = writer.write(typeof chunk.value === 'function' ? chunk.value() : chunk.value);
176176
writer.close();
177177
const { value } = await reader.read();
178178
assert_array_equals(Array.from(value), deflateExpectedChunkValue, 'value should match');
@@ -184,7 +184,7 @@ for (const chunk of bufferSourceChunksForGzip) {
184184
const ds = new DecompressionStream('gzip');
185185
const reader = ds.readable.getReader();
186186
const writer = ds.writable.getWriter();
187-
const writePromise = writer.write(chunk.value);
187+
const writePromise = writer.write(typeof chunk.value === 'function' ? chunk.value() : chunk.value);
188188
writer.close();
189189
const { value } = await reader.read();
190190
assert_array_equals(Array.from(value), gzipExpectedChunkValue, 'value should match');
@@ -196,7 +196,7 @@ for (const chunk of bufferSourceChunksForDeflateRaw) {
196196
const ds = new DecompressionStream('deflate-raw');
197197
const reader = ds.readable.getReader();
198198
const writer = ds.writable.getWriter();
199-
const writePromise = writer.write(chunk.value);
199+
const writePromise = writer.write(typeof chunk.value === 'function' ? chunk.value() : chunk.value);
200200
writer.close();
201201
const { value } = await reader.read();
202202
assert_array_equals(Array.from(value), deflateRawExpectedChunkValue, 'value should match');

test/fixtures/wpt/console/console-countReset-logging-manual.html

+5-1
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,25 @@
2424
console.count();
2525
console.countReset();
2626
console.count();
27+
console.countReset();
2728

2829
console.count(undefined);
2930
console.countReset(undefined);
3031
console.count(undefined);
32+
console.countReset(undefined);
3133

3234
console.count("default");
3335
console.countReset("default");
3436
console.count("default");
37+
console.countReset("default");
3538

3639
console.count({toString() {return "default"}});
3740
console.countReset({toString() {return "default"}});
3841
console.count({toString() {return "default"}});
42+
console.countReset({toString() {return "default"}});
3943

4044
console.count("a label");
41-
console.countReset();
45+
console.countReset("a label");
4246
console.count("a label");
4347

4448
console.countReset("b"); // should produce a warning
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// META: global=window,dedicatedworker,shadowrealm
2+
"use strict";
3+
// https://console.spec.whatwg.org/
4+
5+
test(() => {
6+
console.log(new Array(10000000).fill("x"));
7+
console.log(new Uint8Array(10000000));
8+
}, "Logging large arrays works");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// META: global=window,dedicatedworker,shadowrealm
2+
"use strict";
3+
// https://console.spec.whatwg.org/
4+
5+
test(() => {
6+
console.log(Symbol());
7+
console.log(Symbol("abc"));
8+
console.log(Symbol.for("def"));
9+
console.log(Symbol.isConcatSpreadable);
10+
}, "Logging a symbol doesn't throw");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
features:
2+
- name: aborting
3+
files: "**"
4+
- name: abortsignal-any
5+
files:
6+
- abort-signal-any.any.js
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html class=test-wait>
3+
<head>
4+
<title>AbortSignal::Any when source signal was garbage collected</title>
5+
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1908466">
6+
<link rel="author" title="Vincent Hilla" href="mailto:[email protected]">
7+
<script src="/common/gc.js"></script>
8+
</head>
9+
<body>
10+
<p>Test passes if the browser does not crash.</p>
11+
<script>
12+
async function test() {
13+
let controller = new AbortController();
14+
let signal = AbortSignal.any([controller.signal]);
15+
controller = undefined;
16+
await garbageCollect();
17+
AbortSignal.any([signal]);
18+
document.documentElement.classList.remove('test-wait');
19+
}
20+
test();
21+
</script>
22+
</body>
23+
</html>

test/fixtures/wpt/dom/abort/resources/abort-signal-any-tests.js

+39
Original file line numberDiff line numberDiff line change
@@ -182,4 +182,43 @@ function abortSignalAnyTests(signalInterface, controllerInterface) {
182182
controller.abort();
183183
assert_equals(result, "01234");
184184
}, `Abort events for ${desc} signals fire in the right order ${suffix}`);
185+
186+
test(t => {
187+
const controller = new controllerInterface();
188+
const signal1 = signalInterface.any([controller.signal]);
189+
const signal2 = signalInterface.any([signal1]);
190+
let eventFired = false;
191+
192+
controller.signal.addEventListener('abort', () => {
193+
const signal3 = signalInterface.any([signal2]);
194+
assert_true(controller.signal.aborted);
195+
assert_true(signal1.aborted);
196+
assert_true(signal2.aborted);
197+
assert_true(signal3.aborted);
198+
eventFired = true;
199+
});
200+
201+
controller.abort();
202+
assert_true(eventFired, "event fired");
203+
}, `Dependent signals for ${desc} are marked aborted before abort events fire ${suffix}`);
204+
205+
test(t => {
206+
const controller1 = new controllerInterface();
207+
const controller2 = new controllerInterface();
208+
const signal = signalInterface.any([controller1.signal, controller2.signal]);
209+
let count = 0;
210+
211+
controller1.signal.addEventListener('abort', () => {
212+
controller2.abort("reason 2");
213+
});
214+
215+
signal.addEventListener('abort', () => {
216+
count++;
217+
});
218+
219+
controller1.abort("reason 1");
220+
assert_equals(count, 1);
221+
assert_true(signal.aborted);
222+
assert_equals(signal.reason, "reason 1");
223+
}, `Dependent signals for ${desc} are aborted correctly for reentrant aborts ${suffix}`);
185224
}

0 commit comments

Comments
 (0)