-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normative: Use OrdinaryHasInstance in normative optional steps #500
Conversation
FYI- v8 bug filed https://bugs.chromium.org/p/v8/issues/detail?id=10981 for tracking |
@shvaikalesh - could you update the jsc status on https://github.com/tc39/ecma402/wiki/Proposal-and-PR-Progress-Tracking about this? Thanks |
@FrankYFTang I would love to, but I don't have editing rights. JSC implements EDIT: Updated status in |
Your test case cover the changes to the constructor, but not UnwrapNumberFormat nor UnwrapDateTimeFormat. Do you mind to show the test code for verifying these four functions here too? |
@sffc "@FrankYFTang I would love to, but I don't have editing rights. " what is our current policy about wiki editing |
I just invited @shvaikalesh as an outside collaborator on this repo, which gives wiki edit rights. |
In theory, I support this PR, I think the risk this Normative change to break the web is very small. However, I would still want to see the test cases against the four functions I listed above first. Also, I think we need to understand better of what kind of code are depending on the current legacy way of handling this and see would this change break them. Could someone point out what kind of code would be break if we complete remove the legacy unwrap (I am not proposing to do that, I am just asking to see that kind of code and make sure this change won't break them) |
also, in your sample test code |
FYI - CL to implement this change in v8 - https://chromium-review.googlesource.com/c/v8/v8/+/2444092 |
I would like to learn more about the benefit of this PR. What is the key motivation for making the change now? How would this change benefit the current web developers or prevent problem for the future web developers? |
Updated the #500 (comment).
I will make sure to submit a test262 PR if this reaches consensus.
According to #57, legacy unwrap is necessary for FormatJS, which targets browsers that never had
🤔 Isn't
This incompatibility came to my attention during recent legacy
As a web dev, I expect that setting |
All your response sounds reasonable to me. |
2021-01-14: agreed to move forward with this PR, despite the risks to break ecosystem code. We feel that the simplicity, better hygiene, and performance improvement justify the risks. Tracking issue for MDN: tc39/ecma402-mdn#19 Tracking issue for Test262: tc39/test262#2933 |
This achieved TC39 consensus today. @codehag followed up offline. |
FYI- V8 changes landed in https://chromium-review.googlesource.com/c/v8/v8/+/2444092 and will be in chrome m90 |
Implement tc39/ecma402#500 For the legacy [optional] Unwrap*Format steps, use OrdinaryHasInstance instead of InstanceofOperator. ECMA402 agree w/ PR500 on 2021-1-14 Bug: v8:10981 Change-Id: Ic697aa245b11fecaf998127c009e59a821aaa01e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2444092 Reviewed-by: Jakob Kummerow <[email protected]> Reviewed-by: Shu-yu Guo <[email protected]> Commit-Queue: Frank Tang <[email protected]> Cr-Commit-Position: refs/heads/master@{#72303}
Add tests to make sure NumberFormat does not call the instanceof operator and calls OrdinaryHasInstance instead. Refs: tc39/ecma402#500
Add tests to make sure NumberFormat does not call the instanceof operator and calls OrdinaryHasInstance instead. Refs: tc39/ecma402#500
Add tests to make sure NumberFormat does not call the instanceof operator and calls OrdinaryHasInstance instead. Refs: tc39/ecma402#500
Add tests to make sure DateTimeFormat does not call the instanceof operator and calls OrdinaryHasInstance instead. Refs: tc39/ecma402#500
Add tests to make sure NumberFormat does not call the instanceof operator and calls OrdinaryHasInstance instead. Refs: tc39/ecma402#500
Add tests to make sure DateTimeFormat does not call the instanceof operator and calls OrdinaryHasInstance instead. Refs: tc39/ecma402#500
…tl object detection. r=yulia Implement the changes from <tc39/ecma402#500>. `Object.prototype.isPrototypeOf` can be used the implement the `OrdinaryHasInstance` semantics. Test262 tests: <tc39/test262#2949>. Differential Revision: https://phabricator.services.mozilla.com/D105460
…tl object detection. r=yulia Implement the changes from <tc39/ecma402#500>. `Object.prototype.isPrototypeOf` can be used the implement the `OrdinaryHasInstance` semantics. Test262 tests: <tc39/test262#2949>. Differential Revision: https://phabricator.services.mozilla.com/D105460 UltraBlame original commit: 07891e27aedcf5bfb40fcbd3408944b826b7b283
…tl object detection. r=yulia Implement the changes from <tc39/ecma402#500>. `Object.prototype.isPrototypeOf` can be used the implement the `OrdinaryHasInstance` semantics. Test262 tests: <tc39/test262#2949>. Differential Revision: https://phabricator.services.mozilla.com/D105460 UltraBlame original commit: 07891e27aedcf5bfb40fcbd3408944b826b7b283
…tl object detection. r=yulia Implement the changes from <tc39/ecma402#500>. `Object.prototype.isPrototypeOf` can be used the implement the `OrdinaryHasInstance` semantics. Test262 tests: <tc39/test262#2949>. Differential Revision: https://phabricator.services.mozilla.com/D105460 UltraBlame original commit: 07891e27aedcf5bfb40fcbd3408944b826b7b283
@sffc does this require any MDN documentation? The details that have been changed by this seem too internal to be reflected on MDN. |
I agree w/ @ryzokuken 's previous comment. I don't think we need MDN change for this. |
This PR reduces the surface area of legacy constructor semantics by using
OrdinaryHasInstance
instead ofinstanceof
operator, which skipsSymbol.hasInstance
lookup/call and a few checks we don't need or already implement.The change is safe because a)
Symbol.hasInstance
is rarely used and b) the code that depends on legacy constructor semantics precedes cross-browserSymbol.hasInstance
implementation.JSC already implements this change, while V8 and SpiderMonkey perform
InstanceofOperator
.Intl.NumberFormat
test caseIntl.DateTimeFormat
test casecc @littledan @anba @caridy
EDIT: Updated test cases with
resolvedOptions
andformat
.