Array.prototype.sort should throw TypeError if param is a not callable object
authorkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Aug 2018 03:13:20 +0000 (03:13 +0000)
committerkeith_miller@apple.com <keith_miller@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Aug 2018 03:13:20 +0000 (03:13 +0000)
commitf02e4497417999c40873dd97829f8bfa9d76fb99
tree327307ba9ef0ae8876c09dfdd827bb80f1c06a02
parent45f14d67fcbb3912b541d130e6edf737b45f5770
Array.prototype.sort should throw TypeError if param is a not callable object
https://bugs.webkit.org/show_bug.cgi?id=188382

Reviewed by Saam Barati.

JSTests:

* test262/expectations.yaml:

Source/JavaScriptCore:

Improve spec compatability by checking if the Array.prototype.sort comparator is a function
before doing anything else.

Also, refactor the various helper functions to use let instead of var.

* builtins/ArrayPrototype.js:
(sort.stringComparator):
(sort.compactSparse):
(sort.compactSlow):
(sort.compact):
(sort.merge):
(sort.mergeSort):
(sort.bucketSort):
(sort.comparatorSort):
(sort.stringSort):
(sort):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@234716 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/test262/expectations.yaml
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/builtins/ArrayPrototype.js