Skip to content

Commit 6eaa60c

Browse files
test: update WPT for wasm/jsapi to 288c467d35
PR-URL: #63136 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 678b46a commit 6eaa60c

13 files changed

Lines changed: 73 additions & 12 deletions

test/fixtures/wpt/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Last update:
3131
- url: https://github.com/web-platform-tests/wpt/tree/258f285de0/url
3232
- urlpattern: https://github.com/web-platform-tests/wpt/tree/f07c03cbed/urlpattern
3333
- user-timing: https://github.com/web-platform-tests/wpt/tree/5ae85bf826/user-timing
34-
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/65a2134d50/wasm/jsapi
34+
- wasm/jsapi: https://github.com/web-platform-tests/wpt/tree/288c467d35/wasm/jsapi
3535
- wasm/webapi: https://github.com/web-platform-tests/wpt/tree/fd1b23eeaa/wasm/webapi
3636
- web-locks: https://github.com/web-platform-tests/wpt/tree/10a122a6bc/web-locks
3737
- WebCryptoAPI: https://github.com/web-platform-tests/wpt/tree/8b5cd267b4/WebCryptoAPI

test/fixtures/wpt/versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@
8484
"path": "user-timing"
8585
},
8686
"wasm/jsapi": {
87-
"commit": "65a2134d50",
87+
"commit": "288c467d350ec4b8e4fbc7f2ccb6119293186611",
8888
"path": "wasm/jsapi"
8989
},
9090
"wasm/webapi": {
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
(module
2+
(import "wasm:js/string-constants" "" (global $empty externref))
3+
(import "wasm:js/string-constants" "\00" (global $null_byte externref))
4+
(import "wasm:js/string-constants" "hello" (global $hello externref))
5+
(import "wasm:js/string-constants" "\f0\9f\98\80" (global $emoji externref))
6+
7+
(export "empty" (global $empty))
8+
(export "nullByte" (global $null_byte))
9+
(export "hello" (global $hello))
10+
(export "emoji" (global $emoji))
11+
)

test/fixtures/wpt/wasm/jsapi/esm-integration/source-phase-string-builtins.tentative.any.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ promise_test(async () => {
3737

3838
assert_equals(imports.length, 0);
3939
}, "Source phase import should handle string builtin import reflection correctly");
40+
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// META: global=window,dedicatedworker,jsshell,shadowrealm
2+
3+
promise_test(async () => {
4+
const wasmModuleSource = await import.source("./resources/js-string-constants.wasm");
5+
6+
const instance = new WebAssembly.Instance(wasmModuleSource, {});
7+
8+
assert_equals(instance.exports.empty.value, "");
9+
assert_equals(instance.exports.nullByte.value, "\0");
10+
assert_equals(instance.exports.hello.value, "hello");
11+
assert_equals(instance.exports.emoji.value, "\u{1F600}");
12+
}, "String constants from wasm:js/string-constants should be supported in source phase imports");
13+
14+
promise_test(async () => {
15+
const wasmModuleSource = await import.source("./resources/js-string-constants.wasm");
16+
17+
const exports = WebAssembly.Module.exports(wasmModuleSource);
18+
const exportNames = exports.map((exp) => exp.name);
19+
20+
assert_true(exportNames.includes("empty"));
21+
assert_true(exportNames.includes("nullByte"));
22+
assert_true(exportNames.includes("hello"));
23+
assert_true(exportNames.includes("emoji"));
24+
}, "Source phase import should properly expose string constants exports");
25+
26+
promise_test(async () => {
27+
const wasmModuleSource = await import.source("./resources/js-string-constants.wasm");
28+
29+
const imports = WebAssembly.Module.imports(wasmModuleSource);
30+
31+
assert_equals(imports.length, 0);
32+
}, "Source phase import should handle string constants import reflection correctly");

test/fixtures/wpt/wasm/jsapi/esm-integration/string-builtins.tentative.any.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ promise_test(async () => {
1010
assert_equals(wasmModule.testString("hello"), 1);
1111
assert_equals(wasmModule.testString(42), 0);
1212
}, "String builtins should be supported in imports in ESM integration");
13+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// META: global=window,dedicatedworker,jsshell,shadowrealm
2+
3+
promise_test(async () => {
4+
const wasmModule = await import("./resources/js-string-constants.wasm");
5+
6+
assert_equals(wasmModule.empty, "");
7+
assert_equals(wasmModule.nullByte, "\0");
8+
assert_equals(wasmModule.hello, "hello");
9+
assert_equals(wasmModule.emoji, "\u{1F600}");
10+
}, "String constants from wasm:js/string-constants should be supported in ESM integration");

test/fixtures/wpt/wasm/jsapi/exception/basic.tentative.any.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
function assert_throws_wasm(fn, message) {
55
try {
66
fn();
7-
assert_not_reached(`expected to throw with ${message}`);
7+
assert_unreached(`expected to throw with ${message}`);
88
} catch (e) {
99
assert_true(e instanceof WebAssembly.Exception, `Error should be a WebAssembly.Exception with ${message}`);
1010
// According to the spec discussion, the current `WebAssembly.Exception` does not have `[[ErrorData]]` semantically.

test/fixtures/wpt/wasm/jsapi/exception/constructor.tentative.any.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ test(() => {
1010
}, "name");
1111

1212
test(() => {
13-
assert_function_length(WebAssembly.Exception, 1, "WebAssembly.Exception");
13+
assert_function_length(WebAssembly.Exception, 2, "WebAssembly.Exception");
1414
}, "length");
1515

1616
test(() => {

0 commit comments

Comments
 (0)