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
2 changes: 1 addition & 1 deletion test/fixtures/wpt/fetch/api/body/mime-type.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@

[
() => new Request("about:blank", { method: "POST", body: new Blob([""], { type: "Text/Plain" }), headers: [["Content-Type", "Text/Html"]] }),
() => new Response(new Blob([""], { type: "Text/Plain" }, { headers: [["Content-Type", "Text/Html"]] }))
() => new Response(new Blob([""], { type: "Text/Plain" }), { headers: [["Content-Type", "Text/Html"]] })
].forEach(bodyContainerCreator => {
const bodyContainer = bodyContainerCreator();
const cloned = bodyContainer.clone();
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/fetch/api/resources/keepalive-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function assertStashedTokenAsync(
*
* `unloadIframe` to unload the iframe before verifying stashed token to
* simulate the situation that unloads after fetching. Note that this test is
* different from `keepaliveRedirectInUnloadTest()` in that the the latter
* different from `keepaliveRedirectInUnloadTest()` in that the latter
* performs fetch() call directly in `unload` event handler, while this test
* does it in `load`.
*/
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/fetch/http-cache/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,11 @@ Possible members of a request object:
- expected_response_headers - An array of `[header_name_string, header_value_string]` representing
headers to check the response for. See also response_headers.
- expected_response_text - A string to check the response body against. If not present, `response_body` will be checked if present and non-null; otherwise the response body will be checked for the test uuid (unless the status code disallows a body). Set to `null` to disable all response body checking.
- url_params - A string of url parameters that will be appended to the end of the url, separated by "&" and without leading "&".

Some headers in `response_headers` are treated specially:

* For date-carrying headers, if the value is a number, it will be interpreted as a delta to the time of the first request at the server.
* For URL-carrying headers, the value will be appended as a query parameter for `target`.

See the source for exact details.

3 changes: 3 additions & 0 deletions test/fixtures/wpt/fetch/http-cache/http-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ function makeTestUrl (uuid, config) {
if ('query_arg' in config) {
arg = `&target=${config.query_arg}`
}
if ('url_params' in config) {
arg = `${arg}&${config.url_params}`
}
return `${base_url}resources/http-cache.py?dispatch=test&uuid=${uuid}${arg}`
}

Expand Down
33 changes: 33 additions & 0 deletions test/fixtures/wpt/fetch/http-cache/no-vary-search.tentative.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// META: global=window,worker
// META: title=NoVarySearch HTTP Cache
// META: timeout=long
// META: script=/common/utils.js
// META: script=/common/get-host-info.sub.js
// META: script=http-cache.js
/*
NOTE for testing No-Vary-Search-Header:
If `params` is set to true, `expect=("dispatch" "uuid")` must be specified.
Otherwise:
- The same HTTP Cache will be used by other tests, which are supposed
to be distinguished by uuid.
- The test utility cannot get the server's states because UA will use the HTTP
Cache instead of sending a new request to server to ask for the latest state.
*/
var tests = [
{
name: "When params is set to true, URL differs only by their parameters (other than `dispatch` and `uuid`) should not be cached as different entries.",
requests: [
{
url_params: "a=1&b=2",
response_headers: [
["Cache-Control", "max-age=10000"],
["No-Vary-Search", "params, except=(\"dispatch\" \"uuid\")"],
],
},
{
expected_type: "cached"
}
]
}
];
run_tests(tests);
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,18 @@
`location.replace(\`${dangling_url}\`)`,
];

function get_requests(worker, expected) {
return new Promise(resolve => {
function get_requests(test, worker, expected) {
return new Promise((resolve, reject) => {
let didTimeout = false;
test.step_timeout(() => {
didTimeout = true;
reject("get_requests timed out");
}, 1000);
navigator.serviceWorker.addEventListener('message', function onMsg(evt) {
if (evt.data.size >= expected) {
navigator.serviceWorker.removeEventListener('message', onMsg);
resolve(evt.data);
} else {
} else if (!didTimeout) {
worker.postMessage("");
}
});
Expand All @@ -40,6 +45,7 @@
});

const dangling_resource = "404?type=text/javascript&\n<"
const dangling_resource_expected = "404?type=text/javascript&%3C"
const api_calls = [
[`const xhr = new XMLHttpRequest();
xhr.open("GET", \`${"xhr" + dangling_resource}\`);
Expand All @@ -54,22 +60,30 @@

];

navigator.serviceWorker.register('service-worker.js');
const iframe = document.createElement('iframe');
iframe.src = "resources/empty.html";
document.body.appendChild(iframe);
let iframe, registration;
promise_test(async t => {
iframe = document.createElement('iframe');
iframe.src = "resources/empty.html";
document.body.appendChild(iframe);
await new Promise(resolve => iframe.onload = resolve);
registration = await navigator.serviceWorker.register('service-worker.js');
if (!iframe.contentWindow.navigator.serviceWorker.controller)
await new Promise(resolve => iframe.contentWindow.navigator.serviceWorker.oncontrollerchange = resolve);
}, "Setup controlled frame");

let number_api_calls = 0;
api_calls.forEach(call => {
promise_test(t => {
return new Promise(resolve => {
navigator.serviceWorker.ready.then(t.step_func(registration => {
iframe.contentWindow.eval(call[0]);
get_requests(registration.active, 0).then(t.step_func(requests => {
resolve(assert_true(requests.has(call[1] + dangling_resource)));
}));
}));
});
promise_test(async t => {
iframe.contentWindow.eval(call[0]);
const requests = await get_requests(t, registration.active, number_api_calls + 1);
assert_equals(Array.from(requests)[number_api_calls], call[1] + dangling_resource_expected);
number_api_calls++;
}, `Does not block ${call[1]}`);
});
promise_test(async () => {
iframe.remove();
registration.unregister();
}, "Clean up iframe");

async_test(t => {
let url = new URL(location.origin + "/" + dangling_url);
Expand Down
13 changes: 12 additions & 1 deletion test/fixtures/wpt/interfaces/dom.idl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ Document includes NonElementParentNode;
DocumentFragment includes NonElementParentNode;

interface mixin DocumentOrShadowRoot {
readonly attribute CustomElementRegistry? customElementRegistry;
};
Document includes DocumentOrShadowRoot;
ShadowRoot includes DocumentOrShadowRoot;
Expand Down Expand Up @@ -293,7 +294,7 @@ interface Document : Node {
[NewObject] Comment createComment(DOMString data);
[NewObject] ProcessingInstruction createProcessingInstruction(DOMString target, DOMString data);

[CEReactions, NewObject] Node importNode(Node node, optional boolean subtree = false);
[CEReactions, NewObject] Node importNode(Node node, optional (boolean or ImportNodeOptions) options = false);
[CEReactions] Node adoptNode(Node node);

[NewObject] Attr createAttribute(DOMString localName);
Expand All @@ -312,9 +313,15 @@ interface Document : Node {
interface XMLDocument : Document {};

dictionary ElementCreationOptions {
CustomElementRegistry customElementRegistry;
DOMString is;
};

dictionary ImportNodeOptions {
CustomElementRegistry customElementRegistry;
boolean selfOnly = false;
};

[Exposed=Window]
interface DOMImplementation {
[NewObject] DocumentType createDocumentType(DOMString qualifiedName, DOMString publicId, DOMString systemId);
Expand Down Expand Up @@ -344,6 +351,7 @@ interface ShadowRoot : DocumentFragment {
readonly attribute boolean clonable;
readonly attribute boolean serializable;
readonly attribute Element host;

attribute EventHandler onslotchange;
};

Expand Down Expand Up @@ -384,6 +392,8 @@ interface Element : Node {
ShadowRoot attachShadow(ShadowRootInit init);
readonly attribute ShadowRoot? shadowRoot;

readonly attribute CustomElementRegistry? customElementRegistry;

Element? closest(DOMString selectors);
boolean matches(DOMString selectors);
boolean webkitMatchesSelector(DOMString selectors); // legacy alias of .matches
Expand All @@ -402,6 +412,7 @@ dictionary ShadowRootInit {
SlotAssignmentMode slotAssignment = "named";
boolean clonable = false;
boolean serializable = false;
CustomElementRegistry customElementRegistry;
};

[Exposed=Window,
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/interfaces/fedcm.idl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ dictionary IdentityProviderBranding {

dictionary IdentityProviderAPIConfig {
required USVString accounts_endpoint;
required USVString client_metadata_endpoint;
USVString client_metadata_endpoint;
required USVString id_assertion_endpoint;
required USVString login_url;
USVString disconnect_endpoint;
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/wpt/interfaces/html.idl
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,7 @@ interface HTMLTemplateElement : HTMLElement {
[CEReactions] attribute boolean shadowRootDelegatesFocus;
[CEReactions] attribute boolean shadowRootClonable;
[CEReactions] attribute boolean shadowRootSerializable;
[CEReactions] attribute DOMString shadowRootCustomElementRegistry;
};

[Exposed=Window]
Expand Down Expand Up @@ -1629,11 +1630,14 @@ OffscreenCanvasRenderingContext2D includes CanvasPath;

[Exposed=Window]
interface CustomElementRegistry {
constructor();

[CEReactions] undefined define(DOMString name, CustomElementConstructor constructor, optional ElementDefinitionOptions options = {});
(CustomElementConstructor or undefined) get(DOMString name);
DOMString? getName(CustomElementConstructor constructor);
Promise<CustomElementConstructor> whenDefined(DOMString name);
[CEReactions] undefined upgrade(Node root);
undefined initialize(Node root);
};

callback CustomElementConstructor = HTMLElement ();
Expand Down
10 changes: 9 additions & 1 deletion test/fixtures/wpt/interfaces/secure-payment-confirmation.idl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,16 @@ dictionary SecurePaymentConfirmationRequest {
boolean showOptOut;
};

enum SecurePaymentConfirmationAvailability {
"available",
"unavailable-unknown-reason",
"unavailable-feature-not-enabled",
"unavailable-no-permission-policy",
"unavailable-no-user-verifying-platform-authenticator",
};

partial interface PaymentRequest {
static Promise<boolean> isSecurePaymentConfirmationAvailable();
static Promise<SecurePaymentConfirmationAvailability> securePaymentConfirmationAvailability();
};

partial dictionary AuthenticationExtensionsClientInputs {
Expand Down
22 changes: 21 additions & 1 deletion test/fixtures/wpt/interfaces/speech-api.idl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ interface SpeechRecognition : EventTarget {
attribute boolean interimResults;
attribute unsigned long maxAlternatives;
attribute SpeechRecognitionMode mode;
attribute SpeechRecognitionPhraseList phrases;

// methods to drive the speech interaction
undefined start();
Expand Down Expand Up @@ -43,7 +44,8 @@ enum SpeechRecognitionErrorCode {
"network",
"not-allowed",
"service-not-allowed",
"language-not-supported"
"language-not-supported",
"phrases-not-supported"
};

enum SpeechRecognitionMode {
Expand Down Expand Up @@ -106,6 +108,24 @@ dictionary SpeechRecognitionEventInit : EventInit {
required SpeechRecognitionResultList results;
};

// The object representing a phrase for contextual biasing.
[Exposed=Window]
interface SpeechRecognitionPhrase {
constructor(DOMString phrase, optional float boost = 1.0);
readonly attribute DOMString phrase;
readonly attribute float boost;
};

// The object representing a list of phrases for contextual biasing.
[Exposed=Window]
interface SpeechRecognitionPhraseList {
constructor(sequence<SpeechRecognitionPhrase> phrases);
readonly attribute unsigned long length;
SpeechRecognitionPhrase item(unsigned long index);
undefined addItem(SpeechRecognitionPhrase item);
undefined removeItem(unsigned long index);
};

[Exposed=Window]
interface SpeechSynthesis : EventTarget {
readonly attribute boolean pending;
Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/wpt/resources/chromium/webxr-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,11 @@ class MockRuntime {

this.enabledFeatures_ = enabled_features;

let selectedDepthType;
if (sessionOptions.depthOptions && sessionOptions.depthOptions.depthTypeRequest.length != 0) {
selectedDepthType = sessionOptions.depthOptions.depthTypeRequest[0];
}

return Promise.resolve({
session: {
submitFrameSink: submit_frame_sink,
Expand All @@ -1219,9 +1224,12 @@ class MockRuntime {
depthConfiguration: enabled_features.includes(
xrSessionMojom.XRSessionFeature.DEPTH) ?
{
// TODO(https://crbug.com/409806803): Update support via
// a webxr-test-api method.
depthUsage: xrSessionMojom.XRDepthUsage.kCPUOptimized,
depthDataFormat:
xrSessionMojom.XRDepthDataFormat.kLuminanceAlpha,
depthType: selectedDepthType,
} :
null,
views: this._getDefaultViews(),
Expand Down Expand Up @@ -1251,6 +1259,7 @@ class MockRuntime {
switch (feature) {
case xrSessionMojom.XRSessionFeature.DEPTH:
// This matches what Chrome can currently support.
// TODO(https://crbug.com/409806803): Add a webxr-test-api for this.
return options.depthOptions &&
(options.depthOptions.usagePreferences.length == 0 ||
options.depthOptions.usagePreferences.includes(
Expand Down
Loading
Loading