diff --git a/packages/ses/src/intrinsics.js b/packages/ses/src/intrinsics.js index 6f44637b7a..aaf4c7d58d 100644 --- a/packages/ses/src/intrinsics.js +++ b/packages/ses/src/intrinsics.js @@ -100,12 +100,14 @@ export const makeIntrinsicsCollector = () => { } const permitPrototype = permit.prototype; - // Bypass Hermes bug, fixed in: https://github.com/facebook/hermes/commit/00f18c89c720e1c34592bb85a1a8d311e6e99599 if ( typeof intrinsic === 'function' && intrinsic.prototype !== undefined && permitPrototype === 'undefined' // permits.js ) { + // Set intrinsics that are additional function properties of the global Object proposed by SES to have non-standard prototype properties set to undefined. + // Set Hermes additional function intrinsics proposed by SES containing non-standard prototypes to undefined. + // This includes arrow functions (lockdown and harden) and object literal methods (%InitialGetStackString%). intrinsic.prototype = undefined; } diff --git a/packages/ses/src/permits.js b/packages/ses/src/permits.js index d25c737236..7c3e952848 100644 --- a/packages/ses/src/permits.js +++ b/packages/ses/src/permits.js @@ -282,7 +282,12 @@ export const AsyncFunctionInstance = { // Aliases const fn = FunctionInstance; -const hermesFn = { ...FunctionInstance, prototype: 'undefined' }; // Bypass Hermes bug, fixed in: https://github.com/facebook/hermes/commit/00f18c89c720e1c34592bb85a1a8d311e6e99599 +// Bypass Hermes bugs, fixed in: +// - https://github.com/facebook/hermes/commit/c42491de94aff479e5e83c073eff96a6261da080 +// - https://github.com/facebook/hermes/commit/00f18c89c720e1c34592bb85a1a8d311e6e99599 +// Expect additional Function Properties of the Global Object proposed by SES to have non-standard prototype properties set to undefined. +// This includes arrow functions (lockdown and harden) and object literal methods (%InitialGetStackString%). +const hermesFn = { ...FunctionInstance, prototype: 'undefined' }; const asyncFn = AsyncFunctionInstance; const getter = {