⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 267559 in webkit


Ignore:
Timestamp:
Sep 24, 2020, 10:40:25 PM (6 years ago)
Author:
Ross Kirsling
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/JavaScriptCore:

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.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r267554 r267559  
     12020-09-24  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        %TypedArray%.prototype.toLocaleString must make conscious use of @toString
     4        https://bugs.webkit.org/show_bug.cgi?id=216956
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        * test262/expectations.yaml:
     9        Mark four test cases as passing.
     10
    1112020-09-24  Ross Kirsling  <ross.kirsling@sony.com>
    212
  • trunk/JSTests/test262/expectations.yaml

    r267554 r267559  
    12521252  default: 'TypeError: Underlying ArrayBuffer has been detached from the view (Testing with Float64Array.)'
    12531253  strict mode: 'TypeError: Underlying ArrayBuffer has been detached from the view (Testing with Float64Array.)'
    1254 test/built-ins/TypedArray/prototype/toLocaleString/calls-tostring-from-each-value.js:
    1255   default: 'Test262Error: should not call valueOf if toString is present (Testing with Float64Array.)'
    1256   strict mode: 'Test262Error: should not call valueOf if toString is present (Testing with Float64Array.)'
    1257 test/built-ins/TypedArray/prototype/toLocaleString/calls-valueof-from-each-value.js:
    1258   default: 'Test262Error: returns expected value Expected SameValue(«hacks2,hacks1», «hacks1,hacks2») to be true (Testing with Float64Array.)'
    1259   strict mode: 'Test262Error: returns expected value Expected SameValue(«hacks2,hacks1», «hacks1,hacks2») to be true (Testing with Float64Array.)'
    12601254test/built-ins/TypedArrayConstructors/ctors/buffer-arg/byteoffset-to-number-detachbuffer.js:
    12611255  default: 'Test262Error: Expected a TypeError but got a RangeError (Testing with Float64Array.)'
  • trunk/Source/JavaScriptCore/ChangeLog

    r267554 r267559  
     12020-09-24  Ross Kirsling  <ross.kirsling@sony.com>
     2
     3        %TypedArray%.prototype.toLocaleString must make conscious use of @toString
     4        https://bugs.webkit.org/show_bug.cgi?id=216956
     5
     6        Reviewed by Yusuke Suzuki.
     7
     8        A fascinating bug: if we override Number.prototype.toLocaleString to return { valueOf() { ... } },
     9        then we can observe our %TypedArray%.prototype.toLocaleString resolving its element values in the wrong order.
     10
     11        * builtins/TypedArrayPrototype.js:
     12        (toLocaleString):
     13        Wrap the toLocaleString call for each element in @toString(), as the spec indicates.
     14
    1152020-09-24  Ross Kirsling  <ross.kirsling@sony.com>
    216
  • trunk/Source/JavaScriptCore/builtins/TypedArrayPrototype.js

    r267554 r267559  
    365365        return "";
    366366
    367     var string = this[0].toLocaleString(@argument(0), @argument(1));
     367    var string = @toString(this[0].toLocaleString(@argument(0), @argument(1)));
    368368    for (var i = 1; i < length; i++)
    369         string += "," + this[i].toLocaleString(@argument(0), @argument(1));
     369        string += "," + @toString(this[i].toLocaleString(@argument(0), @argument(1)));
    370370
    371371    return string;
Note: See TracChangeset for help on using the changeset viewer.