Skip to content

Error: retain realm intrinsic prototypes independently of public bindings #823

Description

@chrisbbreuer

Parent #465; related #821 and #822.

Reproduced on pushed 4f7718d before the current candidates: a class call can create its TypeError using a shadowing lexical TypeError binding or a replaced global TypeError constructor. Checking Object.getPrototypeOf(error) against the original realm TypeError.prototype fails in both witnesses. The older instanceof error-name fallback concealed this defect; the prototype-identity check does not.

makeErrorWithProto currently resolves named constructors through self.env.get(name), which is an ordinary mutable binding lookup rather than the realm intrinsic. Other intrinsic prototype helpers also require an audit for the same distinction. Engine-generated errors must use the current or explicitly selected callee realm intrinsic, without invoking user getters or depending on public global replacement.

Acceptance: retain and trace realm-owned intrinsic identities using the existing environment/GC ownership facilities; handle lexical shadowing, replacement/deletion, cross-realm errors and moving GC. Preserve explicit prototype overrides and normal user construction/Reflect.construct semantics. New shared state must follow existing initialization/publication and no-GIL synchronization rules. Do not restore a name-based instanceof heuristic or use mutable public bindings as an intrinsic cache. Unknown engine error names need an explicit Error prototype/name policy, not unprototyped objects silently recognized by tags.

This is a separately reproduced existing error-construction defect, not a passing result or completed implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions