Skip to content

Object [[Get]] does not inherit user-assigned Object.prototype properties through the prototype chain #4656

Description

@proggeramlug

Surfaced while landing #4595 (JSON.parse reviver). General object-model gap, not reviver-specific.

A plain object's [[Get]] does not walk to Object.prototype for properties assigned there at runtime. Minimal repro:

(Object.prototype as any).foo = 99;
const o: any = { foo: 1 };
delete o.foo;
console.log(o.foo); // Node: 99 (inherited)   Perry: 1 / undefined

Node prints 99; Perry returns the stale own value (or undefined after delete) — the inherited Object.prototype.foo is never consulted.

Failing test262 (built-ins/JSON/parse/), which rely on re-reading an inherited value after the reviver deletes the own property:

  • reviver-object-get-prop-from-prototype
  • reviver-array-get-prop-from-prototype

The reviver walk now correctly does a real [[Get]] re-read per #4595; it's [[Get]]'s prototype-chain traversal for assigned Object.prototype members that's missing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed defect or regression

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions