Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
DonIsaac committed Jan 8, 2025
1 parent 46dbc9a commit 9974369
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/js/internal/primordials.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,16 @@ const makeSafe = (unsafe, safe) => {
let next; // We can reuse the same `next` method.

ArrayPrototypeForEach(Reflect.ownKeys(unsafe.prototype), function makeIterableMethodsSafe(key) {
// if (Reflect.hasOwnProperty(safe.prototype, key)) return;
if (Reflect.getOwnPropertyDescriptor(safe.prototype, key)) return;

const desc = Reflect.getOwnPropertyDescriptor(unsafe.prototype, key);
if (typeof desc.value === "function" && desc.value.length === 0) {
try {
var called = desc.value.$call(dummy) || {};
} catch (e) {
const err = new Error(`${unsafe.name}.prototype.${key} thew an error while creating a safe version. This is likely due to prototype pollution.`);
const err = new Error(
`${unsafe.name}.prototype.${key} thew an error while creating a safe version. This is likely due to prototype pollution.`,
);
Object.assign(err, { unsafe: unsafe.name, safe: safe.name, key, cause: e });
throw err;
}
Expand Down

0 comments on commit 9974369

Please sign in to comment.