Title: [267559] trunk
Revision
267559
Author
[email protected]
Date
2020-09-24 22:40:25 -0700 (Thu, 24 Sep 2020)

Log Message

%TypedArray%.prototype.toLocaleString must make conscious use of @toString
https://bugs.webkit.org/show_bug.cgi?id=216956

Reviewed by Yusuke Suzuki.

JSTests:

* test262/expectations.yaml:
Mark four test cases as passing.

Source/_javascript_Core:

A fascinating bug: if we override Number.prototype.toLocaleString to return { valueOf() { ... } },
then we can observe our %TypedArray%.prototype.toLocaleString resolving its element values in the wrong order.

* builtins/TypedArrayPrototype.js:
(toLocaleString):
Wrap the toLocaleString call for each element in @toString(), as the spec indicates.

Modified Paths

Diff

Modified: trunk/JSTests/ChangeLog (267558 => 267559)


--- trunk/JSTests/ChangeLog	2020-09-25 05:02:09 UTC (rev 267558)
+++ trunk/JSTests/ChangeLog	2020-09-25 05:40:25 UTC (rev 267559)
@@ -1,5 +1,15 @@
 2020-09-24  Ross Kirsling  <[email protected]>
 
+        %TypedArray%.prototype.toLocaleString must make conscious use of @toString
+        https://bugs.webkit.org/show_bug.cgi?id=216956
+
+        Reviewed by Yusuke Suzuki.
+
+        * test262/expectations.yaml:
+        Mark four test cases as passing.
+
+2020-09-24  Ross Kirsling  <[email protected]>
+
         %TypedArray%.prototype.sort must throw if comparator is defined and uncallable
         https://bugs.webkit.org/show_bug.cgi?id=216952
 

Modified: trunk/JSTests/test262/expectations.yaml (267558 => 267559)


--- trunk/JSTests/test262/expectations.yaml	2020-09-25 05:02:09 UTC (rev 267558)
+++ trunk/JSTests/test262/expectations.yaml	2020-09-25 05:40:25 UTC (rev 267559)
@@ -1251,12 +1251,6 @@
 test/built-ins/TypedArray/prototype/slice/detached-buffer-zero-count-custom-ctor-same-targettype.js:
   default: 'TypeError: Underlying ArrayBuffer has been detached from the view (Testing with Float64Array.)'
   strict mode: 'TypeError: Underlying ArrayBuffer has been detached from the view (Testing with Float64Array.)'
-test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js:
-  default: 'Test262Error: should not call valueOf if toString is present (Testing with Float64Array.)'
-  strict mode: 'Test262Error: should not call valueOf if toString is present (Testing with Float64Array.)'
-test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js:
-  default: 'Test262Error: returns expected value Expected SameValue(«hacks2,hacks1», «hacks1,hacks2») to be true (Testing with Float64Array.)'
-  strict mode: 'Test262Error: returns expected value Expected SameValue(«hacks2,hacks1», «hacks1,hacks2») to be true (Testing with Float64Array.)'
 test/built-ins/TypedArrayConstructors/ctors/buffer-arg/byteoffset-to-number-detachbuffer.js:
   default: 'Test262Error: Expected a TypeError but got a RangeError (Testing with Float64Array.)'
   strict mode: 'Test262Error: Expected a TypeError but got a RangeError (Testing with Float64Array.)'

Modified: trunk/Source/_javascript_Core/ChangeLog (267558 => 267559)


--- trunk/Source/_javascript_Core/ChangeLog	2020-09-25 05:02:09 UTC (rev 267558)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-09-25 05:40:25 UTC (rev 267559)
@@ -1,5 +1,19 @@
 2020-09-24  Ross Kirsling  <[email protected]>
 
+        %TypedArray%.prototype.toLocaleString must make conscious use of @toString
+        https://bugs.webkit.org/show_bug.cgi?id=216956
+
+        Reviewed by Yusuke Suzuki.
+
+        A fascinating bug: if we override Number.prototype.toLocaleString to return { valueOf() { ... } },
+        then we can observe our %TypedArray%.prototype.toLocaleString resolving its element values in the wrong order.
+
+        * builtins/TypedArrayPrototype.js:
+        (toLocaleString):
+        Wrap the toLocaleString call for each element in @toString(), as the spec indicates.
+
+2020-09-24  Ross Kirsling  <[email protected]>
+
         %TypedArray%.prototype.sort must throw if comparator is defined and uncallable
         https://bugs.webkit.org/show_bug.cgi?id=216952
 

Modified: trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js (267558 => 267559)


--- trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js	2020-09-25 05:02:09 UTC (rev 267558)
+++ trunk/Source/_javascript_Core/builtins/TypedArrayPrototype.js	2020-09-25 05:40:25 UTC (rev 267559)
@@ -364,9 +364,9 @@
     if (length == 0)
         return "";
 
-    var string = this[0].toLocaleString(@argument(0), @argument(1));
+    var string = @toString(this[0].toLocaleString(@argument(0), @argument(1)));
     for (var i = 1; i < length; i++)
-        string += "," + this[i].toLocaleString(@argument(0), @argument(1));
+        string += "," + @toString(this[i].toLocaleString(@argument(0), @argument(1)));
 
     return string;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to