Setting reflected unsigned long to out-of-range value should set to default

RESOLVED FIXED in Firefox 49

Status

()

RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: ayg, Assigned: ayg)

Tracking

unspecified
mozilla49
Points:
---

Firefox Tracking Flags

(firefox49 fixed)

Details

(Whiteboard: btpp-active)

Attachments

(1 attachment)

data:text/html,<!DOCTYPE html>
<script>
var img = document.createElement("img");
img.width = 2147483649;
document.documentElement.textContent = img.getAttribute("width");
</script>

We output 2147483649.  Chrome outputs -2147483647.  IE 11 outputs 0.  The spec matches IE 11:

"""
On setting, first, if the new value is in the range 0 to 2147483647, then let n be the new value, otherwise let n be the default value, or 0 if there is no default value; then, n must be converted to the shortest possible string representing the number as a valid non-negative integer and that string must be used as the new content attribute value.
"""
https://html.spec.whatwg.org/multipage/infrastructure.html#reflect

This aligns nicely with getting, where out-of-range values also map to the default value, so given that there's no interop anyway, it seems sensible to converge on this.
Created attachment 8749179 [details] [diff] [review]
0001-Bug-1270499-Setting-reflected-unsigned-long-to-out-o.patch

https://treeherder.mozilla.org/#/jobs?repo=try&revision=7e5b678b4bf8&exclusion_profile=false
Attachment #8749179 - Flags: review?(bzbarsky)
Comment on attachment 8749179 [details] [diff] [review]
0001-Bug-1270499-Setting-reflected-unsigned-long-to-out-o.patch

>+    if (aValue > 2147483647) {

INT32_MAX, please.

r=me with that.
Attachment #8749179 - Flags: review?(bzbarsky) → review+
Whiteboard: btpp-active

Comment 4

3 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/13d2ff715514
Status: ASSIGNED → RESOLVED
Last Resolved: 3 years ago
status-firefox49: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.