Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
features:
- name: zstd
files: "**"
3 changes: 3 additions & 0 deletions test/fixtures/wpt/fetch/private-network-access/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ See also:
* [The specification](https://wicg.github.io/private-network-access/)
* [The repository](https://github.com/WICG/private-network-access/)
* [Open issues](https://github.com/WICG/private-network-access/issues/)

Private Network Access is deprecated and will eventually be replaced by [Local
Network Access](https://github.com/explainers-by-googlers/local-network-access).
3 changes: 3 additions & 0 deletions test/fixtures/wpt/interfaces/fedcm.idl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ interface IdentityCredential : Credential {
static Promise<undefined> disconnect(IdentityCredentialDisconnectOptions options);
readonly attribute USVString? token;
readonly attribute boolean isAutoSelected;
readonly attribute USVString configURL;
};

dictionary DisconnectedAccount {
Expand Down Expand Up @@ -78,6 +79,7 @@ dictionary IdentityProviderAPIConfig {
required USVString login_url;
USVString disconnect_endpoint;
IdentityProviderBranding branding;
USVString account_label;
};

dictionary IdentityProviderAccount {
Expand All @@ -89,6 +91,7 @@ dictionary IdentityProviderAccount {
sequence<USVString> approved_clients;
sequence<DOMString> login_hints;
sequence<DOMString> domain_hints;
sequence<DOMString> label_hints;
};
dictionary IdentityProviderAccountList {
sequence<IdentityProviderAccount> accounts;
Expand Down
3 changes: 2 additions & 1 deletion test/fixtures/wpt/interfaces/webaudio.idl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
enum AudioContextState {
"suspended",
"running",
"closed"
"closed",
"interrupted"
};

enum AudioContextRenderSizeCategory {
Expand Down
8 changes: 6 additions & 2 deletions test/fixtures/wpt/interfaces/webgpu.idl
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ interface GPUAdapterInfo {
readonly attribute DOMString description;
readonly attribute unsigned long subgroupMinSize;
readonly attribute unsigned long subgroupMaxSize;
readonly attribute boolean isFallbackAdapter;
};

interface mixin NavigatorGPU {
Expand Down Expand Up @@ -96,7 +97,6 @@ interface GPUAdapter {
[SameObject] readonly attribute GPUSupportedFeatures features;
[SameObject] readonly attribute GPUSupportedLimits limits;
[SameObject] readonly attribute GPUAdapterInfo info;
readonly attribute boolean isFallbackAdapter;

Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
};
Expand Down Expand Up @@ -936,12 +936,16 @@ interface GPUCommandEncoder {
GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor);
GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {});

undefined copyBufferToBuffer(
GPUBuffer source,
GPUBuffer destination,
optional GPUSize64 size);
undefined copyBufferToBuffer(
GPUBuffer source,
GPUSize64 sourceOffset,
GPUBuffer destination,
GPUSize64 destinationOffset,
GPUSize64 size);
optional GPUSize64 size);

undefined copyBufferToTexture(
GPUTexelCopyBufferInfo source,
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/wpt/interfaces/webxr.idl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ enum XRVisibilityState {
dictionary XRRenderStateInit {
double depthNear;
double depthFar;
boolean passthroughFullyObscured;
double inlineVerticalFieldOfView;
XRWebGLLayer? baseLayer;
sequence<XRLayer>? layers;
Expand All @@ -78,6 +79,7 @@ dictionary XRRenderStateInit {
[SecureContext, Exposed=Window] interface XRRenderState {
readonly attribute double depthNear;
readonly attribute double depthFar;
readonly attribute boolean? passthroughFullyObscured;
readonly attribute double? inlineVerticalFieldOfView;
readonly attribute XRWebGLLayer? baseLayer;
};
Expand Down
37 changes: 33 additions & 4 deletions test/fixtures/wpt/resources/testdriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1428,7 +1428,7 @@
* Causes a virtual pressure source to report a new reading.
*
* Matches the `Update virtual pressure source
* <https://w3c.github.io/compute-pressure/#update-virtual-pressure-source>`_
* <https://w3c.github.io/compute-pressure/?experimental=1#update-virtual-pressure-source>`_
* WebDriver command.
*
* @param {String} source_type - A `virtual pressure source type
Expand All @@ -1437,6 +1437,8 @@
* @param {String} sample - A `virtual pressure state
* <https://w3c.github.io/compute-pressure/#dom-pressurestate>`_
* such as "critical".
* @param {number} estimate - Optional, A `virtual own contribution estimate`
* <https://w3c.github.io/compute-pressure/?experimental=1#the-owncontributionestimate-attribute>`_
* @param {WindowProxy} [context=null] - Browsing context in which to
* run the call, or null for the
* current browsing context.
Expand All @@ -1447,8 +1449,8 @@
* virtual pressure source of the given type does not
* exist).
*/
update_virtual_pressure_source: function(source_type, sample, context=null) {
return window.test_driver_internal.update_virtual_pressure_source(source_type, sample, context);
update_virtual_pressure_source: function(source_type, sample, estimate, context=null) {
return window.test_driver_internal.update_virtual_pressure_source(source_type, sample, estimate, context);
},

/**
Expand All @@ -1472,6 +1474,29 @@
*/
remove_virtual_pressure_source: function(source_type, context=null) {
return window.test_driver_internal.remove_virtual_pressure_source(source_type, context);
},

/**
* Sets which hashes are considered k-anonymous for the Protected
* Audience interest group with specified `owner` and `name`.
*
* Matches the `Set Protected Audience K-Anonymity
* <https://wicg.github.io/turtledove/#sctn-automation-set-protected-audience-k-anonymity>
* WebDriver command.
*
* @param {String} owner - Origin of the owner of the interest group
* to modify
* @param {String} name - Name of the interest group to modify
* @param {Array} hashes - An array of strings, each of which is a
* base64 ecoded hash to consider k-anonymous.
*
* @returns {Promise} Fulfilled after the k-anonymity status for the
* specified Protected Audience interest group has
* been updated.
*
*/
set_protected_audience_k_anonymity: function(owner, name, hashes, context = null) {
return window.test_driver_internal.set_protected_audience_k_anonymity(owner, name, hashes, context);
}
};

Expand Down Expand Up @@ -1723,12 +1748,16 @@
throw new Error("create_virtual_pressure_source() is not implemented by testdriver-vendor.js");
},

async update_virtual_pressure_source(source_type, sample, context=null) {
async update_virtual_pressure_source(source_type, sample, estimate, context=null) {
throw new Error("update_virtual_pressure_source() is not implemented by testdriver-vendor.js");
},

async remove_virtual_pressure_source(source_type, context=null) {
throw new Error("remove_virtual_pressure_source() is not implemented by testdriver-vendor.js");
},

async set_protected_audience_k_anonymity(owner, name, hashes, context=null) {
throw new Error("set_protected_audience_k_anonymity() is not implemented by testdriver-vendor.js");
}
};
})();
16 changes: 10 additions & 6 deletions test/fixtures/wpt/resources/testharness.js
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,15 @@
"0xffff": "uffff",
};

const formatEscapeMap = {
"\\": "\\\\",
'"': '\\"'
};
for (const p in replacements) {
formatEscapeMap[String.fromCharCode(p)] = "\\" + replacements[p];
}
const formatEscapePattern = new RegExp(`[${Object.keys(formatEscapeMap).map(k => k === "\\" ? "\\\\" : k).join("")}]`, "g");

/**
* Convert a value to a nice, human-readable string
*
Expand Down Expand Up @@ -1380,12 +1389,7 @@

switch (typeof val) {
case "string":
val = val.replace(/\\/g, "\\\\");
for (var p in replacements) {
var replace = "\\" + replacements[p];
val = val.replace(RegExp(String.fromCharCode(p), "g"), replace);
}
return '"' + val.replace(/"/g, '\\"') + '"';
return '"' + val.replace(formatEscapePattern, match => formatEscapeMap[match]) + '"';
case "boolean":
case "undefined":
return String(val);
Expand Down
5 changes: 5 additions & 0 deletions test/fixtures/wpt/xhr/resources/redirect.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import time
from urllib.parse import parse_qs

from wptserve.utils import isomorphic_encode

def main(request, response):
code = int(request.GET.first(b"code", 302))
location = request.GET.first(b"location", isomorphic_encode(request.url_parts.path + u"?followed"))
if location:
location = parse_qs(u"location=" + location.decode(u"UTF-8"))[u"location"][0]
if location.startswith(u"redirect.py"):
location += u"&code=" + str(code)

if b"delay" in request.GET:
delay = float(request.GET.first(b"delay"))
Expand Down
85 changes: 61 additions & 24 deletions test/fixtures/wpt/xhr/send-redirect.htm
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,73 @@
<div id="log"></div>
<script>
// https://fetch.spec.whatwg.org/#statuses
var redirect_codes = new Set([301, 302, 303, 307, 308]);
function redirect(code) {
var test = async_test(`${document.title} (${code} does ${redirect_codes.has(code)? "redirect": "not redirect"})`);
test.step(function() {
var client = new XMLHttpRequest();
client.onreadystatechange = function() {
test.step(function() {
if(client.readyState == 4) {
if (redirect_codes.has(code)) {
assert_equals(client.getResponseHeader("x-request-method"), "GET");
assert_equals(client.getResponseHeader("x-request-content-type"), "application/x-pony");
assert_equals(client.status, 200);
} else {
assert_equals(client.getResponseHeader("x-request-method"), null);
assert_equals(client.getResponseHeader("x-request-content-type"), null);
assert_equals(client.status, code);
const redirect_codes = new Set([301, 302, 303, 307, 308]);
function maybeRedirect(code, method="GET", redirectLocation="content.py") {
async_test(t => {
const client = new XMLHttpRequest();
client.onreadystatechange = t.step_func(() => {
if(client.readyState == 4) {
if (redirect_codes.has(code)) {
let expected_method = method;
let expected_content_type = "application/x-pony";
if ((method == "POST" && (code == "301" || code == "302")) ||
(code == "303" && method != "GET" && method != "HEAD")) {
expected_method = "GET";
expected_content_type = "NO";
}
test.done();
assert_equals(client.getResponseHeader("x-request-method"), expected_method);
assert_equals(client.getResponseHeader("x-request-content-type"), expected_content_type);
assert_equals(client.status, 200);
} else {
assert_equals(client.getResponseHeader("x-request-method"), null);
assert_equals(client.getResponseHeader("x-request-content-type"), null);
assert_equals(client.status, code);
}
})
}
client.open("GET", "resources/redirect.py?location=content.py&code=" + code);
t.done();
}
});
client.open(method, `resources/redirect.py?location=${redirectLocation}&code=${code}`);
client.setRequestHeader("Content-Type", "application/x-pony");
client.send(null);
})
}, `${document.title} (${code}, ${method}, ${redirectLocation})`);
}

for (var number of [300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 350, 399]) {
redirect(number);
}
maybeRedirect(300);
maybeRedirect(301);
maybeRedirect(302);
maybeRedirect(303);
maybeRedirect(304);
maybeRedirect(305);
maybeRedirect(306);
maybeRedirect(307);
maybeRedirect(308);
maybeRedirect(309);
maybeRedirect(310);
maybeRedirect(350);
maybeRedirect(399);
maybeRedirect(301, "POST");
maybeRedirect(302, "POST");
maybeRedirect(303, "POST");
maybeRedirect(307, "POST");
maybeRedirect(301, "HEAD");
maybeRedirect(302, "HEAD");
maybeRedirect(303, "HEAD");
maybeRedirect(307, "HEAD");

const redirectedLocation = encodeURIComponent("redirect.py?location=content.py");
maybeRedirect(301, "GET", redirectedLocation);
maybeRedirect(302, "GET", redirectedLocation);
maybeRedirect(303, "GET", redirectedLocation);
maybeRedirect(307, "GET", redirectedLocation);
maybeRedirect(301, "POST", redirectedLocation);
maybeRedirect(302, "POST", redirectedLocation);
maybeRedirect(303, "POST", redirectedLocation);
maybeRedirect(307, "POST", redirectedLocation);
maybeRedirect(303, "CHICKEN", redirectedLocation);
maybeRedirect(301, "HEAD", redirectedLocation);
maybeRedirect(302, "HEAD", redirectedLocation);
maybeRedirect(303, "HEAD", redirectedLocation);
maybeRedirect(307, "HEAD", redirectedLocation);
</script>
</body>
</html>
38 changes: 20 additions & 18 deletions test/fixtures/wpt/xhr/setrequestheader-case-insensitive.htm
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,28 @@
<body>
<div id="log"></div>
<script>
test(function() {
var client = new XMLHttpRequest()
client.open("POST", "resources/inspect-headers.py?filter_value=t1, t2, t3", false)
client.setRequestHeader("x-test", "t1")
client.setRequestHeader("X-TEST", "t2")
client.setRequestHeader("X-teST", "t3")
client.send(null)
assert_equals(client.responseText, "x-test,")
})
test(() => {
const client = new XMLHttpRequest();
client.open("POST", "resources/inspect-headers.py?filter_value=t1, t2, t3", false);
client.setRequestHeader("x-test", "t1");
client.setRequestHeader("X-TEST", "t2");
client.setRequestHeader("X-teST", "t3");
client.send(null);
assert_equals(client.responseText, "x-test,");
});

test(() => {
const client = new XMLHttpRequest
client.open("GET", "resources/echo-headers.py", false)
client.setRequestHeader("THIS-IS-A-TEST", "1")
client.setRequestHeader("THIS-is-A-test", "2")
client.setRequestHeader("content-TYPE", "x/x")
client.send()
assert_regexp_match(client.responseText, /content-TYPE/)
assert_regexp_match(client.responseText, /THIS-IS-A-TEST: 1, 2/)
})
const client = new XMLHttpRequest();
client.open("GET", "resources/echo-headers.py", false);
client.setRequestHeader("THIS-IS-A-TEST", "1");
client.setRequestHeader("THIS-is-A-test", "2");
client.setRequestHeader("content-TYPE", "x/x");
client.send();
const contentTypeHeader = client.responseText.match(/content-TYPE/gi);
const thisIsATestHeader = client.responseText.match(/THIS-IS-A-TEST: 1, 2/gi);
assert_array_equals(contentTypeHeader, ["content-TYPE"]);
assert_array_equals(thisIsATestHeader, ["THIS-IS-A-TEST: 1, 2"]);
});
</script>
</body>
</html>