Bug 216817

Summary: A question about TypedArray.prototype.lastIndexOf
Product: WebKit Reporter: NWU_NISL <nisl_grammarly1>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: ashvayka, fpizlo, keith_miller, webkit-bug-importer, ysuzuki
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: PC   
OS: Linux   

Description NWU_NISL 2020-09-22 01:32:40 PDT
According to ES10.0, "%TypedArray%.prototype.lastIndexOf" is a distinct function that implements the same algorithm as "Array.prototype.lastIndexOf". And it's optimization must not introduce any observable changes in the specified behaviour of the algorithm. But these two methods acts differently when no argument is passed. Is this an issue about javascriptCore?

#### version
dbae081


#### command
webkit/WebKitBuild/Debug/bin/jsc testcase.js


#### testcase
var v1 = [];
print(v1.lastIndexOf());

var v2 = new Uint8Array();
print(v2.lastIndexOf());


#### output
-1
TypeError: Expected at least one argument



#### expected output
-1
-1


contributor:Yuan Wang
Comment 1 Radar WebKit Bug Importer 2020-09-22 15:42:26 PDT
<rdar://problem/69396412>
Comment 2 Keith Miller 2020-09-22 16:02:55 PDT
Hi there, thanks for reporting this issue. You're correct! That does indeed look like a bug.

Seems like it should be simple to fix.
Comment 3 Keith Miller 2020-09-22 16:08:23 PDT
Actually, looks like this was fixed a while ago in https://bugs.webkit.org/show_bug.cgi?id=213715

Regardless, thanks again for the report!

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