[whatwg] Challenging canvas.supportsContext

Jonas Sicking jonas at sicking.cc
Tue Jun 25 16:46:48 PDT 2013


On Wed, Jun 26, 2013 at 1:39 AM, Glenn Maynard <glenn at zewt.org> wrote:
> On Tue, Jun 25, 2013 at 3:28 PM, Simon Pieters <simonp at opera.com> wrote:
>
>> On Tue, 25 Jun 2013 21:01:27 +0200, Dean Jackson <dino at apple.com> wrote:
>>
>>  Showing or hiding interface objects is not something I want to do.
>>>
>>
>> It's possible that I missed it, but, why not? There is precedent for doing
>> so. For instance, in Opera 11, the WebSocket constructor was absent unless
>> WebSockets were enabled in opera:config. This allowed feature detection
>> like the following to work:
>>
>
>> var supports_websockets = "WebSocket" in window;
>>
>> Also, the HTML spec actually requires it:
>>
>> [[
>> When support for a feature is disabled (e.g. as an emergency measure to
>> mitigate a security problem, or to aid in development, or for performance
>> reasons), user agents must act as if they had no support for the feature
>> whatsoever, and as if the feature was not mentioned in this specification.
>> For example, if a particular feature is accessed via an attribute in a Web
>> IDL interface, the attribute itself would be omitted from the objects that
>> implement that interface — leaving the attribute on the object but making
>> it return null or throw an exception is insufficient.
>> ]]
>>
>
> This is done if the feature is being disabled completely at page load time,
> with no chance of it coming back: you simply don't put the interface into
> the environment.  WebGL is different, since it might go away after the page
> is already loaded (eg. the GPU blacklist is updated); going in and trying
> to remove the interface after the page is loaded would be weird.  It might
> also become available after previously being unavailable (eg. video drivers
> are updated), in which case you'd have to go in and insert the interface.

I don't think any of the current proposals supports that use case. For
that to be really supported we'd need some sort of event that is fired
whenever support for WebGL is dynamically added or removed. Pages
having to continuously poll .supportsContext() is not a real solution.

Has any browser actually expressed interest in supporting that use case?

/ Jonas



More information about the whatwg mailing list