[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Re: [whatwg] Canvas.getContext error handling
- To: Cedric Vivier <firstname.lastname@example.org>
- Subject: Re: [Public WebGL] Re: [whatwg] Canvas.getContext error handling
- From: Kenneth Russell <email@example.com>
- Date: Thu, 21 Apr 2011 15:56:17 -0700
- Cc: Mark Callow <firstname.lastname@example.org>, Glenn Maynard <email@example.com>, firstname.lastname@example.org
- Dkim-signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1303426582; bh=B+K2kITLGkjO5EcGdgSfFKVqOKc=; h=MIME-Version:In-Reply-To:References:Date:Message-ID:Subject:From: To:Cc:Content-Type; b=ZW90tist5NDVgpoQzDG4G8tm+ty3H7FW9hv6NXdYpW31LkP+kvPlRPs8yMlZyRNmp EF8UgGvISAI9/GrGyIc0w==
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=beta; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=IkNHWV4HtsFaCMQeYxG8L8O7mFBqrSNYSmXI+5aWn+g=; b=kBi6C5l3SUfDnVlFKf7DZrwKoBWHSYLWwCSP0/fA7Mz2Efd+oqm9ube4vzROdDD4oi SJVI9631AFS3SfB+jVSg==
- Domainkey-signature: a=rsa-sha1; c=nofws; d=google.com; s=beta; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=L31uJP4FKezZq6sG+7QGkBvZ+oulTNXRg8sDl0Xj2mCmoOe8cXYJjbuevTg4xDBpCY tvY4bxq4Ck6j2k0nB1Sw==
- In-reply-to: <BANLkTinp2r+tjCWV1w_DnA-Je3wQSr94LQ@mail.gmail.com>
- List-id: Public WebGL Mailing List <public_webgl.khronos.org>
- References: <BANLkTimo3JXAjxHPMNW-Az6-A47LjP6gNw@mail.gmail.com> <BANLkTimGSvfuk36Qja+S=NdUCcxXoO-NVg@mail.gmail.com> <BANLkTintm6cjrDorYJnNJ+XP-c8mWH8hYQ@mail.gmail.com> <Pine.LNX.email@example.com> <4DA4198A.firstname.lastname@example.org> <BANLkTi=RRBpCL8PV48C1f44AEtfNFavpnw@mail.gmail.com> <BANLkTi=YM_fq=T2MRBEtbwZ+h8xzPjZ5email@example.com> <BANLkTimmgyDUMX0eXqdTf47EHs+LZ66TWA@mail.gmail.com> <BANLkTinBz6-D8BSUssTrqiWjewiPedWEnw@mail.gmail.com> <BANLkTikMN-0TREAWsL3ROMP=XY3xzMAEAA@mail.gmail.com> <BANLkTimFVVJNgohfHmbuXrRp5O3By79APQ@mail.gmail.com> <BANLkTi=KDmpYrWWHp2SuKB5MRtVCTggq8Q@mail.gmail.com> <4DAE42F7.firstname.lastname@example.org> <BANLkTinp2r+tjCWV1w_DnA-Je3wQSr94LQ@mail.gmail.com>
- Sender: email@example.com
On Tue, Apr 19, 2011 at 7:35 PM, Cedric Vivier <firstname.lastname@example.org> wrote:
> On Wed, Apr 20, 2011 at 10:20, Mark Callow <email@example.com> wrote:
>> On 19/04/2011 04:06, Glenn Maynard wrote:
>>> Following up from whatwg:
>>> To recap, step 6 of getContext ("Return a new object for contextId"),
>>> which is where WebGL takes over, was never intended to return null.
>>> null isn't a "new object", it's no object.
>> What happens if the context type passed to getContext is not recognized
>> by the browser, e.g., when WebGL is not supported by the browser?
> Null is returned, as specified in the Canvas spec.
>> If we go this route, a status message in webglcontextlost is
>> insufficient. Applications that wish to handle webglcontextlost will not
>> want to be parsing strings, especially localized strings, to determine
>> if the browser is refusing to create a context, so there is no
>> possibility of restoration, or if it is a normal context lost event.
>> Some kind of error code will be needed.
> Yes, I believe adding an isRestorable boolean to the webglcontextlost
> event would help to differentiate between a permanent or transient
> statusMessage should be used for display only and should never have to
> be parsed.
> To make sure it does not get abused *and* to let browsers give better
> diagnostic to users, we might even want to get rid of it, if the
> browser actually has useful failure information to provide, it could
> expose it in a more useful/consistent way to the user directly.
I wonder whether it would be an improvement if Canvas's getContext()
algorithm admitted the possibility of an exception being thrown during
context creation. As it stands, every new context type which has the
possibility of failing to initialize has to define its own,
callback-based, error reporting mechanism. Maybe this isn't that big a
deal, because these context types might have to deal with "lost"
contexts like WebGL does.
This comment aside, the semantic change to return a non-null context
when an error condition occurs sounds acceptable to me. I'm not
completely happy with it, because I think that it will make error
detection harder for the developer. I think we should gather more
feedback, in particular from other browser vendors on the working
group, before committing to make this change. Note that existing WebGL
content is going to have to be updated to deal with this change, in
order to continue to properly detect the situation when the graphics
card is blacklisted.
If we proceed with this change, I agree that we need an indication
that the failure was not recoverable, so that the application can
display appropriate UI to the end user. Adding a boolean to the
webglcontextlost event seems somewhat like a hack, because it
essentially changes the meaning of the event to exactly that of
webglcontextcreationerror. Does anyone have an alternative idea?
Subclassing the event type? Continuing to use a different kind of
event listener? If there's no better suggestion then it sounds okay.
Additionally, if we proceed with this change, I do not support the
removal of the statusMessage. As an implementor of WebGL, I require
the ability to provide some information to application developers
(which might end up being sent back in in bug reports) when for some
reason WebGL could not initialize.
You are currently subscribed to firstname.lastname@example.org.
To unsubscribe, send an email to email@example.com with
the following command in the body of your email: