From e552e64f2c3b799f7cf2aa95d94d1f369fd999dd Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sat, 29 Jan 2022 23:25:05 +0100 Subject: [PATCH 1/3] crypto: fix `webcrpto.subtle` signature --- lib/internal/crypto/webcrypto.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/internal/crypto/webcrypto.js b/lib/internal/crypto/webcrypto.js index 501ea38fd35104..d5ab4e05fa9d1a 100644 --- a/lib/internal/crypto/webcrypto.js +++ b/lib/internal/crypto/webcrypto.js @@ -687,7 +687,11 @@ async function decrypt(algorithm, key, data) { class SubtleCrypto {} const subtle = new SubtleCrypto(); -class Crypto {} +class Crypto { + get subtle() { + return subtle; + } +} const crypto = new Crypto(); ObjectDefineProperties( @@ -698,11 +702,6 @@ ObjectDefineProperties( writable: false, value: 'Crypto', }, - subtle: { - enumerable: true, - configurable: false, - value: subtle, - }, getRandomValues: { enumerable: true, configurable: true, From 9487683ebcbe75b83d5c10e648174dc0241f67c6 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sat, 29 Jan 2022 23:32:19 +0100 Subject: [PATCH 2/3] fixup! crypto: fix `webcrpto.subtle` signature --- lib/internal/crypto/webcrypto.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/internal/crypto/webcrypto.js b/lib/internal/crypto/webcrypto.js index d5ab4e05fa9d1a..f556d00c39ff0d 100644 --- a/lib/internal/crypto/webcrypto.js +++ b/lib/internal/crypto/webcrypto.js @@ -5,6 +5,7 @@ const { JSONParse, JSONStringify, ObjectDefineProperties, + ObjectGetOwnPropertyDescriptor, SafeSet, SymbolToStringTag, StringPrototypeRepeat, @@ -702,6 +703,10 @@ ObjectDefineProperties( writable: false, value: 'Crypto', }, + subtle: { + ...ObjectGetOwnPropertyDescriptor(Crypto.prototype, "subtle"), + enumerable: true, + }, getRandomValues: { enumerable: true, configurable: true, From eed2ae8a2af067a105d98c3c1a3d6979d8e84e2d Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Sat, 29 Jan 2022 23:44:10 +0100 Subject: [PATCH 3/3] fixup! fixup! crypto: fix `webcrpto.subtle` signature --- lib/internal/crypto/webcrypto.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/internal/crypto/webcrypto.js b/lib/internal/crypto/webcrypto.js index f556d00c39ff0d..72499d27ab854a 100644 --- a/lib/internal/crypto/webcrypto.js +++ b/lib/internal/crypto/webcrypto.js @@ -704,7 +704,7 @@ ObjectDefineProperties( value: 'Crypto', }, subtle: { - ...ObjectGetOwnPropertyDescriptor(Crypto.prototype, "subtle"), + ...ObjectGetOwnPropertyDescriptor(Crypto.prototype, 'subtle'), enumerable: true, }, getRandomValues: {