Closed Bug 1194991 Opened 4 years ago Closed 4 years ago

Coercions to restricted float values are wrong in WebIDL.py

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: n.oxyde, Assigned: Ms2ger)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.1.17 (KHTML, like Gecko) Version/7.1 Safari/537.85.10

Steps to reproduce:

Call IDLValue.coerceToType() on a float or integer value with a float or double type.


Actual results:

The coerced value does not refer to the intended restricted float or double type. integer.coerceToType(float_or_double_type) always returns a restricted float. float_or_double.coerceToType(restricted_float_or_double_type) always returns the same type as float_or_double.


Expected results:

The coerced value's type should always be the one passed as argument.
Comment on attachment 8648384 [details] [diff] [review]
Fix for IDLValue.coerceToType()

Came up in Servo, where restricted and unrestricted floats have different types.
Attachment #8648384 - Attachment is patch: true
Attachment #8648384 - Attachment mime type: text/x-patch → text/plain
Attachment #8648384 - Flags: review?(khuey)
Assignee: nobody → n.oxyde
Can you add a test for somewhere in Gecko that this distinction matters?
Flags: needinfo?(Ms2ger)
I don't think it matters in Gecko. Maybe a test under dom/bindings/parser/tests/ would work. nox, you want to try writing one?
Flags: needinfo?(Ms2ger)
Flags: needinfo?(Ms2ger)
Is this just waiting on the test to be checked in?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Yeah, I guess. Completely forgot about this bug.
I would be happy if someone else does it. I just remembered about it right now trying to update the parser in Servo.
Assignee: n.oxyde → Ms2ger
Status: NEW → ASSIGNED
Flags: needinfo?(Ms2ger)
https://hg.mozilla.org/mozilla-central/rev/4e6be8988177
https://hg.mozilla.org/mozilla-central/rev/f1966d9bbf47
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.