WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED DUPLICATE of
bug 216912
199141
Wrong Realization of TypedArray.prototype.fill
https://bugs.webkit.org/show_bug.cgi?id=199141
Summary
Wrong Realization of TypedArray.prototype.fill
sunlili
Reported
2019-06-23 21:51:23 PDT
The implementation of ‘TypedArray.prototype.fill’ in the engine is not correct. According to Ecma-262 standard, it should get the value of 'p1' firstly, and then calculate the start and end index to fill the value at corresponding items. But the actual order of implementation is reversed. The following code demonstrate our guess. The proxy ‘get’ function doesn’t run at all. JS engines like v8 & spidermonkey have different output. The code: let array = new Uint32Array(5); let arg1 = [1, 2, 3]; let start = { valueOf: () => { return 5; } }; let end = { valueOf: () => { return -3; } }; let p1 = new Proxy(arg1, { get: function(oTarget, sKey) { if (sKey.toString() == 'valueOf') { print('call valueOf'); arg1[0] = 0; } return Reflect.get(oTarget, sKey); } }); arr2 = Uint32Array.prototype.fill.call(array, p1, start, end); print(arg1); The output: 1,2,3 BT group 2019.06.24
Attachments
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2019-06-24 00:28:31 PDT
<
rdar://problem/52044197
>
Alexey Shvayka
Comment 2
2020-09-24 15:10:05 PDT
(In reply to sunlili from
comment #0
)
> The output: > 1,2,3
Thank you for detailed report!
r267522
aligned our %TypedArray%.prototype.fill implementation with the spec. Provided sample output is now consistent with other runtimes: call valueOf [0, 2, 3] *** This bug has been marked as a duplicate of
bug 216912
***
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