Skip to content

[web] 2 small fixes to JavaScript code#27985

Merged
fs-eire merged 2 commits intomainfrom
fs-eire/small-fixes-web
Apr 8, 2026
Merged

[web] 2 small fixes to JavaScript code#27985
fs-eire merged 2 commits intomainfrom
fs-eire/small-fixes-web

Conversation

@fs-eire
Copy link
Copy Markdown
Contributor

@fs-eire fs-eire commented Apr 6, 2026

Description

2 small fixes to JavaScript code

The quote in the pre.js is important. closure compiler will skip minimizing the property names when they are quoted. Without the quote, the following code is generated:

var SharedArrayBuffer=globalThis.SharedArrayBuffer??(new WebAssembly.Memory({initial:0,maximum:0,Be:!0})).buffer.constructor;

property shared is rewritten into Be, which is ignored by WebAssembly.Memory() and shared is assumed to be false (default value).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses two small but important web/JavaScript fixes: ensuring Closure Compiler doesn’t rename critical WebAssembly.Memory() option properties in the --pre-js injection, and correcting a cleanup list in the WASM artifact pull script.

Changes:

  • Prevent Prettier from unquoting WebAssembly.Memory() option keys so Closure Compiler won’t rename them (preserving correct shared: true behavior).
  • Fix the artifact cleanup list to include ort-wasm-simd-threaded.asyncify.wasm instead of a duplicated .mjs entry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
onnxruntime/wasm/pre.js Adds prettier-ignore and keeps quoted option keys for WebAssembly.Memory() to avoid Closure Compiler property renaming.
js/web/script/pull-prebuilt-wasm-artifacts.ts Fixes an incorrect duplicated filename so the script deletes the .wasm asyncify artifact as intended.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@fs-eire fs-eire merged commit 2a54ef9 into main Apr 8, 2026
101 of 102 checks passed
@fs-eire fs-eire deleted the fs-eire/small-fixes-web branch April 8, 2026 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants