diff --git a/pyscript.core/esm/worker/_template.js b/pyscript.core/esm/worker/_template.js index 1f55c412..990f3d6c 100644 --- a/pyscript.core/esm/worker/_template.js +++ b/pyscript.core/esm/worker/_template.js @@ -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( diff --git a/pyscript.core/package.json b/pyscript.core/package.json index 5666aa7a..9d197a27 100644 --- a/pyscript.core/package.json +++ b/pyscript.core/package.json @@ -50,6 +50,6 @@ "coincident": "^0.2.3" }, "worker": { - "blob": "sha256-m8uF2bNB691FtVIpuDfAT/avUolqZRQwO9tD3r88+6A=" + "blob": "sha256-LhH/RqqHJJNjYkIoMjALOt1xdneBHAyy+jgMKO07Mx0=" } }