This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 18754 - In step 2, should setLineDash abort with an exception?
Summary: In step 2, should setLineDash abort with an exception?
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-08-31 20:23 UTC by contributor
Modified: 2012-09-20 23:27 UTC (History)
3 users (show)

See Also:


Attachments

Description contributor 2012-08-31 20:23:54 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-element.html
Multipage: http://www.whatwg.org/C#dom-context-2d-setlinedash
Complete: http://www.whatwg.org/c#dom-context-2d-setlinedash

Comment:
In step 2, should setLineDash abort with an exception?

Posted from: 2620:0:100c:0:5fb:6ba9:8a9e:6846 by junov@chromium.org
User agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.83 Safari/537.1
Comment 1 Justin Novosad 2012-08-31 20:30:13 UTC
The current wording is:
"If any value in the array is not finite (e.g. an Infinity or a NaN value), or if any value is negative (less than zero), then abort these steps."

It does not specify that an exception should be thrown.  Is this intentional or an omission?
Peeking around at the spec, it looks like other functions with similar constraints are throwing an indexSizeError exception.
Comment 2 Justin Novosad 2012-08-31 20:54:21 UTC
Also, if Infinity and NaN are not allowed, why doesn't the IDL specify sequence<double> rather than sequence<unrestricted-double>?
Comment 3 Ian 'Hixie' Hickson 2012-08-31 21:50:04 UTC
It's intentional. Most of the canvas API ignores infinities so that you can do divisions by zero and just get nothing rather than the script aborting. (Divisions by zero are not uncommon in graphics.)

If there's a reason to change it for this particular feature though, I'm happy to reconsider.
Comment 4 Justin Novosad 2012-09-01 03:24:54 UTC
That is fine by me. 

I understand that the specification strives to be concise and that it is not necessary to mention things that the implementation does not need to do. Still, it might be helpful if it said "(...), then abort these steps without throwing an exception". I bring this up because there was a webkit patch up for review that was throwing an exception in this case, which prompted me to file this bug.

Anyhow, thanks for giving me the answer I was looking for.
Comment 5 Ian 'Hixie' Hickson 2012-09-20 23:27:00 UTC
Happy to add such a comment, especially since someone wrote a patch to throw here!
Comment 6 contributor 2012-09-20 23:27:47 UTC
Checked in as WHATWG revision r7386.
Check-in comment: Clarification based on implementation experience
http://html5.org/tools/web-apps-tracker?from=7385&to=7386