Bug 216912 - %TypedArray%.prototype.fill must only evaluate its argument once
Summary: %TypedArray%.prototype.fill must only evaluate its argument once
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Ross Kirsling
URL:
Keywords: InRadar
: 199141 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-09-23 21:59 PDT by Ross Kirsling
Modified: 2020-09-24 15:10 PDT (History)
11 users (show)

See Also:


Attachments
Patch (3.63 KB, patch)
2020-09-23 22:10 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff
Patch for landing (4.13 KB, patch)
2020-09-24 00:13 PDT, Ross Kirsling
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ross Kirsling 2020-09-23 21:59:46 PDT
%TypedArray%.prototype.fill must only evaluate its argument once
Comment 1 Ross Kirsling 2020-09-23 22:10:27 PDT
Created attachment 409531 [details]
Patch
Comment 2 Yusuke Suzuki 2020-09-23 22:30:07 PDT
Comment on attachment 409531 [details]
Patch

r=me
Comment 3 Alexey Shvayka 2020-09-23 23:51:43 PDT
Comment on attachment 409531 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=409531&action=review

> Source/JavaScriptCore/builtins/TypedArrayPrototype.js:94
> +    var number = @toNumber(value);

According to its ChangeLog, https://webkit.org/b/157088 made the opposite change. Have the spec changed since?
Comment 4 Ross Kirsling 2020-09-24 00:00:22 PDT
(In reply to Alexey Shvayka from comment #3)
> Comment on attachment 409531 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=409531&action=review
> 
> > Source/JavaScriptCore/builtins/TypedArrayPrototype.js:94
> > +    var number = @toNumber(value);
> 
> According to its ChangeLog, https://webkit.org/b/157088 made the opposite
> change. Have the spec changed since?

I'm not authorized to see that ticket, but the current spec is clear:
https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill
(step 5; step 4 is absent because we don't yet support BigInt typed arrays)

And we're the only ones to fail the test:
https://test262.report/browse/built-ins/TypedArray/prototype/fill/fill-values-conversion-once.js
Comment 5 Ross Kirsling 2020-09-24 00:05:36 PDT
Oh, I see that it's this patch:
https://github.com/WebKit/webkit/commit/43383ccbb7d9c88b31d8e330fe3b32705b8305a5

Yeah, it looks like the spec was changed here three years ago:
https://github.com/tc39/ecma262/pull/856
Comment 6 Ross Kirsling 2020-09-24 00:13:04 PDT
Created attachment 409536 [details]
Patch for landing
Comment 7 EWS 2020-09-24 00:35:34 PDT
Committed r267522: <https://trac.webkit.org/changeset/267522>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 409536 [details].
Comment 8 Radar WebKit Bug Importer 2020-09-24 00:36:17 PDT
<rdar://problem/69485929>
Comment 9 Alexey Shvayka 2020-09-24 15:10:05 PDT
*** Bug 199141 has been marked as a duplicate of this bug. ***