Closed Bug 1670055 Opened 4 years ago Closed 3 years ago

Legacy Intl object detection should use OrdinaryHasInstance semantics, not instanceof semantics

Categories

(Core :: JavaScript: Internationalization API, defect, P2)

defect

Tracking

()

RESOLVED FIXED
87 Branch
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.

(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: nobody → andrebargull
Status: NEW → ASSIGNED

Enable three now passing tests which were fixed upstream.

Disable two tests which require the changes from part 3.

Depends on D105458

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

Pushed by archaeopteryx@coole-files.de:
https://hg.mozilla.org/integration/autoland/rev/d20e0f3f3fa7
Part 1: Update test262. r=yulia
https://hg.mozilla.org/integration/autoland/rev/cbd47917a7a2
Part 2: Update test262 exclusions. r=yulia
https://hg.mozilla.org/integration/autoland/rev/07891e27aedc
Part 3: Use OrdinaryHasInstance semantics for legacy Intl object detection. r=yulia
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch

Is this safe enough to ride to beta after just a couple of days in nightly?

Flags: needinfo?(andrebargull)

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.

Flags: needinfo?(andrebargull)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: