Closed Bug 728629 Opened 9 years ago Closed 7 years ago

canvas2D fillText & strokeText should not throw exceptions when non-finite doubles are passed for the position

Categories

(Core :: Canvas: 2D, defect)

10 Branch
x86
Linux
defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: jonathan.winterflood, Assigned: almasry.mina)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:10.0.2) Gecko/20100101 Firefox/10.0.2
Build ID: 20120216082320

Steps to reproduce:

Called canvas 2D context method strokeText or fillText with NaN, undefine or Infinity as a coordinate:
var c=document.createElement('canvas');
document.body.appendChild(c);
c.getContext("2d").strokeText("Hello",NaN,50); // Substitute fillText, undefined, Infinity

a null is ignored and seems treated as 0 (this may be an acceptable behaviour)


Actual results:

Exception "Error: An invalid or illegal string was specified" was thrown.


Expected results:

An exception along the lines of 'Error: An invalid x coordinate was specified: NaN' (substitute y, undefined, Infinity... as appropriate) should be thrown.
Component: Untriaged → Canvas: 2D
Product: Firefox → Core
Severity: normal → minor
QA Contact: untriaged → canvas.2d
Actually, the behavior the spec calls for here is to silently ignore the strokeText call.
Summary: canvas2D fillText & strokeText incorrect exception with invalid coordinate → canvas2D fillText & strokeText should not throw exceptions when non-finite doubles are passed for the position
More still? *sigh*
Blocks: 594251
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached patch strokeText.patchSplinter Review
This is no longer an issue. Attached a test case to show that.
Attachment #792545 - Flags: review?(vladimir)
Should I checkin this or no?
Should I checkin this or no?
Flags: needinfo?(Ms2ger)
Fwiw, chances are the switch to WebIDL bindings is what fixed this.
Uh, tests are good, so I'd say yes?
Flags: needinfo?(Ms2ger)
Keywords: checkin-needed
https://hg.mozilla.org/integration/mozilla-inbound/rev/ed18294b150c
Assignee: nobody → almasry.mina
Flags: in-testsuite+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/ed18294b150c
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.