This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.
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
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.
Also, if Infinity and NaN are not allowed, why doesn't the IDL specify sequence<double> rather than sequence<unrestricted-double>?
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.
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.
Happy to add such a comment, especially since someone wrote a patch to throw here!
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