Skip to content

Commit 3b3ee20

Browse files
authored
test: update wpts (#2073)
1 parent 97154f5 commit 3b3ee20

File tree

150 files changed

+1662
-952
lines changed

Some content is hidden

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

150 files changed

+1662
-952
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ git sparse-checkout add /resources
9999
git sparse-checkout add /common
100100
git sparse-checkout add /mimesniff
101101
git sparse-checkout add /interfaces
102-
git sparse-checkout add /resources
103102
```
104103
</details>
105104

lib/fetch/headers.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,7 @@ Object.defineProperties(Headers.prototype, {
516516
get: kEnumerableProperty,
517517
has: kEnumerableProperty,
518518
set: kEnumerableProperty,
519+
getSetCookie: kEnumerableProperty,
519520
keys: kEnumerableProperty,
520521
values: kEnumerableProperty,
521522
entries: kEnumerableProperty,

test/wpt/runner/runner.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ export class WPTRunner extends EventEmitter {
9999
}
100100

101101
this.once('completion', () => {
102-
for (const exception of this.#uncaughtExceptions) {
103-
console.log(colors(`Uncaught exception: ${exception.stack}`, 'red'))
102+
for (const { error, test } of this.#uncaughtExceptions) {
103+
console.log(colors(`Uncaught exception in "${test}":`, 'red'))
104+
console.log(colors(`${error.stack}`, 'red'))
104105
console.log('='.repeat(96))
105106
}
106107
})
@@ -211,7 +212,7 @@ export class WPTRunner extends EventEmitter {
211212
} else if (message.type === 'completion') {
212213
this.handleTestCompletion(worker)
213214
} else if (message.type === 'error') {
214-
this.#uncaughtExceptions.push(message.error)
215+
this.#uncaughtExceptions.push({ error: message.error, test })
215216
this.#stats.failed += 1
216217
this.#stats.success -= 1
217218
}

test/wpt/status/fetch.status.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@
3737
"Empty string integrity for opaque response"
3838
]
3939
},
40+
"keepalive.any.js": {
41+
"note": "document is not defined",
42+
"skip": true
43+
},
4044
"mode-no-cors.sub.any.js": {
4145
"note": "undici doesn't implement CORs",
4246
"skip": true
@@ -205,6 +209,10 @@
205209
"redirect response with empty Location, manual mode"
206210
]
207211
},
212+
"redirect-keepalive.any.js": {
213+
"note": "document is not defined",
214+
"skip": true
215+
},
208216
"redirect-location-escape.tentative.any.js": {
209217
"note": "TODO(@KhafraDev): crashes runner",
210218
"skip": true
@@ -226,7 +234,12 @@
226234
"Redirect 307 in \"manual\" mode with data location",
227235
"Redirect 308 in \"manual\" mode without location",
228236
"Redirect 308 in \"manual\" mode with invalid location",
229-
"Redirect 308 in \"manual\" mode with data location"
237+
"Redirect 308 in \"manual\" mode with data location",
238+
"Redirect 301 in \"manual\" mode with valid location",
239+
"Redirect 302 in \"manual\" mode with valid location",
240+
"Redirect 303 in \"manual\" mode with valid location",
241+
"Redirect 307 in \"manual\" mode with valid location",
242+
"Redirect 308 in \"manual\" mode with valid location"
230243
]
231244
},
232245
"redirect-method.any.js": {

test/wpt/tests/.azure-pipelines.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ jobs:
233233
toxenv: py310
234234

235235
- job: tools_unittest_win_py37
236-
displayName: 'tools/ unittests: Windows + Python 3.6'
236+
displayName: 'tools/ unittests: Windows + Python 3.7'
237237
dependsOn: decision
238238
condition: dependencies.decision.outputs['test_jobs.tools_unittest']
239239
pool:
@@ -243,7 +243,7 @@ jobs:
243243
steps:
244244
- task: UsePythonVersion@0
245245
inputs:
246-
versionSpec: '3.6'
246+
versionSpec: '3.7'
247247
addToPath: false
248248
- template: tools/ci/azure/checkout.yml
249249
- template: tools/ci/azure/tox_pytest.yml
@@ -268,22 +268,22 @@ jobs:
268268
directory: tools/
269269
toxenv: py310
270270

271-
- job: wptrunner_unittest_win_py36
272-
displayName: 'tools/wptrunner/ unittests: Windows + Python 3.6'
271+
- job: wptrunner_unittest_win_py37
272+
displayName: 'tools/wptrunner/ unittests: Windows + Python 3.7'
273273
dependsOn: decision
274274
condition: dependencies.decision.outputs['test_jobs.wptrunner_unittest']
275275
pool:
276276
vmImage: 'windows-2019'
277277
steps:
278278
- task: UsePythonVersion@0
279279
inputs:
280-
versionSpec: '3.6'
280+
versionSpec: '3.7'
281281
addToPath: false
282282
- template: tools/ci/azure/checkout.yml
283283
- template: tools/ci/azure/tox_pytest.yml
284284
parameters:
285285
directory: tools/wptrunner/
286-
toxenv: py36
286+
toxenv: py37
287287

288288
- job: wptrunner_unittest_win_py310
289289
displayName: 'tools/wptrunner/ unittests: Windows + Python 3.10'
@@ -302,8 +302,8 @@ jobs:
302302
directory: tools/wptrunner/
303303
toxenv: py310
304304

305-
- job: wpt_integration_win_py36
306-
displayName: 'tools/wpt/ tests: Windows + Python 3.6'
305+
- job: wpt_integration_win_py37
306+
displayName: 'tools/wpt/ tests: Windows + Python 3.7'
307307
dependsOn: decision
308308
condition: dependencies.decision.outputs['test_jobs.wpt_integration']
309309
pool:
@@ -312,7 +312,7 @@ jobs:
312312
# full checkout required
313313
- task: UsePythonVersion@0
314314
inputs:
315-
versionSpec: '3.6'
315+
versionSpec: '3.7'
316316
# currently just using the outdated Chrome/Firefox on the VM rather than
317317
# figuring out how to install Chrome Dev channel on Windows
318318
# - template: tools/ci/azure/install_chrome.yml
@@ -322,7 +322,7 @@ jobs:
322322
- template: tools/ci/azure/tox_pytest.yml
323323
parameters:
324324
directory: tools/wpt/
325-
toxenv: py36
325+
toxenv: py37
326326

327327
- job: wpt_integration_win_py310
328328
displayName: 'tools/wpt/ tests: Windows + Python 3.10'

test/wpt/tests/common/rendering-utils.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
*/
88
function waitForAtLeastOneFrame() {
99
return new Promise(resolve => {
10-
// Different web engines work slightly different on this area but waiting
11-
// for two requestAnimationFrames() to happen, one after another, should be
10+
// Different web engines work slightly different on this area but 1) waiting
11+
// for two requestAnimationFrames() to happen one after another and 2)
12+
// adding a step_timeout(0) to guarantee events have finished should be
1213
// sufficient to ensure at least one frame has been generated anywhere.
14+
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1785615
1315
window.requestAnimationFrame(() => {
1416
window.requestAnimationFrame(() => {
15-
resolve();
17+
setTimeout(resolve, 0);
1618
});
1719
});
1820
});

test/wpt/tests/common/security-features/tools/generate.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python3
22

3-
from __future__ import print_function
4-
53
import argparse
64
import collections
75
import copy

test/wpt/tests/common/security-features/tools/spec_validator.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python3
22

3-
from __future__ import print_function
4-
53
import json, sys
64

75

test/wpt/tests/common/security-features/tools/util.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from __future__ import print_function
2-
31
import os, sys, json, json5, re
42
import collections
53

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// META: global=window
2+
// META: title=Fetch API: keepalive handling
3+
// META: script=/resources/testharness.js
4+
// META: script=/resources/testharnessreport.js
5+
// META: script=/common/utils.js
6+
// META: script=/common/get-host-info.sub.js
7+
// META: script=../resources/keepalive-helper.js
8+
9+
'use strict';
10+
11+
const {
12+
HTTP_NOTSAMESITE_ORIGIN,
13+
HTTP_REMOTE_ORIGIN,
14+
HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT
15+
} = get_host_info();
16+
17+
for (const method of ['GET', 'POST']) {
18+
promise_test(async (test) => {
19+
const token1 = token();
20+
const iframe = document.createElement('iframe');
21+
iframe.src = getKeepAliveIframeUrl(token1, method);
22+
document.body.appendChild(iframe);
23+
await iframeLoaded(iframe);
24+
assert_equals(await getTokenFromMessage(), token1);
25+
iframe.remove();
26+
27+
assertStashedTokenAsync(`simple ${method} request: no payload`, token1);
28+
}, `simple ${method} request: no payload; setting up`);
29+
}
30+
31+
promise_test(async (test) => {
32+
const w = window.open(`${
33+
HTTP_NOTSAMESITE_ORIGIN}/fetch/api/resources/keepalive-redirect-window.html`);
34+
const token = await getTokenFromMessage();
35+
w.close();
36+
37+
assertStashedTokenAsync(
38+
'keepalive in onunload in nested frame in another window', token);
39+
}, 'keepalive in onunload in nested frame in another window; setting up');

test/wpt/tests/fetch/api/basic/keepalive.html

Lines changed: 0 additions & 106 deletions
This file was deleted.

test/wpt/tests/fetch/api/basic/response-null-body.any.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,10 @@ promise_test(async () => {
2929
const text = await resp.text();
3030
assert_equals(text, "", "null bodies result in empty text");
3131
}, `Response.body is null for responses with method=HEAD`);
32+
33+
promise_test(async (t) => {
34+
const integrity = "sha384-UT6f7WCFp32YJnp1is4l/ZYnOeQKpE8xjmdkLOwZ3nIP+tmT2aMRFQGJomjVf5cE";
35+
const url = `${RESOURCES_DIR}status.py?code=204&content=hello-world`;
36+
const promise = fetch(url, { method: "GET", integrity });
37+
promise_rejects_js(t, TypeError, promise);
38+
}, "Null body status with subresource integrity should abort");

0 commit comments

Comments
 (0)