From b575e052c63af525c24eaa3a58cd4df802529328 Mon Sep 17 00:00:00 2001 From: Manuel Jasso Date: Fri, 9 Aug 2024 16:16:36 -0700 Subject: [PATCH 1/2] @W-16440795: Never remap Set and Map regardless of MaxPerfMode or MaxCompatMode --- .../src/__tests__/intrinsics.spec.ts | 14 +++++++------- packages/near-membrane-base/src/intrinsics.ts | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/near-membrane-base/src/__tests__/intrinsics.spec.ts b/packages/near-membrane-base/src/__tests__/intrinsics.spec.ts index dd1ee020..f768198c 100644 --- a/packages/near-membrane-base/src/__tests__/intrinsics.spec.ts +++ b/packages/near-membrane-base/src/__tests__/intrinsics.spec.ts @@ -90,14 +90,14 @@ const ReflectiveIntrinsicObjectNames = [ const RemappedIntrinsicObjectNames = [ 'Date', 'Intl', - 'Map', + // 'Map', 'Promise', - 'Set', - 'WeakMap', - 'WeakSet', + // 'Set', + // 'WeakMap', + // 'WeakSet', ]; -const TypedAraysInstrinsics = [ +const TypedArraysInstrinsics = [ 'ArrayBuffer', 'Atomics', 'BigInt64Array', @@ -147,7 +147,7 @@ describe('assignFilteredGlobalDescriptorsFromPropertyDescriptorMap', () => { } }); it('includes Remapped ES intrinsics', () => { - const remappedObjectNames = [...RemappedIntrinsicObjectNames, ...TypedAraysInstrinsics]; + const remappedObjectNames = [...RemappedIntrinsicObjectNames, ...TypedArraysInstrinsics]; expect.assertions(remappedObjectNames.length); const shape = remappedObjectNames.reduce((accum, key) => { @@ -220,7 +220,7 @@ describe('getFilteredGlobalOwnKeys', () => { } }); it('includes Remapped ES intrinsics', () => { - const remappedObjectNames = [...RemappedIntrinsicObjectNames, ...TypedAraysInstrinsics]; + const remappedObjectNames = [...RemappedIntrinsicObjectNames, ...TypedArraysInstrinsics]; const shape = remappedObjectNames.reduce((accum, key) => { (accum as any)[key] = (globalThis as any)[key]; return accum; diff --git a/packages/near-membrane-base/src/intrinsics.ts b/packages/near-membrane-base/src/intrinsics.ts index afca40ea..2b408a06 100644 --- a/packages/near-membrane-base/src/intrinsics.ts +++ b/packages/near-membrane-base/src/intrinsics.ts @@ -56,7 +56,7 @@ function getESGlobalKeys(maxPerfMode: boolean) { // 'EvalError', // Reflective 'FinalizationRegistry', // 'Function', // dangerous & Reflective - // 'Map', // Remapped + 'Map', // Remapped 'Number', // 'Object', // Reflective // Allow blue `Promise` constructor to overwrite the Red one so that promises @@ -66,15 +66,15 @@ function getESGlobalKeys(maxPerfMode: boolean) { // 'RangeError', // Reflective // 'ReferenceError', // Reflective 'RegExp', - // 'Set', // Remapped + 'Set', // Remapped 'String', 'Symbol', // 'SyntaxError', // Reflective // 'TypeError', // Reflective // 'URIError', // Reflective - // 'WeakMap', // Remapped - // 'WeakSet', // Remapped + 'WeakMap', // Remapped + 'WeakSet', // Remapped 'WeakRef', // *** 18.4 Other Properties of the Global Object From 1ff1121c9655fdf3bac5e81bfde7bc79d49b4acc Mon Sep 17 00:00:00 2001 From: Manuel Jasso Date: Mon, 12 Aug 2024 10:23:48 -0700 Subject: [PATCH 2/2] Removed incorrect comments --- packages/near-membrane-base/src/intrinsics.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/near-membrane-base/src/intrinsics.ts b/packages/near-membrane-base/src/intrinsics.ts index 2b408a06..b40c6f3d 100644 --- a/packages/near-membrane-base/src/intrinsics.ts +++ b/packages/near-membrane-base/src/intrinsics.ts @@ -56,7 +56,7 @@ function getESGlobalKeys(maxPerfMode: boolean) { // 'EvalError', // Reflective 'FinalizationRegistry', // 'Function', // dangerous & Reflective - 'Map', // Remapped + 'Map', 'Number', // 'Object', // Reflective // Allow blue `Promise` constructor to overwrite the Red one so that promises @@ -66,15 +66,15 @@ function getESGlobalKeys(maxPerfMode: boolean) { // 'RangeError', // Reflective // 'ReferenceError', // Reflective 'RegExp', - 'Set', // Remapped + 'Set', 'String', 'Symbol', // 'SyntaxError', // Reflective // 'TypeError', // Reflective // 'URIError', // Reflective - 'WeakMap', // Remapped - 'WeakSet', // Remapped + 'WeakMap', + 'WeakSet', 'WeakRef', // *** 18.4 Other Properties of the Global Object