Skip to content

Commit a44daff

Browse files
targosdanielleadams
authored andcommitted
test: update all Web Platform Tests
PR-URL: #37467 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com> Reviewed-By: Richard Lau <rlau@redhat.com>
1 parent c09bd77 commit a44daff

26 files changed

+1575
-281
lines changed

test/common/wpt.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,8 @@ class StatusRuleSet {
118118
if (key.includes('*')) {
119119
this.patternMatch.push(new StatusRule(key, rules[key], key));
120120
} else {
121-
this.exactMatch[key] = new StatusRule(key, rules[key]);
121+
const normalizedPath = path.normalize(key);
122+
this.exactMatch[normalizedPath] = new StatusRule(key, rules[key]);
122123
}
123124
}
124125
}

test/fixtures/wpt/README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ 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/3586ff740b/common
1314
- console: https://github.com/web-platform-tests/wpt/tree/3b1f72e99a/console
14-
- encoding: https://github.com/web-platform-tests/wpt/tree/3c9820d1cc/encoding
15-
- url: https://github.com/web-platform-tests/wpt/tree/1783c9bccf/url
16-
- resources: https://github.com/web-platform-tests/wpt/tree/351a99782b/resources
17-
- interfaces: https://github.com/web-platform-tests/wpt/tree/b4be9a3fdf/interfaces
18-
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing
19-
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/264f12bc7b/html/webappapis/timers
20-
- hr-time: https://github.com/web-platform-tests/wpt/tree/a5d1774ecf/hr-time
21-
- common: https://github.com/web-platform-tests/wpt/tree/841a51412f/common
22-
- dom/abort: https://github.com/web-platform-tests/wpt/tree/7caa3de747/dom/abort
15+
- dom/abort: https://github.com/web-platform-tests/wpt/tree/625e1310ce/dom/abort
16+
- encoding: https://github.com/web-platform-tests/wpt/tree/35f70910d3/encoding
2317
- FileAPI: https://github.com/web-platform-tests/wpt/tree/3b279420d4/FileAPI
18+
- hr-time: https://github.com/web-platform-tests/wpt/tree/9910784394/hr-time
19+
- html/webappapis/microtask-queuing: https://github.com/web-platform-tests/wpt/tree/2c5c3c4c27/html/webappapis/microtask-queuing
20+
- html/webappapis/timers: https://github.com/web-platform-tests/wpt/tree/5873f2d8f1/html/webappapis/timers
21+
- interfaces: https://github.com/web-platform-tests/wpt/tree/8602e9c9a1/interfaces
22+
- resources: https://github.com/web-platform-tests/wpt/tree/e366371a19/resources
23+
- url: https://github.com/web-platform-tests/wpt/tree/59d28c8f2d/url
2424

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

test/fixtures/wpt/common/third_party/reftest-analyzer.xhtml

