Closed
Bug 1175173
Opened 10 years ago
Closed 10 years ago
Don't box primitives in {Object, Array}.prototype.toLocaleString
Categories
(Core :: JavaScript: Standard Library, defect)
Core
JavaScript: Standard Library
Tracking
()
RESOLVED
FIXED
mozilla43
People
(Reporter: anba, Assigned: evilpies)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
3.90 KB,
patch
|
till
:
review+
|
Details | Diff | Splinter Review |
js> String.prototype.toString = function(){"use strict"; return typeof this;}
(function (){"use strict"; return typeof this;})
js> Object.prototype.toLocaleString.call("")
"object"
js> [""].toLocaleString()
"object"
Expected: Both toLocaleString() calls return "string"
Actual: "object" is returned
Also see: https://bugs.ecmascript.org/show_bug.cgi?id=3237
Attachment #8646277 -
Flags: review?(till)
Comment 2•10 years ago
|
||
Comment on attachment 8646277 [details] [diff] [review]
fix
Review of attachment 8646277 [details] [diff] [review]:
-----------------------------------------------------------------
Nice. r=me with nits addressed.
::: js/src/builtin/Object.js
@@ +50,5 @@
> function ObjectIsExtensible(obj) {
> return IsObject(obj) && std_Reflect_isExtensible(obj);
> }
>
> +function Object_toLocaleString() {
Nit: add comment along the lines of "// ES2015 19.1.3.5 Object.prototype.toLocaleString."
@@ +56,5 @@
> + var O = this;
> +
> + // Step 2.
> + var func = O.toString;
> + return callFunction(func, O);
Hmm, does it make any difference to split this into two steps? Doesn't `O.toString()` behave exactly the same?
Attachment #8646277 -
Flags: review?(till) → review+
Comment 4•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
status-firefox43:
--- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in
before you can comment on or make changes to this bug.
Description
•