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 9584 - drawImage() shouldn't throw INVALID_STATE_ERR
Summary: drawImage() shouldn't throw INVALID_STATE_ERR
Status: RESOLVED WORKSFORME
Alias: None
Product: HTML WG
Classification: Unclassified
Component: pre-LC1 HTML Canvas 2D Context (editor: Ian Hickson) (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P3 normal
Target Milestone: LC
Assignee: Ian 'Hixie' Hickson
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords: NE
Depends on:
Blocks:
 
Reported: 2010-04-23 02:22 UTC by Jatinder Mann [MSFT]
Modified: 2010-10-05 12:58 UTC (History)
6 users (show)

See Also:


Attachments

Description Jatinder Mann [MSFT] 2010-04-23 02:22:21 UTC
Per this conversation,http://lists.w3.org/Archives/Public/public-html/2009Aug/1458.html, we need to update the spec.

On Fri, 28 Aug 2009 03:03:19 +0200, Ian Hickson <ian@hixie.ch> wrote:

> On Mon, 17 Aug 2009, Simon Pieters wrote:
>> On Fri, 14 Aug 2009 03:54:08 +0200, Ian Hickson <ian@hixie.ch> wrote:
>> > On Thu, 6 Aug 2009, Simon Pieters wrote:
>> > >
>> > > The spec says that canvas drawImage() should throw INVALID_STATE_ERR
>> > > when the image isn't loaded yet or video isn't enough loaded. I
>> > > think this is a bad idea.
>> > >
>> > > I expect authors to just draw a video on a canvas when they see fit,
>> > > test locally or on a stable network, see that it works fine. Then
>> > > the script will stop working completely for some users because of
>> > > the uncaught exception when the script tries to drawImage() a video
>> > > that's not ready yet.
>> > >
>> > > Moreover, Opera has lazy loading of images (only loading images that
>> > > are rendered or have some event handlers or were created with new
>> > > Image() etc), so we'd probably want to just load the image when the
>> > > script tries to draw it instead of throwing.
>> > >
>> > > Therefore I suggest that the spec be changed to not throw
>> > > INVALID_STATE_ERR for drawImage() (and createPattern()).
>> > >
>> > > The method could be changed from void to return a boolean,
>> > > indicating whether the image was successfully drawn, so scripts can
>> > > detect it easily.
>> >
>> > What should createPattern() return in this situation?
>>
>> It should return null, which will be ignored when set on fillStyle and
>> strokeStyle.
>
> Done. (It still doesn't return false, though, since you can detect this
> case yourself if you really care.)
>

It looks like you missed two instances of INVALID_STATE_ERR, in the green  
boxes for context.drawImage and context.createPattern. I can't tell if  
these boxes are normative spec text or just a summary of the information  
below, but that's not the point here...

-- 
Philip Jägenstedt
Core Developer
Opera Software
Comment 1 Ian 'Hixie' Hickson 2010-09-10 09:04:07 UTC
EDITOR'S RESPONSE: This is an Editor's Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Accepted
Change Description: no spec change
Rationale: This seems to have been fixed already.

BTW, you can tell what's normative and what isn't because it'll say "MUST" if it's normative.