I realized that in #3 we only considered what would happen if we try to encode a JS string bigger than 2^32 to Wasm. But what this doesn't cover is decoding from Wasm to a JS string. E.g. if a user attempts to convert to a JS string that results in a size bigger than what the engine supports it will trap, with no way to recover.
I really only see two ways to handle this:
- Do not trap, but instead throw an exception. I'm not aware of anything similar having been done before.
- Provide a function to query the maximum string size of the engine. Currently this is not even available in JS.
Cc @jakobkummerow.
I realized that in #3 we only considered what would happen if we try to encode a JS string bigger than 2^32 to Wasm. But what this doesn't cover is decoding from Wasm to a JS string. E.g. if a user attempts to convert to a JS string that results in a size bigger than what the engine supports it will trap, with no way to recover.
I really only see two ways to handle this:
Cc @jakobkummerow.