[whatwg] Need clarification on DOM exceptions thrown by canvas 2D drawImage

Justin Novosad junov at chromium.org
Mon Aug 8 13:55:26 PDT 2011


This inquiry is regarding this page of the specification:
In section Images, about drawImage(), it is stated that
"If one of the sw or sh arguments is zero, the implementation must
raise an INDEX_SIZE_ERR exception"  There are no other references to
other circumstances under which INDEX_SIZE_ERR should be thrown, and
there is no indication of what the correct behavior is when the source
rectangle is completely or partially outside the bounds of the source

Right now there are discrepancies in how different browsers handle
this situation.
 -WebKit throws INDEX_SIZE_ERR when the source rectangle is completely
out of bounds
 -Internet Explorer 9 does not throw an exception (which I believe is
the correct behavior, given the current wording of the spec)
 -Firefox 5 throws an INDEX_SIZE_ERR if the source rectangle is out of
bounds to the top or left (negative sx or sy)

Also, this test agrees with (or perhaps influenced) the WebKit
interpretation of the specification:

This matter is currently under investigation in WebKit:

On the Firefox side, a patch was recently submitted to remove the
exception (be like IE)

Thanks providing clarification,


More information about the whatwg mailing list