summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/wasm_url.js
diff options
context:
space:
mode:
authorAndreu Botella <abb@randomunok.com>2021-10-10 07:03:23 -0700
committerGitHub <noreply@github.com>2021-10-10 16:03:23 +0200
commit5edd2771619ddc3cd2f6c76cc93ee64277aa17c2 (patch)
tree88307d65fc81388579328dfb7d3da782ffa3f5a9 /cli/tests/testdata/wasm_url.js
parent6ac0337165d5e341eee9bff9ff0065894289df69 (diff)
feat: Show the URL of streaming WASM modules in stack traces (#12268)
WebAssembly modules compiled through `WebAssembly.compile()` and similar non-streaming APIs don't have a URL associated to them, because they have been compiled from a buffer source. In stack traces, V8 will use a URL such as `wasm://wasm/d1c677ea`, with a hash of the module. However, wasm modules compiled through streaming APIs, like `WebAssembly.compileStreaming()`, do have a known URL, which can be obtained from the `Response` object passed into the streaming APIs. And as per the developer-facing display conventions in the WebAssembly Web API spec, this URL should be used in stack traces. This change implements that.
Diffstat (limited to 'cli/tests/testdata/wasm_url.js')
-rw-r--r--cli/tests/testdata/wasm_url.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/tests/testdata/wasm_url.js b/cli/tests/testdata/wasm_url.js
new file mode 100644
index 000000000..bb7ccd73d
--- /dev/null
+++ b/cli/tests/testdata/wasm_url.js
@@ -0,0 +1,8 @@
+const module = await WebAssembly.compileStreaming(
+ fetch("http://localhost:4545/unreachable.wasm"),
+);
+const instance = new WebAssembly.Instance(module);
+
+// Compare the stack trace with wasm_unreachable.js, which compiles the WASM
+// module with synchronous APIs.
+instance.exports.unreachable();