-
-
Notifications
You must be signed in to change notification settings - Fork 35.3k
Extending non-writeable by writing prototype properties fails #62604
Copy link
Copy link
Closed
Labels
questionIssues that look for answers.Issues that look for answers.
Description
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
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
questionIssues that look for answers.Issues that look for answers.