+934
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// META: script=./resources/ranges.js
2+
3+
const decode = (input, output, desc) => {
4+
test(function () {
5+
for (const encoding of ["gb18030", "gbk"]) {
6+
assert_equals(
7+
new TextDecoder(encoding).decode(new Uint8Array(input)),
8+
output,
9+
);
10+
}
11+
}, "gb18030 decoder: " + desc);
12+
};
13+
14+
decode([115], "s", "ASCII");
15+
decode([0x80], "\u20AC", "euro");
16+
decode([0xFF], "\uFFFD", "initial byte out of accepted ranges");
17+
decode([0x81], "\uFFFD", "end of queue, gb18030 first not 0");
18+
decode([0x81, 0x28], "\ufffd(", "two bytes 0x81 0x28");
19+
decode([0x81, 0x40], "\u4E02", "two bytes 0x81 0x40");
20+
decode([0x81, 0x7E], "\u4E8A", "two bytes 0x81 0x7e");
21+
decode([0x81, 0x7F], "\ufffd\u007f", "two bytes 0x81 0x7f");
22+
decode([0x81, 0x80], "\u4E90", "two bytes 0x81 0x80");
23+
decode([0x81, 0xFE], "\u4FA2", "two bytes 0x81 0xFE");
24+
decode([0x81, 0xFF], "\ufffd", "two bytes 0x81 0xFF");
25+
decode([0xFE, 0x40], "\uFA0C", "two bytes 0xFE 0x40");
26+
decode([0xFE, 0xFE], "\uE4C5", "two bytes 0xFE 0xFE");
27+
decode([0xFE, 0xFF], "\ufffd", "two bytes 0xFE 0xFF");
28+
decode([0x81, 0x30], "\ufffd", "two bytes 0x81 0x30");
29+
decode([0x81, 0x30, 0xFE], "\ufffd", "three bytes 0x81 0x30 0xFE");
30+
decode([0x81, 0x30, 0xFF], "\ufffd0\ufffd", "three bytes 0x81 0x30 0xFF");
31+
decode(
32+
[0x81, 0x30, 0xFE, 0x29],
33+
"\ufffd0\ufffd)",
34+
"four bytes 0x81 0x30 0xFE 0x29",
35+
);
36+
decode([0xFE, 0x39, 0xFE, 0x39], "\ufffd", "four bytes 0xFE 0x39 0xFE 0x39");
37+
decode([0x81, 0x35, 0xF4, 0x36], "\u1E3E", "pointer 7458");
38+
decode([0x81, 0x35, 0xF4, 0x37], "\ue7c7", "pointer 7457");
39+
decode([0x81, 0x35, 0xF4, 0x38], "\u1E40", "pointer 7459");
40+
decode([0x84, 0x31, 0xA4, 0x39], "\uffff", "pointer 39419");
41+
decode([0x84, 0x31, 0xA5, 0x30], "\ufffd", "pointer 39420");
42+
decode([0x8F, 0x39, 0xFE, 0x39], "\ufffd", "pointer 189999");
43+
decode([0x90, 0x30, 0x81, 0x30], "\u{10000}", "pointer 189000");
44+
decode([0xE3, 0x32, 0x9A, 0x35], "\u{10FFFF}", "pointer 1237575");
45+
decode([0xE3, 0x32, 0x9A, 0x36], "\ufffd", "pointer 1237576");
46+
decode([0x83, 0x36, 0xC8, 0x30], "\uE7C8", "legacy ICU special case 1");
47+
decode([0xA1, 0xAD], "\u2026", "legacy ICU special case 2");
48+
decode([0xA1, 0xAB], "\uFF5E", "legacy ICU special case 3");
49+
50+
let i = 0;
51+
for (const range of ranges) {
52+
const pointer = range[0];
53+
decode(
54+
[
55+
Math.floor(pointer / 12600) + 0x81,
56+
Math.floor((pointer % 12600) / 1260) + 0x30,
57+
Math.floor((pointer % 1260) / 10) + 0x81,
58+
pointer % 10 + 0x30,
59+
],
60+
range[1],
61+
"range " + i++,
62+
);
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const gbkPointers = [
2+
6432, 7533, 7536, 7672, 7673, 7674, 7675, 7676, 7677, 7678, 7679, 7680, 7681, 7682, 7683, 7684,
3+
23766, 23770, 23771, 23772, 23773, 23774, 23776, 23777, 23778, 23779, 23780, 23781, 23782, 23784, 23785, 23786,
4+
23787, 23790, 23791, 23792, 23793, 23796, 23797, 23798, 23799, 23800, 23801, 23802, 23803, 23805, 23806, 23807,
5+
23808, 23809, 23810, 23811, 23813, 23814, 23815, 23816, 23817, 23818, 23819, 23820, 23821, 23822, 23823, 23824,
6+
23825, 23826, 23827, 23828, 23831, 23832, 23833, 23834, 23835, 23836, 23837, 23838, 23839, 23840, 23841, 23842,
7+
23843, 23844
8+
];
9+
const codePoints = [
10+
0x20ac, 0x1e3f, 0x01f9, 0x303e, 0x2ff0, 0x2ff1, 0x2ff2, 0x2ff3, 0x2ff4, 0x2ff5, 0x2ff6, 0x2ff7, 0x2ff8, 0x2ff9, 0x2ffa, 0x2ffb,
11+
0x2e81, 0x2e84, 0x3473, 0x3447, 0x2e88, 0x2e8b, 0x359e, 0x361a, 0x360e, 0x2e8c, 0x2e97, 0x396e, 0x3918, 0x39cf, 0x39df, 0x3a73,
12+
0x39d0, 0x3b4e, 0x3c6e, 0x3ce0, 0x2ea7, 0x2eaa, 0x4056, 0x415f, 0x2eae, 0x4337, 0x2eb3, 0x2eb6, 0x2eb7, 0x43b1, 0x43ac, 0x2ebb,
13+
0x43dd, 0x44d6, 0x4661, 0x464c, 0x4723, 0x4729, 0x477c, 0x478d, 0x2eca, 0x4947, 0x497a, 0x497d, 0x4982, 0x4983, 0x4985, 0x4986,
14+
0x499f, 0x499b, 0x49b7, 0x49b6, 0x4ca3, 0x4c9f, 0x4ca0, 0x4ca1, 0x4c77, 0x4ca2, 0x4d13, 0x4d14, 0x4d15, 0x4d16, 0x4d17, 0x4d18,
15+
0x4d19, 0x4dae
16+
];
17+
18+
for (let i = 0; i < gbkPointers.length; i++) {
19+
const pointer = gbkPointers[i];
20+
test(function() {
21+
const lead = pointer / 190 + 0x81;
22+
const trail = pointer % 190;
23+
const offset = trail < 0x3F ? 0x40 : 0x41;
24+
const encoded = [lead, trail + offset];
25+
const decoded = new TextDecoder("GBK").decode(new Uint8Array(encoded)).charCodeAt(0);
26+
assert_equals(decoded, codePoints[i]);
27+
}, "gbk pointer: " + pointer)
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
// META: title=Encoding API: TextDecoder decode() optional arguments
2+
3+
test(t => {
4+
const decoder = new TextDecoder();
5+
6+
// Just passing nothing.
7+
assert_equals(
8+
decoder.decode(undefined), '',
9+
'Undefined as first arg should decode to empty string');
10+
11+
// Flushing an incomplete sequence.
12+
decoder.decode(new Uint8Array([0xc9]), {stream: true});
13+
assert_equals(
14+
decoder.decode(undefined), '\uFFFD',
15+
'Undefined as first arg should flush the stream');
16+
17+
}, 'TextDecoder decode() with explicit undefined');
18+
19+
test(t => {
20+
const decoder = new TextDecoder();
21+
22+
// Just passing nothing.
23+
assert_equals(
24+
decoder.decode(undefined, undefined), '',
25+
'Undefined as first arg should decode to empty string');
26+
27+
// Flushing an incomplete sequence.
28+
decoder.decode(new Uint8Array([0xc9]), {stream: true});
29+
assert_equals(
30+
decoder.decode(undefined, undefined), '\uFFFD',
31+
'Undefined as first arg should flush the stream');
32+
33+
}, 'TextDecoder decode() with undefined and undefined');
34+
35+
test(t => {
36+
const decoder = new TextDecoder();
37+
38+
// Just passing nothing.
39+
assert_equals(
40+
decoder.decode(undefined, {}), '',
41+
'Undefined as first arg should decode to empty string');
42+
43+
// Flushing an incomplete sequence.
44+
decoder.decode(new Uint8Array([0xc9]), {stream: true});
45+
assert_equals(
46+
decoder.decode(undefined, {}), '\uFFFD',
47+
'Undefined as first arg should flush the stream');
48+
49+
}, 'TextDecoder decode() with undefined and options');

test/fixtures/wpt/encoding/textdecoder-labels.any.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// META: title=Encoding API: Encoding labels
22
// META: script=resources/encodings.js
3+
// META: timeout=long
34

45
var whitespace = [' ', '\t', '\n', '\f', '\r'];
56
encodings_table.forEach(function(section) {

test/fixtures/wpt/hr-time/basic.any.js

+9
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,12 @@ async_test(function() {
2626
this.done();
2727
}, 2000);
2828
}, 'High resolution time has approximately the right relative magnitude');
29+
30+
test(function() {
31+
var didHandle = false;
32+
self.performance.addEventListener("testEvent", function() {
33+
didHandle = true;
34+
}, { once: true} );
35+
self.performance.dispatchEvent(new Event("testEvent"));
36+
assert_true(didHandle, "Performance extends EventTarget, so event dispatching should work.");
37+
}, "Performance interface extends EventTarget.");
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
setup({ single_test: true });
2+
var i = 0;
3+
var interval;
4+
function next() {
5+
i++;
6+
if (i === 20) {
7+
clearInterval(interval);
8+
done();
9+
}
10+
}
11+
setTimeout(assert_unreached, 1000);
12+
interval = setInterval(next, -100);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
setup({ single_test: true });
2+
setTimeout(done, -100);
3+
setTimeout(assert_unreached, 10);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
setup({ single_test: true });
2+
var interval;
3+
function next() {
4+
clearInterval(interval);
5+
done();
6+
}
7+
interval = setInterval(next, Math.pow(2, 32));
8+
setTimeout(assert_unreached, 100);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
setup({ single_test: true });
2+
setTimeout(done, Math.pow(2, 32));
3+
setTimeout(assert_unreached, 100);

test/fixtures/wpt/interfaces/html.idl

+45-52
Original file line numberDiff line numberDiff line change
@@ -1397,11 +1397,11 @@ interface mixin CanvasDrawImage {
13971397

13981398
interface mixin CanvasImageData {
13991399
// pixel manipulation
1400-
ImageData createImageData(long sw, long sh);
1400+
ImageData createImageData([EnforceRange] long sw, [EnforceRange] long sh);
14011401
ImageData createImageData(ImageData imagedata);
1402-
ImageData getImageData(long sx, long sy, long sw, long sh);
1403-
undefined putImageData(ImageData imagedata, long dx, long dy);
1404-
undefined putImageData(ImageData imagedata, long dx, long dy, long dirtyX, long dirtyY, long dirtyWidth, long dirtyHeight);
1402+
ImageData getImageData([EnforceRange] long sx, [EnforceRange] long sy, [EnforceRange] long sw, [EnforceRange] long sh);
1403+
undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy);
1404+
undefined putImageData(ImageData imagedata, [EnforceRange] long dx, [EnforceRange] long dy, [EnforceRange] long dirtyX, [EnforceRange] long dirtyY, [EnforceRange] long dirtyWidth, [EnforceRange] long dirtyHeight);
14051405
};
14061406

14071407
enum CanvasLineCap { "butt", "round", "square" };
@@ -1440,8 +1440,8 @@ interface mixin CanvasPath {
14401440
undefined bezierCurveTo(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y);
14411441
undefined arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius);
14421442
undefined rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
1443-
undefined arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
1444-
undefined ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean anticlockwise = false);
1443+
undefined arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean counterclockwise = false);
1444+
undefined ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean counterclockwise = false);
14451445
};
14461446

