Closed
Bug 593689
Opened 15 years ago
Closed 15 years ago
new Image(undefined) should not fire an error
Categories
(Core :: DOM: Core & HTML, defect, P1)
Tracking
()
RESOLVED
FIXED
mozilla2.0b7
People
(Reporter: espadrine, Assigned: bzbarsky)
Details
Attachments
(1 file)
|
3.13 KB,
patch
|
jst
:
review+
jst
:
approval2.0+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0b6pre) Gecko/20100904 Firefox/4.0b6pre
Build Identifier: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.5; rv:2.0b6pre) Gecko/20100904 Firefox/4.0b6pre
Having a script that uses the constructor of an image (var foo = new Image(undefined);) yields an error: "can't convert undefined into an integer".
Reproducible: Always
Steps to Reproduce:
1. Go to the error console.
2. Evaluate "new Image(undefined)"
3. See the following error: "Can't convert undefined to an integer".
Actual Results:
An error is fired, "Error: can't convert undefined to an integer".
Expected Results:
No error should be fired. Undefined should be interpreted as 0.
| Assignee | ||
Comment 1•15 years ago
|
||
Should we be using JS_ValueToECMAUint32 here instead of JS_ValueToInt32? The former treats NaN (which is what we have here) as 0 instead of as an error...
Status: UNCONFIRMED → NEW
Ever confirmed: true
| Assignee | ||
Comment 2•15 years ago
|
||
| Assignee | ||
Updated•15 years ago
|
Attachment #472676 -
Attachment description: . Convert arguments to new Image() to integers the way other conversions to integer happen. → Fix
Attachment #472676 -
Flags: review?(jst)
| Assignee | ||
Updated•15 years ago
|
Whiteboard: [needs review]
| Assignee | ||
Updated•15 years ago
|
Assignee: nobody → bzbarsky
Priority: -- → P1
| Assignee | ||
Updated•15 years ago
|
Whiteboard: [needs review] → [need review]
Comment 3•15 years ago
|
||
Comment on attachment 472676 [details] [diff] [review]
Fix
Yup, this makes us match IE in this regard, so I think we should take this change.
Attachment #472676 -
Flags: review?(jst)
Attachment #472676 -
Flags: review+
Attachment #472676 -
Flags: approval2.0+
| Assignee | ||
Updated•15 years ago
|
Whiteboard: [need review] → [need landing]
| Assignee | ||
Comment 4•15 years ago
|
||
Status: NEW → RESOLVED
Closed: 15 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.0b6
| Assignee | ||
Updated•15 years ago
|
Whiteboard: [need landing]
You need to log in
before you can comment on or make changes to this bug.
Description
•