Bug 220507 - An issue about %TypedArray%.prototype.sort
Summary: An issue about %TypedArray%.prototype.sort
Status: RESOLVED DUPLICATE of bug 216952
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Local Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-01-11 05:12 PST by NWU_NISL
Modified: 2021-01-20 14:50 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description NWU_NISL 2021-01-11 05:12:53 PST
#version: 
dbae081(https://github.com/WebKit/WebKit-http/commit/dbae081ad7e22d9ab61edf2f337f6c2bb593c7f8)

#Testcase:
a = 10;
b = new Uint8Array(a);
b.sort(1);

#Command:
./webkit/WebKitBuild/Release/bin/jsc testcase.js

#Output:
No exceptions are thrown

#Expected output:
TypeError: 1 is not a function

#Description:

According to ES2019 standard, the steps of '%TypedArray%.prototype.sort' are as follows.
>22.2.3.26%TypedArray%.prototype.sort ( comparefn )
> 1. If comparefn is not undefined and IsCallable(comparefn) is false, throw a TypeError exception.
> ...

When executing the above test case, the parameter of %TypedArray%.prototype.sort is 1. According to the standard, a TypeError should be thrown, but JavaScriptCore did not throw any error.
The ECMAScript standard reference is as follow:
http://www.ecma-international.org/ecma-262/10.0/index.html#sec-%typedarray%.prototype.sort
Comment 1 Radar WebKit Bug Importer 2021-01-18 05:13:12 PST
<rdar://problem/73320341>
Comment 2 Mark Lam 2021-01-20 14:50:15 PST

*** This bug has been marked as a duplicate of bug 216952 ***