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 28327 - <canvas>: CanvasRenderingContext2D.putImageData cannot throw a NotSupportedError exception under ECMAScript binding *even if* any of the arguments are not finite.
Summary: <canvas>: CanvasRenderingContext2D.putImageData cannot throw a NotSupportedEr...
Status: RESOLVED MOVED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: All All
: P2 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: https://html.spec.whatwg.org/multipag...
Whiteboard:
Keywords:
: 28064 (view as bug list)
Depends on: 28064
Blocks:
  Show dependency treegraph
 
Reported: 2015-03-24 19:46 UTC by Tetsuharu OHZEKI
Modified: 2016-01-24 06:16 UTC (History)
4 users (show)

See Also:


Attachments

Description Tetsuharu OHZEKI 2015-03-24 19:46:11 UTC
# related specs

- CanvasRenderingContext2D
  - https://html.spec.whatwg.org/multipage/scripting.html#canvasrenderingcontext2d
  - https://html.spec.whatwg.org/multipage/scripting.html#pixel-manipulation
 - WebIDL
  - http://heycam.github.io/webidl/#es-double

# description

1. `CanvasRenderingContext2D.putImageData` says that to throw a NotSupportedError exception if any of the arguments are not finite, and the methods takes `double` as its arguments.

2. On the other hand, by WebIDL spec, `double` value type raises `TypeError` if the value is not finite when conversioning from ECMAScript to IDL Value.

3. By the above, `CanvasRenderingContext2D.putImageData` cannot throw a `NotSupportedError` because WebIDL conversion steps will raise a `TypeError` before arguments are passed to `CanvasRenderingContext2D.putImageData`, if values of arguments are not finite.

4. I found the same spec issue with "HTML Canvas 2D Context Editor's Draft 13 November 2014": http://www.w3.org/html/wg/drafts/2dcontext/html5_canvas_CR/#dom-context-2d-putimagedata
Comment 1 Anne 2015-08-28 16:03:21 UTC
Thank for reporting this, do you know what implementations do?
Comment 2 Domenic Denicola 2015-09-10 20:18:22 UTC
Firefox and Chrome do TypeError. Edge does NotSupportedError.

Seems best to go with TypeError. Will PR.
Comment 3 Domenic Denicola 2015-09-10 20:24:31 UTC
https://github.com/whatwg/html/pull/133
Comment 4 Domenic Denicola 2016-01-24 06:16:18 UTC
*** Bug 28064 has been marked as a duplicate of this bug. ***