Legacy Intl object detection should use OrdinaryHasInstance semantics, not instanceof semantics
Categories
(Core :: JavaScript: Internationalization API, defect, P2)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox87 | --- | fixed |
People
(Reporter: Waldo, Assigned: anba)
References
()
Details
Attachments
(3 files)
Detection of Intl objects whose "subclassing" approach was finalized before ES6 classes were finalized includes an instance-of check. Presently that's phrased as an instanceof check -- but upstream is changing it to use OrdinaryHasInstance (which will ignore Symbol.hasInstance property info). We should make this change too, once it's finalized (possibly today).
anba was doing some work on op support for this, but I don't have the number offhand for it.
| Assignee | ||
Comment 1•5 years ago
|
||
(In reply to Jeff Walden [:Waldo] from comment #0)
anba was doing some work on op support for this, but I don't have the number offhand for it.
The proposed semantics are equivalent to calling Object.prototype.isPrototypeOf. In preparation for that change, I've added inlining support to Object.prototype.isPrototypeOf in bug 1664195, so we don't regress performance when compared to using instanceof.
| Assignee | ||
Comment 2•5 years ago
|
||
Updated•5 years ago
|
| Assignee | ||
Comment 3•5 years ago
|
||
Enable three now passing tests which were fixed upstream.
Disable two tests which require the changes from part 3.
Depends on D105458
| Assignee | ||
Comment 4•5 years ago
|
||
Implement the changes from https://github.com/tc39/ecma402/pull/500.
Object.prototype.isPrototypeOf can be used the implement the OrdinaryHasInstance semantics.
Test262 tests: https://github.com/tc39/test262/pull/2949.
Depends on D105459
Comment 6•5 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/d20e0f3f3fa7
https://hg.mozilla.org/mozilla-central/rev/cbd47917a7a2
https://hg.mozilla.org/mozilla-central/rev/07891e27aedc
Comment 7•5 years ago
|
||
Is this safe enough to ride to beta after just a couple of days in nightly?
| Assignee | ||
Comment 8•5 years ago
|
||
The change basically is only noticeable when Intl.DateTimeFormat[Symbol.hasInstance] has been redefined by a website, which should never happen anywhere. The corresponding V8 bug landed about three weeks ago and no web-compat issues have been reported. And JSC already implements these semantics at least since last year September.
Description
•