I have a canvas. Graphic primitives are perfectly drawn on it, but for some reason image insertion does not always work well. I use the method:

e.drawImage(image, sx, sy, sw, sh, dx, dy, dw, dh); 

In Mozilla and Chrome, everything works fine, but in IE9 the error periodically drops:

  DOM Exception: INDEX_SIZE_ERR (1) code: 1 ABORT_ERR: 20 DOMSTRING_SIZE_ERR: 2 HIERARCHY_REQUEST_ERR: 3 INDEX_SIZE_ERR: 1 INUSE_ATTRIBUTE_ERR: 10 INVALID_ACCESS_ERR: 15 INVALID_CHARACTER_ERR: 5 INVALID_MODIFICATION_ERR: 13 INVALID_STATE_ERR: 11 NAMESPACE_ERR: 14 NETWORK_ERR: 19 NOT_FOUND_ERR: 8 NOT_SUPPORTED_ERR: 9 NO_DATA_ALLOWED_ERR: 6 NO_MODIFICATION_ALLOWED_ERR: 7 PARSE_ERR: 81 QUOTA_EXCEEDED_ERR: 22 SECURITY_ERR: 18 SERIALIZE_ERR: 82 SYNTAX_ERR: 12 TYPE_MISMATCH_ERR: 17 URL_MISMATCH_ERR: 21 VALIDATION_ERR: 16 WRONG_DOCUMENT_ERR: 4 

How to fix?

  • Apparently the error does not happen when you execute drawImage, but somewhere else. Locate the error location more precisely. - cy6erGn0m
  • I added a debugging output and it showed that the application falls on this line. At the same time in this line there are no calculations or creating / receiving images, etc. - angry
  • There really were zeros. But now it is not clear why the event is about downloading the image, and the size is 0 * 0 (in other browsers the normal size). What could this be? - angry

1 answer 1

Do you have all variables greater than zero? May fall because of this.