From 136a96722a151bf40c0d8d7cafdd2ab0ef2bcbd1 Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Fri, 6 Oct 2023 11:17:04 +0200 Subject: [PATCH] crypto: account for disabled SharedArrayBuffer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/50034 Reviewed-By: Filip Skokan Reviewed-By: Matthew Aitken Reviewed-By: Tobias Nießen Reviewed-By: Richard Lau Reviewed-By: Yagiz Nizipli Reviewed-By: Luigi Pinca --- lib/internal/crypto/webidl.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/internal/crypto/webidl.js b/lib/internal/crypto/webidl.js index 9f5340c223902c..61a4cfe4330703 100644 --- a/lib/internal/crypto/webidl.js +++ b/lib/internal/crypto/webidl.js @@ -184,7 +184,10 @@ function isNonSharedArrayBuffer(V) { } function isSharedArrayBuffer(V) { - return ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V); + // SharedArrayBuffers can be disabled with --no-harmony-sharedarraybuffer. + if (SharedArrayBuffer !== undefined) + return ObjectPrototypeIsPrototypeOf(SharedArrayBuffer.prototype, V); + return false; } converters.Uint8Array = (V, opts = kEmptyObject) => {