From 2b0b560455be28265201aef059d1b39b1e53c328 Mon Sep 17 00:00:00 2001 From: LeoTM <1881059+leotm@users.noreply.github.com> Date: Wed, 16 Oct 2024 14:06:18 +0100 Subject: [PATCH] refactor(ses): update namePrototype prefix to permit --- packages/ses/src/intrinsics.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/ses/src/intrinsics.js b/packages/ses/src/intrinsics.js index 1cd047262f..6f44637b7a 100644 --- a/packages/ses/src/intrinsics.js +++ b/packages/ses/src/intrinsics.js @@ -98,36 +98,36 @@ export const makeIntrinsicsCollector = () => { if (typeof permit !== 'object') { throw TypeError(`Expected permit object at whitelist.${name}`); } - const namePrototype = permit.prototype; + const permitPrototype = permit.prototype; // Bypass Hermes bug, fixed in: https://github.com/facebook/hermes/commit/00f18c89c720e1c34592bb85a1a8d311e6e99599 if ( typeof intrinsic === 'function' && intrinsic.prototype !== undefined && - namePrototype === 'undefined' // permits.js + permitPrototype === 'undefined' // permits.js ) { intrinsic.prototype = undefined; } const intrinsicPrototype = intrinsic.prototype; - if (!namePrototype) { + if (!permitPrototype) { throw TypeError(`${name}.prototype property not whitelisted`); } if ( - typeof namePrototype !== 'string' || - !objectHasOwnProperty(permitted, namePrototype) + typeof permitPrototype !== 'string' || + !objectHasOwnProperty(permitted, permitPrototype) ) { throw TypeError(`Unrecognized ${name}.prototype whitelist entry`); } - if (objectHasOwnProperty(intrinsics, namePrototype)) { - if (intrinsics[namePrototype] !== intrinsicPrototype) { - throw TypeError(`Conflicting bindings of ${namePrototype}`); + if (objectHasOwnProperty(intrinsics, permitPrototype)) { + if (intrinsics[permitPrototype] !== intrinsicPrototype) { + throw TypeError(`Conflicting bindings of ${permitPrototype}`); } // eslint-disable-next-line no-continue continue; } - intrinsics[namePrototype] = intrinsicPrototype; + intrinsics[permitPrototype] = intrinsicPrototype; } }; freeze(completePrototypes);