From dc2085608524a44cb6d6d826ab8ce552c24fc384 Mon Sep 17 00:00:00 2001 From: rwaldron Date: Mon, 12 Feb 2024 12:29:19 -0500 Subject: [PATCH] fix: do not remap crypto, Crypto and SubtleCrypto if remapTypedArrays is false --- packages/near-membrane-dom/src/window.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/near-membrane-dom/src/window.ts b/packages/near-membrane-dom/src/window.ts index bdbc220c..21c6202a 100644 --- a/packages/near-membrane-dom/src/window.ts +++ b/packages/near-membrane-dom/src/window.ts @@ -83,7 +83,9 @@ export function filterWindowKeys(keys: PropertyKey[], remapTypedArrays: boolean) // Crypto and typed arrays must be from the same global object if (remapTypedArrays === false) { + result.splice(result.indexOf('crypto'), 1); result.splice(result.indexOf('Crypto'), 1); + result.splice(result.indexOf('SubtleCrypto'), 1); } return result; @@ -129,7 +131,9 @@ export function removeWindowDescriptors( ReflectDeleteProperty(unsafeDescs, 'chrome'); // Crypto and typed arrays must be from the same global object if (remapTypedArrays === false) { + ReflectDeleteProperty(unsafeDescs, 'crypto'); ReflectDeleteProperty(unsafeDescs, 'Crypto'); + ReflectDeleteProperty(unsafeDescs, 'SubtleCrypto'); } return unsafeDescs; }