Skip to content

Extending non-writeable by writing prototype properties fails #62604

@conartist6

Description

@conartist6

Version

v25.9.0

Platform

Darwin EOL 25.2.0 Darwin Kernel Version 25.2.0: Tue Nov 18 21:09:40 PST 2025; root:xnu-12377.61.12~1/RELEASE_ARM64_T6000 arm64

Subsystem

No response

What steps will reproduce the bug?

class Base {
  method() {}
}

// this usually happens during Object.freeze(Base.prototype)
Object.defineProperty(Base.prototype, 'method', {
  value: Base.prototype.method,
  writable: false,
});

class SafeExtended extends Base {
  // this works fine
  method() {}
}

class Extended extends Base {}

// TypeError: Cannot assign to read only property 'method' of object '#<Extended>'
Extended.prototype.method = function method() {};

How often does it reproduce? Is there a required condition?

100% reproduction.

What is the expected behavior? Why is that the expected behavior?

No error. I can't be sure what the spec says, but there's no error on this snippet in either firefox or chrome.

What do you see instead?

TypeError: Cannot assign to read only property 'method' of object '#<Extended>'

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues that look for answers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions