Repository navigation
Conversation
`instantiateAsync()` returned the promise from `cosInstantiateStream()` without awaiting it, so a compile failure on the cache-hit or cache-miss path skipped the surrounding `catch` and rejected module instantiation. Await it so the failure reaches the fallback, as the comments describe.
There was a problem hiding this comment.
Code Review
This pull request ensures that when using -sCROSS_ORIGIN_STORAGE, a Wasm file that fails to compile on the cache-hit or cache-miss path correctly falls through to the standard loading path. This is implemented by adding await to the cosInstantiateStream calls inside the try-catch blocks in src/preamble.js, ensuring compilation errors are caught. A new browser test, test_cross_origin_storage_bad_hit, has been added to verify this fallback behavior. There are no review comments, so I have no feedback to provide.
sbc100
reviewed
Nov 6, 2026
sbc100
reviewed
Nov 6, 2026
sbc100
approved these changes
Nov 6, 2026
tomayac
commented
Nov 6, 2026
tomayac
enabled auto-merge (squash)
November 6, 2026 16:05
sbc100
approved these changes
Nov 6, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
-sCROSS_ORIGIN_STORAGE,instantiateAsync()returned the promise fromcosInstantiateStream()without awaiting it. A compile failure on the cache-hit or cache-miss path therefore skipped the surroundingcatchand rejected module instantiation, while the comments say it falls through to the standard path. One realistic trigger is a server that answers the.wasmURL with an HTML fallback page.This change awaits both calls, so the failure reaches the fallback. A hit with bad bytes now refetches from the network, and a failed miss falls through to the standard streaming path.
The new
browser.test_cross_origin_storage_bad_hittest stubsnavigator.crossOriginStorageto return bytes that do not compile and to refuse writes, so it runs without the COS extension. I checked the same behavior against a 6.0.13 build of SQLite Wasm in Chromium: without the change, init rejects withCompileError; with it, the module loads from the network.