diff --git a/lib/internal/bootstrap/web/exposed-window-or-worker.js b/lib/internal/bootstrap/web/exposed-window-or-worker.js index 1d07b3eda07ad9..fa560fe8ab01a5 100644 --- a/lib/internal/bootstrap/web/exposed-window-or-worker.js +++ b/lib/internal/bootstrap/web/exposed-window-or-worker.js @@ -10,7 +10,6 @@ const { ObjectDefineProperty, - ObjectGetOwnPropertyDescriptor, globalThis, } = primordials; @@ -115,10 +114,13 @@ if (internalBinding('config').hasOpenSSL) { ['Crypto', 'CryptoKey', 'SubtleCrypto'], ); } else { - ObjectDefineProperty(globalThis, 'crypto', - { __proto__: null, ...ObjectGetOwnPropertyDescriptor({ - get crypto() { - throw new ERR_NO_CRYPTO(); - }, - }, 'crypto') }); + ObjectDefineProperty(globalThis, 'crypto', { + __proto__: null, + configurable: true, + enumerable: true, + writable: true, + value: function crypto() { // eslint-disable-line func-name-matching + throw new ERR_NO_CRYPTO(); + }, + }); }