Replace incorrect wasm compilation fallback logic. Fixes #42055 partly #42918
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.
Previously we:
instantiateStreaminginstantiateThe problem is that this kind of fallback has never worked, because the first call to
instantiateStreamingconsumes the response body, so the second step would be guaranteed to fail in all cases.We could solve this using
response.clone(), but there's no known use case for the fallback anyway. As long as we only attempt to useinstantiateStreamingwhen the content-typeapplication/wasmis found (as per spec), then it should work, and if not there's no reason to think thatinstantiatewould be more successful.So as of this PR, we don't do fallback - we just pick between the two compilation APIs based on the content-type. This should increase our compatibility versus what we did before.
Fixes one of the main concerns raised in #42055