Skip to content

Commit

Permalink
fixup! doccomment
Browse files Browse the repository at this point in the history
  • Loading branch information
erights committed Nov 4, 2024
1 parent fd0660f commit 82d3d8a
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions packages/ses/src/cauterize-property.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,30 @@ import { objectHasOwnProperty } from './commons.js';
*/

/**
* Delete `obj[prop]` or at least make it harmless.
*
* If the property was not expected, then emit a reporter-dependent warning
* to bring attention to this case, so someone can determine what to do with it.
*
* If the property to be deleted is a function's `.prototype` property, this
* will normally be because the function was supposed to be a
* - builtin method or non-constructor function
* = arrow function
* - concise method
*
* all of whom are not supposed to have a `.prototype` property. Nevertheless,
* on some platforms (like older versions of Hermes), or as a result of
* some shim-based mods to the primordials (like core-js?), some of these
* functions may accidentally be more like `function` functions with
* an undeletable `.prototype` property. In add these case, 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.
*
* @param {object} obj
* @param {PropertyKey} prop
* @param {boolean} known
* @param {string} subPath
* @param {Reporter} reporter
* @param {boolean} known If deletion is expected, don't warn
* @param {string} subPath Used for warning messages
* @param {Reporter} reporter Where to issue warning or error.
* @returns {void}
*/
export const cauterizeProperty = (
Expand Down

0 comments on commit 82d3d8a

Please sign in to comment.