WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 271703
Array.fromAsync calls Array constructor twice
https://bugs.webkit.org/show_bug.cgi?id=271703
Summary
Array.fromAsync calls Array constructor twice
Sosuke Suzuki
Reported
2024-03-26 06:06:47 PDT
When executing `Array.fromAsync.call(MyArray, { length: 2, 0: 1, 1: 2 });`, the `MyArray` constructor is called twice by `Array.fromAsync`. This bug is the cause of the failure of the Array.fromAsync test case in test262 (ref:
https://github.com/WebKit/WebKit/blob/d03ff2b610bca99b7a8160d654e35297218ff64a/JSTests/test262/expectations.yaml#L4-L9
). poc: ```js function shouldBe(actual, expected) { if (actual !== expected) throw new Error("bad value: " + actual); } let callCount = 0; function MyArray(...args) { callCount++; return new Proxy(Object.create(null), { set(target, key, value) { return Reflect.set(target, key, value); }, defineProperty(target, key, descriptor) { return Reflect.defineProperty(target, key, descriptor); }, }); } (async () => { await Array.fromAsync.call(MyArray, { length: 2, 0: 1, 1: 2 }); })().then(() => { shouldBe(callCount, 1); }); ```
Attachments
Add attachment
proposed patch, testcase, etc.
Sosuke Suzuki
Comment 1
2024-03-26 06:09:51 PDT
Pull request:
https://github.com/WebKit/WebKit/pull/26459
EWS
Comment 2
2024-03-27 14:07:06 PDT
Committed
276752@main
(75d98d9e2d74): <
https://commits.webkit.org/276752@main
> Reviewed commits have been landed. Closing PR #26459 and removing active labels.
Radar WebKit Bug Importer
Comment 3
2024-03-27 14:08:14 PDT
<
rdar://problem/125509304
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug