Skip to content

Object.setPrototypeOf should handle Map/Set/Promise objects and object-valued prototypes #452

Description

@dowdiness

Follow-up from PR #449.

Problem

Object.prototype.__proto__ now updates Map and Set receiver prototype slots when reached through inherited setter assignment. Object.setPrototypeOf appears to have the same class of gap: it handles Object, Array, and Proxy receivers, while Map/Set receivers fall through without updating their internal prototype slots. Promise receivers should be checked for the same behavior as well.

Its prototype argument validation also looks narrower than the broader object-valued prototype support already used by nearby object/prototype paths.

Suggested work

  • Audit Object.setPrototypeOf against the project’s supported object/exotic value model.
  • Update Map and Set receivers to mutate their internal prototype slots.
  • Check whether Promise receivers should use the same internal prototype handling.
  • Align valid prototype argument handling with existing object-valued prototype paths where appropriate.

Acceptance criteria

  • Object.setPrototypeOf(new Map(), proto) updates the Map prototype slot.
  • Object.setPrototypeOf(new Set(), proto) updates the Set prototype slot.
  • Promise behavior is either fixed or explicitly covered by a test documenting the intended supported behavior.
  • Invalid primitive prototype values still throw.
  • Regression tests cover Map, Set, and Promise/decision cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions