If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Uint8ClampedArray constructor rounds wrong

RESOLVED FIXED in Firefox 38

Status

()

Core
JavaScript: Standard Library
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: evilpie, Assigned: evilpie)

Tracking

(Blocks: 1 bug)

Trunk
mozilla38
Points:
---
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(firefox38 fixed)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
new Uint8ClampedArray([2.6])
>> [2]
x = new Uint8ClampedArray([0])
x[0] = 2.6
x
>> [3]

Comment 1

3 years ago
Memo to self: need to check whether this affects SharedUint8ClampedArray too.
Blocks: 1054841

Comment 2

3 years ago
Tom, note that the bug here is really the opposite of what you reported.  ToUint8Clamp is supposed to round, not to truncate: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-touint8clamp.

Ergo it's the conversion from the array-element (the first case in your test) that is buggy, not the conversion of assignment (the second case).

(SharedTypedArray does not allow the construction from array literal, and the assignment case behaves correctly.  Removing dependency.)
No longer blocks: 1054841
(Assignee)

Comment 3

3 years ago
Sorry Lars, but I think you might be confused somehow. Like I said "Uint8ClampedArray constructor rounds wrong", which is the first case.

Comment 4

3 years ago
(In reply to Tom Schuster [:evilpie] from comment #3)
> Sorry Lars, but I think you might be confused somehow. Like I said
> "Uint8ClampedArray constructor rounds wrong", which is the first case.

Indeed I misinterpreted the Summary.
(Assignee)

Comment 5

3 years ago
Created attachment 8560436 [details] [diff] [review]
new-clamped
Assignee: nobody → evilpies
Status: NEW → ASSIGNED
Attachment #8560436 - Flags: review?(lhansen)

Updated

3 years ago
Attachment #8560436 - Flags: review?(lhansen) → review+
(Assignee)

Comment 6

3 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/9a45db9e1e28
https://hg.mozilla.org/mozilla-central/rev/9a45db9e1e28
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox38: --- → fixed
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.