Closed joseluis closed 3 years ago
Hmm. Reproduced on Firefox 85.0.2 on Windows.
SABs are supposedly supported in this version based on https://caniuse.com/?search=shared , but it looks like the entire type might be gated behind CORS headers even if you make no cross-origin requests per https://hacks.mozilla.org/2020/07/safely-reviving-shared-memory/ . How fustrating.
SharedArrayBuffer
s are currently used to:
postMessage
while it's busy looping (onmessage
won't be called?), there are probably other higher latency options that can be polled (localStorage
?)I have not yet published a new version to crates.io nor updated the prebuilt examples.
- Busy loop in the worker thread and use another I/O communication system. While I believe the DOM thread can't send data to the worker thread via
postMessage
while it's busy looping (onmessage
won't be called?), there are probably other higher latency options that can be polled (localStorage
?)
Exhausted this avenue - localStorage
isn't available, and my attempts to smuggle data syncronously through IndexedDB etc. have failed.
I've discovered a fourth option though: rewrite the WASM to be asyncronous. Some prior art:
FireFox 85+ should now work as of a61e95d91e430b5d861e010c076aa0ec91a1653d / 0.1.4 / published examples, although I've only tested the Windows version. SharedCircularBuffer is no longer required as cargo html
will use wasm-pack
as a crate to invoke asyncify via wasm-opt
.
It's all fairly kludged together and still in need of cleanup, but it should at least work now ;)
I've tried the examples, and they work fine in Chrome but not in Firefox 85 on Linux.
This is the error in the inspector console in Firefox.