Skip to content

Commit

Permalink
chore: update WPT
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzlopak authored and github-actions[bot] committed Jan 21, 2025
1 parent d76f5cf commit 94dca79
Show file tree
Hide file tree
Showing 14 changed files with 306 additions and 48 deletions.
19 changes: 19 additions & 0 deletions test/fixtures/wpt/fetch/api/basic/gc.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// META: global=window,worker
// META: script=/common/gc.js

promise_test(async () => {
let i = 0;
const repeat = 5;
const buffer = await new Response(new ReadableStream({
pull(c) {
if (i >= repeat) {
c.close();
return;
}
++i;
c.enqueue(new Uint8Array([0]))
garbageCollect();
}
})).arrayBuffer();
assert_equals(buffer.byteLength, repeat, `The buffer should be ${repeat}-byte long`);
}, "GC/CC should not abruptly close the stream while being consumed by Response");
54 changes: 54 additions & 0 deletions test/fixtures/wpt/interfaces/css-fonts-5.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// GENERATED CONTENT - DO NOT EDIT
// Content was automatically extracted by Reffy into webref
// (https://github.com/w3c/webref)
// Source: CSS Fonts Module Level 5 (https://drafts.csswg.org/css-fonts-5/)

[Exposed=Window]
interface CSSFontFaceDescriptors : CSSStyleDeclaration {
attribute [LegacyNullToEmptyString] CSSOMString src;
attribute [LegacyNullToEmptyString] CSSOMString fontFamily;
attribute [LegacyNullToEmptyString] CSSOMString font-family;
attribute [LegacyNullToEmptyString] CSSOMString fontStyle;
attribute [LegacyNullToEmptyString] CSSOMString font-style;
attribute [LegacyNullToEmptyString] CSSOMString fontWeight;
attribute [LegacyNullToEmptyString] CSSOMString font-weight;
attribute [LegacyNullToEmptyString] CSSOMString fontStretch;
attribute [LegacyNullToEmptyString] CSSOMString font-stretch;
attribute [LegacyNullToEmptyString] CSSOMString fontWidth;
attribute [LegacyNullToEmptyString] CSSOMString font-width;
attribute [LegacyNullToEmptyString] CSSOMString fontSize;
attribute [LegacyNullToEmptyString] CSSOMString font-size;
attribute [LegacyNullToEmptyString] CSSOMString sizeAdjust;
attribute [LegacyNullToEmptyString] CSSOMString size-adjust;
attribute [LegacyNullToEmptyString] CSSOMString unicodeRange;
attribute [LegacyNullToEmptyString] CSSOMString unicode-range;
attribute [LegacyNullToEmptyString] CSSOMString fontFeatureSettings;
attribute [LegacyNullToEmptyString] CSSOMString font-feature-settings;
attribute [LegacyNullToEmptyString] CSSOMString fontVariationSettings;
attribute [LegacyNullToEmptyString] CSSOMString font-variation-settings;
attribute [LegacyNullToEmptyString] CSSOMString fontNamedInstance;
attribute [LegacyNullToEmptyString] CSSOMString font-named-instance;
attribute [LegacyNullToEmptyString] CSSOMString fontDisplay;
attribute [LegacyNullToEmptyString] CSSOMString font-display;
attribute [LegacyNullToEmptyString] CSSOMString fontLanguageOverride;
attribute [LegacyNullToEmptyString] CSSOMString font-language-override;
attribute [LegacyNullToEmptyString] CSSOMString ascentOverride;
attribute [LegacyNullToEmptyString] CSSOMString ascent-override;
attribute [LegacyNullToEmptyString] CSSOMString descentOverride;
attribute [LegacyNullToEmptyString] CSSOMString descent-override;
attribute [LegacyNullToEmptyString] CSSOMString lineGapOverride;
attribute [LegacyNullToEmptyString] CSSOMString line-gap-override;
attribute [LegacyNullToEmptyString] CSSOMString superscriptPositionOverride;
attribute [LegacyNullToEmptyString] CSSOMString superscript-position-override;
attribute [LegacyNullToEmptyString] CSSOMString subscriptPositionOverride;
attribute [LegacyNullToEmptyString] CSSOMString subscript-position-override;
attribute [LegacyNullToEmptyString] CSSOMString superscriptSizeOverride;
attribute [LegacyNullToEmptyString] CSSOMString superscript-size-override;
attribute [LegacyNullToEmptyString] CSSOMString subscriptSizeOverride;
attribute [LegacyNullToEmptyString] CSSOMString subscript-size-override;
};

