This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
Branding guarantees do not match web platform classes, due to return override #179
Closed
Description
opened on Dec 10, 2018
Consider the following:
class Base {}
class Ex extends Base {
#foo = 1;
isExample() {
return this.#foo === 1;
}
}
const o = {};
Ex.__proto__ = function() { return o; };
new Ex;
Ex.prototype.isExample.call(o); // => true
Now consider the analogous setup with the Node
and Text
classes:
const o = {};
Text.__proto__ = function () { return o; };
new Text();
Text.prototype.splitText.call(o); // throws!!
or, using ES262 classes:
const o = {};
Uint8Array.__proto__ = function () { return o; };
new Uint8Array();
ArrayBuffer.isView(o); // false
This mismatch is worrying. It means that we cannot use private fields for self-hosting any classes involved in inheritance hierarchies.
I'm not sure what a good fix would be, but it seems like we should investigate what can be done here.
Metadata
Assignees
Labels
No labels
Activity