Expose Intl.DateTimeFormat.prototype.formatToParts

VERIFIED FIXED in Firefox 51

Status

()

enhancement
VERIFIED FIXED
3 years ago
3 years ago

People

(Reporter: sebo, Assigned: gandalf)

Tracking

({dev-doc-complete})

unspecified
mozilla51
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox51 verified)

Details

Attachments

(1 attachment)

Reporter

Description

3 years ago
No description provided.
Reporter

Updated

3 years ago
Depends on: 1260858
No longer depends on: 1216150
Assignee

Updated

3 years ago
Blocks: 1288653
Assignee

Updated

3 years ago
Assignee: nobody → gandalf
Comment hidden (mozreview-request)
V8 added DateTimeFormat.prototype.formatToParts - https://bugs.chromium.org/p/v8/issues/detail?id=5244 and seems like the API is pretty much verified and frozen, with three implementations (Intl.js, Gecko and Chrome) passing test262 tests suite for it.

We should be ready to expose it to content.
Comment hidden (mozreview-request)

Comment 4

3 years ago
mozreview-review
Comment on attachment 8790744 [details]
Bug 1289340 - Expose Intl.DateTimeFormat.prototype.formatToParts.

https://reviewboard.mozilla.org/r/78426/#review77040

The XXX bug you mention claims I'm module owner (which I am not), but IRC word is the staging for this is right, so I think we're good.

::: js/src/builtin/Intl.cpp:1819
(Diff revision 2)
> -        RootedValue ftp(cx);
> +    RootedValue ftp(cx);
> -        HandlePropertyName name = cx->names().formatToParts;
> +    HandlePropertyName name = cx->names().formatToParts;
> -        if (!GlobalObject::getSelfHostedFunction(cx, cx->global(),
> +    if (!GlobalObject::getSelfHostedFunction(cx, cx->global(),
> -                    cx->names().DateTimeFormatFormatToParts,
> +                cx->names().DateTimeFormatFormatToParts,
> -                    name,
> +                name,
> -                    0, &ftp))
> +                0, &ftp))

It'd be better adding this to the JSFunctionSpec for DateTimeFormat instead of preserving this needed-for-conditionality code.  But this gets the job done for now, and I can go back and fix it to be the idiomatic way at some later time.
Attachment #8790744 - Flags: review?(jwalden+bmo) → review+
Comment hidden (mozreview-request)

Comment 7

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/3f47a92541c8
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Reporter

Comment 8

3 years ago
Works for me as expected.

Updated the compatibility info:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts#Browser_compatibility

And the release notes:
https://developer.mozilla.org/en-US/Firefox/Releases/51?document_saved=true#JavaScript

Zibi, can you please verify that the docs are correct?

Sebastian
Status: RESOLVED → VERIFIED
Flags: needinfo?(gandalf)
:sebo - sorry for late response. In the Specifications box the comments indicate that it's "Not yet part of the draft specification. ".

At this point it is merged into the ECMA 402 spec.

Also, V8/Chrome has it exposed behind --harmony flag - https://bugs.chromium.org/p/v8/issues/detail?id=5244

And since we're at it - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/getCanonicalLocales is already exposed in Chrome as well :)
Flags: needinfo?(gandalf)
Assignee

Updated

3 years ago
Flags: needinfo?(sebastianzartner)
Reporter

Comment 10

3 years ago
Added the compatibility information and removed the outdated spec. comment. Zibi, can you please verify them again?

Sebastian
Flags: needinfo?(sebastianzartner) → needinfo?(gandalf)
LGTM!
Flags: needinfo?(gandalf)
Reporter

Comment 12

3 years ago
Perfect! Thanks for the prompt feedback!

Sebastian
You need to log in before you can comment on or make changes to this bug.