Skip to content

Commit

Permalink
fix(ses): removeUnpermittedIntrinsics on Hermes
Browse files Browse the repository at this point in the history
  • Loading branch information
leotm committed Dec 5, 2024
1 parent 882e912 commit d400b04
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/ses/src/cauterize-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ import { objectHasOwnProperty } from './commons.js';
* an undeletable `.prototype` property. In these cases, if we can
* set the value of that bogus `.prototype` property to `undefined`,
* we do so, issuing a warning, rather than failing to initialize ses.
* Finally we also tolerate functions with undeletable `.caller` and
* `.arguments` properties to conclude removing unpermitted intrinsics
* on Hermes.
*
* @param {object} obj
* @param {PropertyKey} prop
Expand Down Expand Up @@ -60,6 +63,13 @@ export const cauterizeProperty = (
return;
}
}
if (
typeof obj === 'function' &&
(prop === 'caller' || prop === 'arguments')
) {
warn(`Tolerating undeletable ${subPath}`);
return;
}
error(`failed to delete ${subPath}`, err);
} else {
error(`deleting ${subPath} threw`, err);
Expand Down

0 comments on commit d400b04

Please sign in to comment.