Commit 80aa6a5f authored by littledan's avatar littledan Committed by Commit bot

Remove ToObject on elements from Array.prototype.toLocaleString()

In ES5, ToObject was called on elements before invoking the
.toLocaleString() method on them. ES2015 specifies that ToObject is
not called. A test262 test verifies this change. This patch
implements the new ES2015 behavior. It is verified by the test262 test
built-ins/Array/prototype/toLocaleString/primitive_this_value_getter

R=adamk

Review URL: https://codereview.chromium.org/1390893003

Cr-Commit-Position: refs/heads/master@{#31160}
parent eeaf80cd
...@@ -217,11 +217,7 @@ function ConvertToLocaleString(e) { ...@@ -217,11 +217,7 @@ function ConvertToLocaleString(e) {
if (IS_NULL_OR_UNDEFINED(e)) { if (IS_NULL_OR_UNDEFINED(e)) {
return ''; return '';
} else { } else {
// According to ES5, section 15.4.4.3, the toLocaleString conversion return TO_STRING(e.toLocaleString());
// must throw a TypeError if ToObject(e).toLocaleString isn't
// callable.
var e_obj = TO_OBJECT(e);
return TO_STRING(e_obj.toLocaleString());
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment