]> Cypherpunks.ru repositories - gostls13.git/commit
misc/wasm: make wasm_exec more robust against uncommon environments
authorRichard Musiol <mail@richard-musiol.de>
Sat, 15 Aug 2020 19:15:35 +0000 (21:15 +0200)
committerRichard Musiol <neelance@gmail.com>
Tue, 25 Aug 2020 21:15:43 +0000 (21:15 +0000)
commit758ac371ab930734053ed226ac62681e62ab8eea
treedab99467fb308676867a7b095b6e6b43fca01acc
parent8381408048018aa2b6eec874f3161b4641191522
misc/wasm: make wasm_exec more robust against uncommon environments

JavaScript environments are quite unpredictable because bundlers add
mocks for compatibility and libraries can polute the global namespace.
Detect more of such situations:

- Add check that require("fs") returns an object.
- Fix check that require("fs") returns an non-empty object.
- Add check that "module" is defined.

Fixes #40730

Change-Id: I2ce65fc7db64bbbb0b60eec79a4cfe5c3fec99c0
Reviewed-on: https://go-review.googlesource.com/c/go/+/248758
Run-TryBot: Richard Musiol <neelance@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
misc/wasm/wasm_exec.js