[js/web] add SharedArrayBuffer check for wasm multi-thread (#8749)

This commit is contained in:
Yulong Wang 2021-08-16 23:17:54 -07:00 committed by GitHub
parent ae6fdd3333
commit 4ceedbe933
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -16,6 +16,11 @@ let aborted = false;
const isMultiThreadSupported = (): boolean => {
try {
// If 'SharedArrayBuffer' is not available, WebAssembly threads will not work.
if (typeof SharedArrayBuffer === 'undefined') {
return false;
}
// Test for transferability of SABs (for browsers. needed for Firefox)
// https://groups.google.com/forum/#!msg/mozilla.dev.platform/IHkBZlHETpA/dwsMNchWEQAJ
if (typeof MessageChannel !== 'undefined') {