Bug 261140 - REGRESSION (266591@main): Array.splice can return `undefined` for `[].splice(0, 0)`
Summary: REGRESSION (266591@main): Array.splice can return `undefined` for `[].splice(...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: Safari Technology Preview
Hardware: Mac (Apple Silicon) macOS 13
: P2 Critical
Assignee: Yusuke Suzuki
URL:
Keywords: InRadar
Depends on: 259809
Blocks:
  Show dependency treegraph
 
Reported: 2023-09-05 02:32 PDT by scythes.corms_0i
Modified: 2023-09-06 15:43 PDT (History)
5 users (show)

See Also:


Attachments
repro file (134.73 KB, text/html)
2023-09-05 02:32 PDT, scythes.corms_0i
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description scythes.corms_0i 2023-09-05 02:32:19 PDT
Created attachment 467550 [details]
repro file

Hello from the VS Code Team

We are running unit tests against various browsers and while trying to run them against Safari Tech Preview, Release 177 (Safari 17.0, WebKit 18617.1.4.3), we are encountering an issue that looks like a browser bug. It seems that Array.splice can return undefined instead of an empty array. I have created and attached a file that resembles our unit tests which should allow you to reproduce this. 

Steps:

* open Safari Tech Preview
* load the attached file
* notice how line 28 is reached, meaning Array.splice has returned undefined


Observations:

* this happens for the case of an empty array and index and deletion count being zero
* this doesn't happen when adding a breakpoint or the debugger statement hinting towards an issue with JIT
* this works fine in Safari 16.6


Excuses: 

* Sorry, for the large sample file. It's basically the one test that's failing and all its dependencies (sans tree shaking)
Comment 1 Radar WebKit Bug Importer 2023-09-05 10:45:43 PDT
<rdar://problem/114992785>
Comment 2 Yusuke Suzuki 2023-09-06 14:34:54 PDT
Pull request: https://github.com/WebKit/WebKit/pull/17503
Comment 3 EWS 2023-09-06 15:43:16 PDT
Committed 267703@main (b97cfe44a622): <https://commits.webkit.org/267703@main>

Reviewed commits have been landed. Closing PR #17503 and removing active labels.