|
@@ -0,0 +1,37 @@
|
|
|
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
+From: Shelley Vohr <[email protected]>
|
|
|
+Date: Mon, 2 Oct 2023 16:03:43 +0200
|
|
|
+Subject: fix: handle possible disabled SharedArrayBuffer
|
|
|
+
|
|
|
+It's possible for SharedArrayBuffer to be disabled with the -no-harmony-sharedarraybuffer
|
|
|
+flag, and so we should guard uses with a check for potential undefined-ness.
|
|
|
+
|
|
|
+This should be upstreamed to Node.js.
|
|
|
+
|
|
|
+diff --git a/lib/internal/crypto/webidl.js b/lib/internal/crypto/webidl.js
|
|
|
+index 9f5340c223902c5ff61def05e8a4f470b4f328e8..d6dbfa482f9ebff3f99fb810e072cf9a03d1cd4d 100644
|
|
|
+--- a/lib/internal/crypto/webidl.js
|
|
|
++++ b/lib/internal/crypto/webidl.js
|
|
|
+@@ -183,7 +183,10 @@ function isNonSharedArrayBuffer(V) {
|
|
|
+ return ObjectPrototypeIsPrototypeOf(ArrayBufferPrototype, V);
|
|
|
+ }
|
|
|
+
|
|
|
++// SharedArrayBuffers can be disabled with --no-harmony-sharedarraybuffer.
|
|
|
+ function isSharedArrayBuffer(V) {
|
|
|
++ if (SharedArrayBuffer === undefined)
|
|
|
++ return false;
|
|
|
+ return ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V);
|
|
|
+ }
|
|
|
+
|
|
|
+diff --git a/lib/internal/main/worker_thread.js b/lib/internal/main/worker_thread.js
|
|
|
+index be4d82086199855a10108528b3dacc663b839454..10c33bacc0529e12f52aaf1baf6d42489b2a75a7 100644
|
|
|
+--- a/lib/internal/main/worker_thread.js
|
|
|
++++ b/lib/internal/main/worker_thread.js
|
|
|
+@@ -108,6 +108,7 @@ port.on('message', (message) => {
|
|
|
+
|
|
|
+ require('internal/worker').assignEnvironmentData(environmentData);
|
|
|
+
|
|
|
++ // SharedArrayBuffers can be disabled with --no-harmony-sharedarraybuffer.
|
|
|
+ if (SharedArrayBuffer !== undefined) {
|
|
|
+ // The counter is only passed to the workers created by the main thread,
|
|
|
+ // not to workers created by other workers.
|