[Exposed=Window]
interface CSSFontFaceRule : CSSRule {
[SameObject, PutForwards=cssText] readonly attribute CSSFontFaceDescriptors style;
};
38 changes: 0 additions & 38 deletions test/fixtures/wpt/interfaces/css-fonts.idl
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,6 @@
// (https://github.com/w3c/webref)
// Source: CSS Fonts Module Level 4 (https://drafts.csswg.org/css-fonts-4/)

[Exposed=Window]
interface CSSFontFaceDescriptors : CSSStyleDeclaration {
attribute [LegacyNullToEmptyString] CSSOMString src;
attribute [LegacyNullToEmptyString] CSSOMString fontFamily;
attribute [LegacyNullToEmptyString] CSSOMString font-family;
attribute [LegacyNullToEmptyString] CSSOMString fontStyle;
attribute [LegacyNullToEmptyString] CSSOMString font-style;
attribute [LegacyNullToEmptyString] CSSOMString fontWeight;
attribute [LegacyNullToEmptyString] CSSOMString font-weight;
attribute [LegacyNullToEmptyString] CSSOMString fontStretch;
attribute [LegacyNullToEmptyString] CSSOMString font-stretch;
attribute [LegacyNullToEmptyString] CSSOMString fontWidth;
attribute [LegacyNullToEmptyString] CSSOMString font-width;
attribute [LegacyNullToEmptyString] CSSOMString unicodeRange;
attribute [LegacyNullToEmptyString] CSSOMString unicode-range;
attribute [LegacyNullToEmptyString] CSSOMString fontFeatureSettings;
attribute [LegacyNullToEmptyString] CSSOMString font-feature-settings;
attribute [LegacyNullToEmptyString] CSSOMString fontVariationSettings;
attribute [LegacyNullToEmptyString] CSSOMString font-variation-settings;
attribute [LegacyNullToEmptyString] CSSOMString fontNamedInstance;
attribute [LegacyNullToEmptyString] CSSOMString font-named-instance;
attribute [LegacyNullToEmptyString] CSSOMString fontDisplay;
attribute [LegacyNullToEmptyString] CSSOMString font-display;
attribute [LegacyNullToEmptyString] CSSOMString fontLanguageOverride;
attribute [LegacyNullToEmptyString] CSSOMString font-language-override;
attribute [LegacyNullToEmptyString] CSSOMString ascentOverride;
attribute [LegacyNullToEmptyString] CSSOMString ascent-override;
attribute [LegacyNullToEmptyString] CSSOMString descentOverride;
attribute [LegacyNullToEmptyString] CSSOMString descent-override;
attribute [LegacyNullToEmptyString] CSSOMString lineGapOverride;
attribute [LegacyNullToEmptyString] CSSOMString line-gap-override;
};

[Exposed=Window]
interface CSSFontFaceRule : CSSRule {
[SameObject, PutForwards=cssText] readonly attribute CSSFontFaceDescriptors style;
};

partial interface CSSRule { const unsigned short FONT_FEATURE_VALUES_RULE = 14;
};
[Exposed=Window]
Expand Down
10 changes: 10 additions & 0 deletions test/fixtures/wpt/interfaces/css-mixins.idl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,13 @@

[Exposed=Window]
interface CSSFunctionRule : CSSGroupingRule { };

[Exposed=Window]
interface CSSFunctionDescriptors : CSSStyleDeclaration {
attribute [LegacyNullToEmptyString] CSSOMString result;
};

