From 8cbd90161bdf3d61717eae366a28cc7855e417af Mon Sep 17 00:00:00 2001 From: "Node.js GitHub Bot" Date: Tue, 5 May 2026 21:47:37 +0000 Subject: [PATCH] test: update WPT for wasm/jsapi to 288c467d35 PR-URL: https://github.com/nodejs/node/pull/63136 Reviewed-By: Filip Skokan Reviewed-By: Mattias Buelens Reviewed-By: Joyee Cheung Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- test/fixtures/wpt/README.md | 2 +- test/fixtures/wpt/versions.json | 2 +- .../resources/js-string-constants.wasm | Bin 0 -> 217 bytes .../resources/js-string-constants.wat | 11 ++++++ ...ce-phase-string-constants.tentative.any.js | 32 ++++++++++++++++++ .../string-constants.tentative.any.js | 10 ++++++ .../jsapi/exception/basic.tentative.any.js | 2 +- .../exception/constructor.tentative.any.js | 2 +- 8 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 test/fixtures/wpt/wasm/jsapi/esm-integration/resources/js-string-constants.wasm create mode 100644 test/fixtures/wpt/wasm/jsapi/esm-integration/resources/js-string-constants.wat create mode 100644 test/fixtures/wpt/wasm/jsapi/esm-integration/source-phase-string-constants.tentative.any.js create mode 100644 test/fixtures/wpt/wasm/jsapi/esm-integration/string-constants.tentative.any.js diff --git a/test/fixtures/wpt/README.md b/test/fixtures/wpt/README.md index 1d4324a93b6..8e60dccefe8 100644 --- a/test/fixtures/wpt/README.md +++ b/test/fixtures/wpt/README.md @@ -31,7 +31,7 @@ Last update: - url: https://github.com/web-platform-tests/wpt/tree/d4598eba09/url - urlpattern: https://github.com/web-platform-tests/wpt/tree/11a459a2b1/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/288c467d35/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/03a1476844/WebCryptoAPI diff --git a/test/fixtures/wpt/versions.json b/test/fixtures/wpt/versions.json index bb3bb4d731d..32d18634038 100644 --- a/test/fixtures/wpt/versions.json +++ b/test/fixtures/wpt/versions.json @@ -84,7 +84,7 @@ "path": "user-timing" }, "wasm/jsapi": { - "commit": "cde25e7e3c3b9d2280eb088a3fb9da988793d255", + "commit": "288c467d350ec4b8e4fbc7f2ccb6119293186611", "path": "wasm/jsapi" }, "wasm/webapi": { diff --git a/test/fixtures/wpt/wasm/jsapi/esm-integration/resources/js-string-constants.wasm b/test/fixtures/wpt/wasm/jsapi/esm-integration/resources/js-string-constants.wasm new file mode 100644 index 0000000000000000000000000000000000000000..4ba2d9e7c5811f99d888292c55e361cc5c5c79c2 GIT binary patch literal 217 zcmZQbEY4+QU|?XXXOSoevaPa;^@~f2GV{`Plk@Y6OA_-+iW!*m8E{H6;+191NX^N~ z$ETm=!~7WyKn3h7EUc-y1tpct3> { + const wasmModuleSource = await import.source("./resources/js-string-constants.wasm"); + + const instance = new WebAssembly.Instance(wasmModuleSource, {}); + + assert_equals(instance.exports.empty.value, ""); + assert_equals(instance.exports.nullByte.value, "\0"); + assert_equals(instance.exports.hello.value, "hello"); + assert_equals(instance.exports.emoji.value, "\u{1F600}"); +}, "String constants from wasm:js/string-constants should be supported in source phase imports"); + +promise_test(async () => { + const wasmModuleSource = await import.source("./resources/js-string-constants.wasm"); + + const exports = WebAssembly.Module.exports(wasmModuleSource); + const exportNames = exports.map((exp) => exp.name); + + assert_true(exportNames.includes("empty")); + assert_true(exportNames.includes("nullByte")); + assert_true(exportNames.includes("hello")); + assert_true(exportNames.includes("emoji")); +}, "Source phase import should properly expose string constants exports"); + +promise_test(async () => { + const wasmModuleSource = await import.source("./resources/js-string-constants.wasm"); + + const imports = WebAssembly.Module.imports(wasmModuleSource); + + assert_equals(imports.length, 0); +}, "Source phase import should handle string constants import reflection correctly"); diff --git a/test/fixtures/wpt/wasm/jsapi/esm-integration/string-constants.tentative.any.js b/test/fixtures/wpt/wasm/jsapi/esm-integration/string-constants.tentative.any.js new file mode 100644 index 00000000000..8166bb4f721 --- /dev/null +++ b/test/fixtures/wpt/wasm/jsapi/esm-integration/string-constants.tentative.any.js @@ -0,0 +1,10 @@ +// META: global=window,dedicatedworker,jsshell,shadowrealm + +promise_test(async () => { + const wasmModule = await import("./resources/js-string-constants.wasm"); + + assert_equals(wasmModule.empty, ""); + assert_equals(wasmModule.nullByte, "\0"); + assert_equals(wasmModule.hello, "hello"); + assert_equals(wasmModule.emoji, "\u{1F600}"); +}, "String constants from wasm:js/string-constants should be supported in ESM integration"); diff --git a/test/fixtures/wpt/wasm/jsapi/exception/basic.tentative.any.js b/test/fixtures/wpt/wasm/jsapi/exception/basic.tentative.any.js index acf644f904f..73b38045496 100644 --- a/test/fixtures/wpt/wasm/jsapi/exception/basic.tentative.any.js +++ b/test/fixtures/wpt/wasm/jsapi/exception/basic.tentative.any.js @@ -4,7 +4,7 @@ function assert_throws_wasm(fn, message) { try { fn(); - assert_not_reached(`expected to throw with ${message}`); + assert_unreached(`expected to throw with ${message}`); } catch (e) { assert_true(e instanceof WebAssembly.Exception, `Error should be a WebAssembly.Exception with ${message}`); } diff --git a/test/fixtures/wpt/wasm/jsapi/exception/constructor.tentative.any.js b/test/fixtures/wpt/wasm/jsapi/exception/constructor.tentative.any.js index 7ad08e1883b..17057a22873 100644 --- a/test/fixtures/wpt/wasm/jsapi/exception/constructor.tentative.any.js +++ b/test/fixtures/wpt/wasm/jsapi/exception/constructor.tentative.any.js @@ -10,7 +10,7 @@ test(() => { }, "name"); test(() => { - assert_function_length(WebAssembly.Exception, 1, "WebAssembly.Exception"); + assert_function_length(WebAssembly.Exception, 2, "WebAssembly.Exception"); }, "length"); test(() => {