Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit fixes the `init` function when passed a `WebAssembly.Module`. Upon closer reading of the [spec] we see there's two possible return values from `WebAssembly.instantiate`. If passed a `Module`, it will return only the `Instance`. If passed a buffer source, though, it'll return an object with the module/instance. The fix here is to check the result value and add in the module if it looks like it wasn't already present. This will hopefully continue to address the CloudFlare use case where `instance of WebAssembly.Module` doens't work, but it'll also ensure that it detects when the module is present and uses the result object if it can. Closes #1418 [spec]: http://webassembly.github.io/spec/js-api/index.html#webassembly-namespace
- Loading branch information