[Exposed=Window]
interface CSSFunctionDeclarations : CSSRule {
[SameObject, PutForwards=cssText] readonly attribute CSSFunctionDescriptors style;
};
2 changes: 1 addition & 1 deletion test/fixtures/wpt/interfaces/digital-credentials.idl
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ dictionary DigitalCredentialRequest {
[Exposed=Window, SecureContext]
interface DigitalCredential : Credential {
readonly attribute DOMString protocol;
readonly attribute object data;
[SameObject] readonly attribute object data;
};
1 change: 1 addition & 0 deletions test/fixtures/wpt/interfaces/fedcm.idl
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ dictionary IdentityProviderRequestOptions : IdentityProviderConfig {
USVString nonce;
DOMString loginHint;
DOMString domainHint;
sequence<USVString> fields;
any params;
};

Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/wpt/interfaces/html.idl
Original file line number Diff line number Diff line change
Expand Up @@ -1222,9 +1222,11 @@ interface HTMLDialogElement : HTMLElement {

[CEReactions] attribute boolean open;
attribute DOMString returnValue;
[CEReactions] attribute DOMString closedBy;
[CEReactions] undefined show();
[CEReactions] undefined showModal();
[CEReactions] undefined close(optional DOMString returnValue);
[CEReactions] undefined requestClose(optional DOMString returnValue);
};

[Exposed=Window]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ partial interface CaptureController {

partial interface CaptureController {
constructor();
Promise<undefined> forwardWheel(HTMLElement element);
Promise<undefined> forwardWheel(HTMLElement? element);
};
1 change: 1 addition & 0 deletions test/fixtures/wpt/interfaces/permissions-policy.idl
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ interface PermissionsPolicyViolationReportBody : ReportBody {
readonly attribute long? lineNumber;
readonly attribute long? columnNumber;
readonly attribute DOMString disposition;
readonly attribute DOMString? allowAttribute;
};
44 changes: 37 additions & 7 deletions test/fixtures/wpt/interfaces/shared-storage.idl
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,49 @@ partial interface Window {
[SecureContext] readonly attribute SharedStorage? sharedStorage;
};

[Exposed=(Window,SharedStorageWorklet)]
interface SharedStorageModifierMethod {};

[Exposed=(Window, SharedStorageWorklet)]
interface SharedStorageSetMethod : SharedStorageModifierMethod {
constructor(DOMString key, DOMString value, optional SharedStorageSetMethodOptions options = {});
};

[Exposed=(Window, SharedStorageWorklet)]
interface SharedStorageAppendMethod : SharedStorageModifierMethod {
constructor(DOMString key, DOMString value, optional SharedStorageModifierMethodOptions options = {});
};

[Exposed=(Window, SharedStorageWorklet)]
interface SharedStorageDeleteMethod : SharedStorageModifierMethod {
constructor(DOMString key, optional SharedStorageModifierMethodOptions options = {});
};

[Exposed=(Window, SharedStorageWorklet)]
interface SharedStorageClearMethod : SharedStorageModifierMethod {
constructor(optional SharedStorageModifierMethodOptions options = {});
};

dictionary SharedStorageModifierMethodOptions {
DOMString withLock;
};

dictionary SharedStorageSetMethodOptions : SharedStorageModifierMethodOptions {
boolean ignoreIfPresent;
};

[Exposed=(Window,SharedStorageWorklet)]
interface SharedStorage {
Promise<any> set(DOMString key,
DOMString value,
optional SharedStorageSetMethodOptions options = {});
Promise<any> append(DOMString key,
DOMString value);
Promise<any> delete(DOMString key);
Promise<any> clear();
DOMString value,
optional SharedStorageModifierMethodOptions options = {});
Promise<any> delete(DOMString key, optional SharedStorageModifierMethodOptions options = {});
Promise<any> clear(optional SharedStorageModifierMethodOptions options = {});
Promise<any> batchUpdate(sequence<SharedStorageModifierMethod> methods,
optional SharedStorageModifierMethodOptions options = {});

[Exposed=Window]
Promise<SharedStorageResponse> selectURL(DOMString name,
Expand Down Expand Up @@ -76,10 +110,6 @@ interface SharedStorage {
async iterable<DOMString, DOMString>;
};

dictionary SharedStorageSetMethodOptions {
boolean ignoreIfPresent = false;
};

dictionary SharedStoragePrivateAggregationConfig {
USVString aggregationCoordinatorOrigin;
USVString contextId;
Expand Down
12 changes: 11 additions & 1 deletion test/fixtures/wpt/interfaces/webnn.idl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ interface ML {

typedef record<USVString, MLTensor> MLNamedTensors;

dictionary MLContextLostInfo {
DOMString message;
};

[SecureContext, Exposed=(Window, DedicatedWorker)]
interface MLContext {
undefined dispatch(MLGraph graph, MLNamedTensors inputs, MLNamedTensors outputs);
Expand All @@ -46,6 +50,10 @@ interface MLContext {
undefined writeTensor(MLTensor tensor, AllowSharedBufferSource inputData);

MLOpSupportLimits opSupportLimits();

undefined destroy();

readonly attribute Promise<MLContextLostInfo> lost;
};

dictionary MLOpSupportLimits {
Expand All @@ -71,7 +79,9 @@ dictionary MLSingleInputSupportLimits {
};

[SecureContext, Exposed=(Window, DedicatedWorker)]
interface MLGraph {};
interface MLGraph {
undefined destroy();
};

enum MLInputOperandLayout {
"nchw",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
self.addEventListener('message', event => {
event.source.postMessage('passed');
});

self.addEventListener('fetch', event => {
let url = new URL(event.request.url);
if (!url.searchParams.get('test_resource')) {
return;
}
event.respondWith(new Response('passed'));
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<!doctype html>
<html>
<body>
<iframe id="srcdocFrame" srcdoc="
<script>
function reportTestResult(result) {
top.postMessage({ type: 'TEST_RESULT', result: result }, '*');
}
async function postMessageToController() {
let controller = navigator.serviceWorker.controller;
if (!controller) {
reportTestResult('no navigator.serviceWorker.controller');
}
try {
controller.postMessage('test');
} catch (e) {
reportTestResult('Unexpected Error ' + e.name + ' : ' + e.message);
}
}
async function getServiceWorkerRegistration(scope) {
try {
let reg = await navigator.serviceWorker.getRegistration(scope);
if (!reg) {
reportTestResult('no regsitration for ' + scope);
}
if (reg.scope !== scope) {
reportTestResult('regsitration scope does not match');
}
if (!reg.active) {
reportTestResult('regsitration.active is not valid' + reg.active);
}
reportTestResult('passed');
} catch (e) {
reportTestResult('Unexpected Error ' + e.name + ' : ' + e.message);
}
}
function addSrcdocIframeWithSandbox(sandbox) {
let frame = document.createElement('iframe');
frame.sandbox = sandbox;
frame.srcdoc = `
<script>
function reportTestResult(result) {
top.postMessage({ type: 'TEST_RESULT', result: result }, '*');
}
window.onload = function onLoad() {
try {
let controller = navigator.serviceWorker.controller;
reportTestResult(controller ? 'HasController' : 'NoController');
} catch (e) {
reportTestResult((e.name == 'SecurityError') ?
'NoController' : 'UnexpectedError:' + e.message);
}
}
<\/script>`;
document.body.appendChild(frame);
}
function addSandboxedSrcdocFrame() {
addSrcdocIframeWithSandbox('allow-scripts');
}
function addSameOriginSandboxedSrcdocFrame() {
addSrcdocIframeWithSandbox('allow-scripts allow-same-origin');
}
async function fetchResource() {
let response = await fetch('?test_resource=1');
reportTestResult(await response.text());
}
window.navigator.serviceWorker.addEventListener(
'message', function onMsg(evt) {
// Forward the message as test result.
reportTestResult(evt.data);
});
</script>
"></iframe>

<script>
// Helper routine to make it slightly easier for our parent to find
// the srcdoc frame.
function srcdocFrame() {
return document.getElementById('srcdocFrame').contentWindow;
}
</script>
</body>
</html>
Loading

0 comments on commit 94dca79

Please sign in to comment.