Skip to content
Prev Previous commit
Next Next commit
latest tests
  • Loading branch information
guybedford committed Mar 30, 2026
commit 213bf4cb6ff9964e201e6f476371d550fc807d6e
2 changes: 1 addition & 1 deletion test/fixtures/wpt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Last update:
- url: https://github.com/web-platform-tests/wpt/tree/fc3e651593/url
- urlpattern: https://github.com/web-platform-tests/wpt/tree/a2e15ad405/urlpattern
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/cde25e7e3c/wasm/jsapi
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/65a2134d50/wasm/jsapi
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
- web-locks: https://github.com/web-platform-tests/wpt/tree/10a122a6bc/web-locks
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/caebe89c3b/WebCryptoAPI
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"path": "user-timing"
},
"wasm/jsapi": {
"commit": "cde25e7e3c3b9d2280eb088a3fb9da988793d255",
"commit": "65a2134d50",
"path": "wasm/jsapi"
},
"wasm/webapi": {
Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/wpt/wasm/jsapi/WEB_FEATURES.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
features:
- name: wasm
files:
- "*"
5 changes: 5 additions & 0 deletions test/fixtures/wpt/wasm/jsapi/assertions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ function assert_function_name(fn, name, description) {
assert_true(propdesc.configurable, "configurable", `${description} name should be configurable`);
assert_equals(propdesc.value, name, `${description} name should be ${name}`);
}
globalThis.assert_function_name = assert_function_name;

function assert_function_length(fn, length, description) {
const propdesc = Object.getOwnPropertyDescriptor(fn, "length");
Expand All @@ -15,6 +16,7 @@ function assert_function_length(fn, length, description) {
assert_true(propdesc.configurable, "configurable", `${description} length should be configurable`);
assert_equals(propdesc.value, length, `${description} length should be ${length}`);
}
globalThis.assert_function_length = assert_function_length;

function assert_exported_function(fn, { name, length }, description) {
if (WebAssembly.Function === undefined) {
Expand All @@ -28,6 +30,7 @@ function assert_exported_function(fn, { name, length }, description) {
assert_function_name(fn, name, description);
assert_function_length(fn, length, description);
}
globalThis.assert_exported_function = assert_exported_function;

function assert_Instance(instance, expected_exports) {
assert_equals(Object.getPrototypeOf(instance), WebAssembly.Instance.prototype,
Expand Down Expand Up @@ -77,6 +80,7 @@ function assert_Instance(instance, expected_exports) {
}
}
}
globalThis.assert_Instance = assert_Instance;

function assert_WebAssemblyInstantiatedSource(actual, expected_exports={}) {
assert_equals(Object.getPrototypeOf(actual), Object.prototype,
Expand All @@ -98,3 +102,4 @@ function assert_WebAssemblyInstantiatedSource(actual, expected_exports={}) {
assert_true(instance.configurable, "instance: configurable");
assert_Instance(instance.value, expected_exports);
}
globalThis.assert_WebAssemblyInstantiatedSource = assert_WebAssemblyInstantiatedSource;
1 change: 1 addition & 0 deletions test/fixtures/wpt/wasm/jsapi/bad-imports.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,4 @@ function test_bad_imports(t) {
});
}
}
globalThis.test_bad_imports = test_bad_imports;
8 changes: 8 additions & 0 deletions test/fixtures/wpt/wasm/jsapi/constructor/WEB_FEATURES.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
features:
- name: wasm
files:
- "*"
- "!multi-value.any.js"
- name: wasm-multi-value
files:
- "multi-value.any.js"
2 changes: 1 addition & 1 deletion test/fixtures/wpt/wasm/jsapi/constructor/compile.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/wasm-module-builder.js

function assert_Module(module) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/wasm-module-builder.js
// META: script=/wasm/jsapi/bad-imports.js

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/wasm-module-builder.js
// META: script=/wasm/jsapi/assertions.js
// META: script=/wasm/jsapi/instanceTestFactory.js
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/wasm-module-builder.js
// META: script=/wasm/jsapi/assertions.js

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm

"use strict";
// https://webidl.spec.whatwg.org/#es-namespaces
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/wasm/jsapi/constructor/validate.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/wasm-module-builder.js

let emptyModuleBinary;
Expand Down
9 changes: 9 additions & 0 deletions test/fixtures/wpt/wasm/jsapi/esm-integration/WEB_FEATURES.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
features:
- name: wasm-mutable-globals
files:
- "global-exports-live-bindings.tentative.any.js"
- "mutable-global-sharing.tentative.any.js"
- name: wasm-string-builtins
files:
- "source-phase-string-builtins.tentative.any.js"
- "string-builtins.tentative.any.js"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ promise_test(async () => {
const wasmNamespace = await import("./resources/mutable-global-export.wasm");
const instance = WebAssembly.namespaceInstance(wasmNamespace);

const wasmNamespace2 = await import("./resources/mutable-global-export.wasm");
const instance2 = WebAssembly.namespaceInstance(wasmNamespace2);
assert_equals(instance, instance2);

assert_true(instance instanceof WebAssembly.Instance);

wasmNamespace.setGlobal(999);
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/wpt/wasm/jsapi/exception/WEB_FEATURES.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
features:
- name: wasm-exception-handling
files: "**"
16 changes: 10 additions & 6 deletions test/fixtures/wpt/wasm/jsapi/exception/basic.tentative.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,worker,jsshell
// META: global=window,worker,jsshell,shadowrealm
// META: script=/wasm/jsapi/wasm-module-builder.js

function assert_throws_wasm(fn, message) {
Expand All @@ -7,12 +7,16 @@ function assert_throws_wasm(fn, message) {
assert_not_reached(`expected to throw with ${message}`);
} catch (e) {
assert_true(e instanceof WebAssembly.Exception, `Error should be a WebAssembly.Exception with ${message}`);
// According to the spec discussion, the current `WebAssembly.Exception` does not have `[[ErrorData]]` semantically.
// - https://github.com/WebAssembly/spec/issues/1914
// - https://webassembly.github.io/spec/js-api/#exceptions
// - https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-properties-of-error-instances
assert_false(Error.isError(e), `Error.isError(WebAssembly.Exception) should be false due to lacking [[ErrorData]]`);
}
}

promise_test(async () => {
const kWasmAnyRef = 0x6f;
const kSig_v_r = makeSig([kWasmAnyRef], []);
const kSig_v_r = makeSig([kWasmExternRef], []);
const builder = new WasmModuleBuilder();
const tagIndex = builder.addTag(kSig_v_r);
builder.addFunction("throw_param", kSig_v_r)
Expand Down Expand Up @@ -48,7 +52,7 @@ promise_test(async () => {
const tagIndex = builder.addTag(kSig_v_a);
builder.addFunction("throw_null", kSig_v_v)
.addBody([
kExprRefNull, kWasmAnyFunc,
kExprRefNull, kAnyFuncCode,
kExprThrow, tagIndex,
])
.exportFunc();
Expand Down Expand Up @@ -82,7 +86,7 @@ promise_test(async () => {
kExprCatch, tagIndex,
kExprReturn,
kExprEnd,
kExprRefNull, kWasmAnyRef,
kExprRefNull, kExternRefCode,
])
.exportFunc();

Expand All @@ -106,7 +110,7 @@ promise_test(async () => {
kExprCatchAll,
kExprRethrow, 0x00,
kExprEnd,
kExprRefNull, kWasmAnyRef,
kExprRefNull, kExternRefCode,
])
.exportFunc();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/assertions.js

test(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/memory/assertions.js

test(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/assertions.js
// META: script=/wasm/jsapi/wasm-module-builder.js

Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/wpt/wasm/jsapi/exception/is.tentative.any.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/memory/assertions.js

test(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm

test(() => {
const argument = { parameters: [] };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/assertions.js

function addxy(x, y) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/assertions.js

function addxy(x, y) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/assertions.js

function testfunc(n) {}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// META: global=window,dedicatedworker,jsshell
// META: global=window,dedicatedworker,jsshell,shadowrealm
// META: script=/wasm/jsapi/assertions.js

function addNumbers(x, y, z) {
Expand Down
3 changes: 3 additions & 0 deletions test/fixtures/wpt/wasm/jsapi/functions/WEB_FEATURES.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
features:
- name: wasm
files: "**"
Loading