mirror of
https://github.com/pyscript/pyscript.git
synced 2026-02-13 16:00:37 -05:00
Shared array buffer missing error (#1518)
Improve error reporting around SharedArrayBuffer
This commit is contained in:
committed by
GitHub
parent
818614b798
commit
bb364b0524
@@ -9,6 +9,19 @@ import coincident from "coincident/structured";
|
||||
import { registry } from "../runtimes.js";
|
||||
import { getRuntime, getRuntimeID } from "../loader.js";
|
||||
|
||||
// bails out out of the box with a native/meaningful error
|
||||
// in case the SharedArrayBuffer is not available
|
||||
try {
|
||||
new SharedArrayBuffer(4);
|
||||
} catch (_) {
|
||||
throw new Error(
|
||||
[
|
||||
"Unable to use SharedArrayBuffer due insecure environment.",
|
||||
"Please read requirements in MDN: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#security_requirements",
|
||||
].join("\n"),
|
||||
);
|
||||
}
|
||||
|
||||
let engine, run, runtimeEvent;
|
||||
const add = (type, fn) => {
|
||||
addEventListener(
|
||||
|
||||
@@ -50,6 +50,6 @@
|
||||
"coincident": "^0.2.3"
|
||||
},
|
||||
"worker": {
|
||||
"blob": "sha256-m8uF2bNB691FtVIpuDfAT/avUolqZRQwO9tD3r88+6A="
|
||||
"blob": "sha256-LhH/RqqHJJNjYkIoMjALOt1xdneBHAyy+jgMKO07Mx0="
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user