14471447
[Exposed=(Window,Worker)]
@@ -2027,48 +2027,6 @@ interface mixin NavigatorCookies {
20272027
readonly attribute boolean cookieEnabled;
20282028
};
20292029

2030-
interface mixin NavigatorPlugins {
2031-
[SameObject] readonly attribute PluginArray plugins;
2032-
[SameObject] readonly attribute MimeTypeArray mimeTypes;
2033-
boolean javaEnabled();
2034-
};
2035-
2036-
[Exposed=Window,
2037-
LegacyUnenumerableNamedProperties]
2038-
interface PluginArray {
2039-
undefined refresh(optional boolean reload = false);
2040-
readonly attribute unsigned long length;
2041-
getter Plugin? item(unsigned long index);
2042-
getter Plugin? namedItem(DOMString name);
2043-
};
2044-
2045-
[Exposed=Window,
2046-
LegacyUnenumerableNamedProperties]
2047-
interface MimeTypeArray {
2048-
readonly attribute unsigned long length;
2049-
getter MimeType? item(unsigned long index);
2050-
getter MimeType? namedItem(DOMString name);
2051-
};
2052-
2053-
[Exposed=Window,
2054-
LegacyUnenumerableNamedProperties]
2055-
interface Plugin {
2056-
readonly attribute DOMString name;
2057-
readonly attribute DOMString description;
2058-
readonly attribute DOMString filename;
2059-
readonly attribute unsigned long length;
2060-
getter MimeType? item(unsigned long index);
2061-
getter MimeType? namedItem(DOMString name);
2062-
};
2063-
2064-
[Exposed=Window]
2065-
interface MimeType {
2066-
readonly attribute DOMString type;
2067-
readonly attribute DOMString description;
2068-
readonly attribute DOMString suffixes; // comma-separated
2069-
readonly attribute Plugin enabledPlugin;
2070-
};
2071-
20722030
[Exposed=(Window,Worker), Serializable, Transferable]
20732031
interface ImageBitmap {
20742032
readonly attribute unsigned long width;
@@ -2396,10 +2354,6 @@ interface HTMLMarqueeElement : HTMLElement {
23962354
[CEReactions] attribute unsigned long vspace;
23972355
[CEReactions] attribute DOMString width;
23982356

2399-
attribute EventHandler onbounce;
2400-
attribute EventHandler onfinish;
2401-
attribute EventHandler onstart;
2402-
24032357
undefined start();
24042358
undefined stop();
24052359
};
@@ -2678,3 +2632,42 @@ interface External {
26782632
undefined AddSearchProvider();
26792633
undefined IsSearchProviderInstalled();
26802634
};
2635+
2636+
interface mixin NavigatorPlugins {
2637+
[SameObject] readonly attribute PluginArray plugins;
2638+
[SameObject] readonly attribute MimeTypeArray mimeTypes;
2639+
boolean javaEnabled();
2640+
};
2641+
2642+
[Exposed=Window]
2643+
interface PluginArray {
2644+
undefined refresh();
2645+
readonly attribute unsigned long length;
2646+
getter object? item(unsigned long index);
2647+
object? namedItem(DOMString name);
2648+
};
2649+
2650+
[Exposed=Window]
2651+
interface MimeTypeArray {
2652+
readonly attribute unsigned long length;
2653+
getter object? item(unsigned long index);
2654+
object? namedItem(DOMString name);
2655+
};
2656+
2657+
[Exposed=Window]
2658+
interface Plugin {
2659+
readonly attribute undefined name;
2660+
readonly attribute undefined description;
2661+
readonly attribute undefined filename;
2662+
readonly attribute undefined length;
2663+
getter undefined item(unsigned long index);
2664+
undefined namedItem(DOMString name);
2665+
};
2666+
2667+
[Exposed=Window]
2668+
interface MimeType {
2669+
readonly attribute undefined type;
2670+
readonly attribute undefined description;
2671+
readonly attribute undefined suffixes;
2672+
readonly attribute undefined enabledPlugin;
2673+
};

test/fixtures/wpt/resources/idlharness.js

+16-2
Original file line numberDiff line numberDiff line change
@@ -3483,6 +3483,22 @@ IdlNamespace.prototype.test_self = function ()
34833483
subsetTestByKey(this.name, test, () => {
34843484
assert_equals(typeof namespaceObject, "object");
34853485
}, `${this.name} namespace: typeof is "object"`);
3486+
3487+
subsetTestByKey(this.name, test, () => {
3488+
assert_equals(
3489+
Object.getOwnPropertyDescriptor(namespaceObject, "length"),
3490+
undefined,
3491+
"length property must be undefined"
3492+
);
3493+
}, `${this.name} namespace: has no length property`);
3494+
3495+
subsetTestByKey(this.name, test, () => {
3496+
assert_equals(
3497+
Object.getOwnPropertyDescriptor(namespaceObject, "name"),
3498+
undefined,
3499+
"name property must be undefined"
3500+
);
3501+
}, `${this.name} namespace: has no name property`);
34863502
};
34873503

34883504
IdlNamespace.prototype.test = function ()
@@ -3527,8 +3543,6 @@ IdlNamespace.prototype.test = function ()
35273543
function idl_test(srcs, deps, idl_setup_func) {
35283544
return promise_test(function (t) {
35293545
var idl_array = new IdlArray();
3530-
srcs = (srcs instanceof Array) ? srcs : [srcs] || [];
3531-
deps = (deps instanceof Array) ? deps : [deps] || [];
35323546
var setup_error = null;
35333547
const validationIgnored = [
35343548
"constructor-member",

0 commit comments

Comments
 (0)