Skip to content

Commit

Permalink
test: update wpts (#2073)
Browse files Browse the repository at this point in the history
  • Loading branch information
KhafraDev committed Apr 16, 2023
1 parent 97154f5 commit 3b3ee20
Show file tree
Hide file tree
Showing 150 changed files with 1,662 additions and 952 deletions.
1 change: 0 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ git sparse-checkout add /resources
git sparse-checkout add /common
git sparse-checkout add /mimesniff
git sparse-checkout add /interfaces
git sparse-checkout add /resources
```
</details>

Expand Down
1 change: 1 addition & 0 deletions lib/fetch/headers.js
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ Object.defineProperties(Headers.prototype, {
get: kEnumerableProperty,
has: kEnumerableProperty,
set: kEnumerableProperty,
getSetCookie: kEnumerableProperty,
keys: kEnumerableProperty,
values: kEnumerableProperty,
entries: kEnumerableProperty,
Expand Down
7 changes: 4 additions & 3 deletions test/wpt/runner/runner.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,9 @@ export class WPTRunner extends EventEmitter {
}

this.once('completion', () => {
for (const exception of this.#uncaughtExceptions) {
console.log(colors(`Uncaught exception: ${exception.stack}`, 'red'))
for (const { error, test } of this.#uncaughtExceptions) {
console.log(colors(`Uncaught exception in "${test}":`, 'red'))
console.log(colors(`${error.stack}`, 'red'))
console.log('='.repeat(96))
}
})
Expand Down Expand Up @@ -211,7 +212,7 @@ export class WPTRunner extends EventEmitter {
} else if (message.type === 'completion') {
this.handleTestCompletion(worker)
} else if (message.type === 'error') {
this.#uncaughtExceptions.push(message.error)
this.#uncaughtExceptions.push({ error: message.error, test })
this.#stats.failed += 1
this.#stats.success -= 1
}
Expand Down
15 changes: 14 additions & 1 deletion test/wpt/status/fetch.status.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
"Empty string integrity for opaque response"
]
},
"keepalive.any.js": {
"note": "document is not defined",
"skip": true
},
"mode-no-cors.sub.any.js": {
"note": "undici doesn't implement CORs",
"skip": true
Expand Down Expand Up @@ -205,6 +209,10 @@
"redirect response with empty Location, manual mode"
]
},
"redirect-keepalive.any.js": {
"note": "document is not defined",
"skip": true
},
"redirect-location-escape.tentative.any.js": {
"note": "TODO(@KhafraDev): crashes runner",
"skip": true
Expand All @@ -226,7 +234,12 @@
"Redirect 307 in \"manual\" mode with data location",
"Redirect 308 in \"manual\" mode without location",
"Redirect 308 in \"manual\" mode with invalid location",
"Redirect 308 in \"manual\" mode with data location"
"Redirect 308 in \"manual\" mode with data location",
"Redirect 301 in \"manual\" mode with valid location",
"Redirect 302 in \"manual\" mode with valid location",
"Redirect 303 in \"manual\" mode with valid location",
"Redirect 307 in \"manual\" mode with valid location",
"Redirect 308 in \"manual\" mode with valid location"
]
},
"redirect-method.any.js": {
Expand Down
20 changes: 10 additions & 10 deletions test/wpt/tests/.azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ jobs:
toxenv: py310

- job: tools_unittest_win_py37
displayName: 'tools/ unittests: Windows + Python 3.6'
displayName: 'tools/ unittests: Windows + Python 3.7'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.tools_unittest']
pool:
Expand All @@ -243,7 +243,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
versionSpec: '3.7'
addToPath: false
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
Expand All @@ -268,22 +268,22 @@ jobs:
directory: tools/
toxenv: py310

- job: wptrunner_unittest_win_py36
displayName: 'tools/wptrunner/ unittests: Windows + Python 3.6'
- job: wptrunner_unittest_win_py37
displayName: 'tools/wptrunner/ unittests: Windows + Python 3.7'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.wptrunner_unittest']
pool:
vmImage: 'windows-2019'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
versionSpec: '3.7'
addToPath: false
- template: tools/ci/azure/checkout.yml
- template: tools/ci/azure/tox_pytest.yml
parameters:
directory: tools/wptrunner/
toxenv: py36
toxenv: py37

- job: wptrunner_unittest_win_py310
displayName: 'tools/wptrunner/ unittests: Windows + Python 3.10'
Expand All @@ -302,8 +302,8 @@ jobs:
directory: tools/wptrunner/
toxenv: py310

- job: wpt_integration_win_py36
displayName: 'tools/wpt/ tests: Windows + Python 3.6'
- job: wpt_integration_win_py37
displayName: 'tools/wpt/ tests: Windows + Python 3.7'
dependsOn: decision
condition: dependencies.decision.outputs['test_jobs.wpt_integration']
pool:
Expand All @@ -312,7 +312,7 @@ jobs:
# full checkout required
- task: UsePythonVersion@0
inputs:
versionSpec: '3.6'
versionSpec: '3.7'
# currently just using the outdated Chrome/Firefox on the VM rather than
# figuring out how to install Chrome Dev channel on Windows
# - template: tools/ci/azure/install_chrome.yml
Expand All @@ -322,7 +322,7 @@ jobs:
- template: tools/ci/azure/tox_pytest.yml
parameters:
directory: tools/wpt/
toxenv: py36
toxenv: py37

- job: wpt_integration_win_py310
displayName: 'tools/wpt/ tests: Windows + Python 3.10'
Expand Down
8 changes: 5 additions & 3 deletions test/wpt/tests/common/rendering-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@
*/
function waitForAtLeastOneFrame() {
return new Promise(resolve => {
// Different web engines work slightly different on this area but waiting
// for two requestAnimationFrames() to happen, one after another, should be
// Different web engines work slightly different on this area but 1) waiting
// for two requestAnimationFrames() to happen one after another and 2)
// adding a step_timeout(0) to guarantee events have finished should be
// sufficient to ensure at least one frame has been generated anywhere.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1785615
window.requestAnimationFrame(() => {
window.requestAnimationFrame(() => {
resolve();
setTimeout(resolve, 0);
});
});
});
Expand Down
2 changes: 0 additions & 2 deletions test/wpt/tests/common/security-features/tools/generate.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python3

from __future__ import print_function

import argparse
import collections
import copy
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env python3

from __future__ import print_function

import json, sys


Expand Down
2 changes: 0 additions & 2 deletions test/wpt/tests/common/security-features/tools/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import print_function

import os, sys, json, json5, re
import collections

Expand Down
39 changes: 39 additions & 0 deletions test/wpt/tests/fetch/api/basic/keepalive.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// META: global=window
// META: title=Fetch API: keepalive handling
// META: script=/resources/testharness.js
// META: script=/resources/testharnessreport.js
// META: script=/common/utils.js
// META: script=/common/get-host-info.sub.js
// META: script=../resources/keepalive-helper.js

'use strict';

const {
HTTP_NOTSAMESITE_ORIGIN,
HTTP_REMOTE_ORIGIN,
HTTP_REMOTE_ORIGIN_WITH_DIFFERENT_PORT
} = get_host_info();

for (const method of ['GET', 'POST']) {
promise_test(async (test) => {
const token1 = token();
const iframe = document.createElement('iframe');
iframe.src = getKeepAliveIframeUrl(token1, method);
document.body.appendChild(iframe);
await iframeLoaded(iframe);
assert_equals(await getTokenFromMessage(), token1);
iframe.remove();

assertStashedTokenAsync(`simple ${method} request: no payload`, token1);
}, `simple ${method} request: no payload; setting up`);
}

promise_test(async (test) => {
const w = window.open(`${
HTTP_NOTSAMESITE_ORIGIN}/fetch/api/resources/keepalive-redirect-window.html`);
const token = await getTokenFromMessage();
w.close();

assertStashedTokenAsync(
'keepalive in onunload in nested frame in another window', token);
}, 'keepalive in onunload in nested frame in another window; setting up');
106 changes: 0 additions & 106 deletions test/wpt/tests/fetch/api/basic/keepalive.html

This file was deleted.

7 changes: 7 additions & 0 deletions test/wpt/tests/fetch/api/basic/response-null-body.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,10 @@ promise_test(async () => {
const text = await resp.text();
assert_equals(text, "", "null bodies result in empty text");
}, `Response.body is null for responses with method=HEAD`);

promise_test(async (t) => {
const integrity = "sha384-UT6f7WCFp32YJnp1is4l/ZYnOeQKpE8xjmdkLOwZ3nIP+tmT2aMRFQGJomjVf5cE";
const url = `${RESOURCES_DIR}status.py?code=204&content=hello-world`;
const promise = fetch(url, { method: "GET", integrity });
promise_rejects_js(t, TypeError, promise);
}, "Null body status with subresource integrity should abort");
Loading

0 comments on commit 3b3ee20

Please sign in to comment.