Closed Bug 1079120 Opened 10 years ago Closed 10 years ago

Make ToNumber(string) support binary and octal literals

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla36

People

(Reporter: 446240525, Assigned: 446240525)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, Whiteboard: [DocArea=JS])

Attachments

(1 file)

Assignee: nobody → 446240525
Attachment #8500921 - Flags: review?(till)
Comment on attachment 8500921 [details] [diff] [review]
bug-1079120.patch

Review of attachment 8500921 [details] [diff] [review]:
-----------------------------------------------------------------

This looks great, thanks!

I'm not sufficiently convinced it is web compatible to just land it, though. Asking jorendorff for a decision on that. Please hold off on landing until then.

::: js/src/tests/ecma_6/Number/ToNumber.js
@@ +18,5 @@
> +assertEq(+"0o66", 54);
> +
> +if(typeof getSelfHostedValue === "function"){
> +    assertEq(getSelfHostedValue("ToNumber")("0b11"), 3);
> +    assertEq(getSelfHostedValue("ToNumber")("0o66"), 54);

Nice!
Attachment #8500921 - Flags: review?(till)
Attachment #8500921 - Flags: review+
Attachment #8500921 - Flags: feedback?(jorendorff)
I am pretty sure this is web compatible, Chrome seems to have this already.
(In reply to Tom Schuster [:evilpie] from comment #3)
> I am pretty sure this is web compatible, Chrome seems to have this already.

Chrome has experimented this for one year, and seems no breakage reported so far.

https://codereview.chromium.org/19300002
https://codereview.chromium.org/626153002
Comment on attachment 8500921 [details] [diff] [review]
bug-1079120.patch

Review of attachment 8500921 [details] [diff] [review]:
-----------------------------------------------------------------

> Chrome has experimented this for one year, and seems no breakage reported so far.

Ok, that does convince me; let's land this.

ziyunfei, can you make sure the patch still applies and passes tests and then set checkin-needed?

::: js/src/tests/ecma_6/Number/ToNumber.js
@@ +18,5 @@
> +assertEq(+"0o66", 54);
> +
> +if(typeof getSelfHostedValue === "function"){
> +    assertEq(getSelfHostedValue("ToNumber")("0b11"), 3);
> +    assertEq(getSelfHostedValue("ToNumber")("0o66"), 54);

Nice!
Attachment #8500921 - Flags: feedback?(jorendorff)
https://hg.mozilla.org/mozilla-central/rev/9e3582d234c1
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: