- From: Glenn Maynard <glenn@zewt.org>
- Date: Tue, 25 Jun 2013 18:39:01 -0500
- To: Simon Pieters <simonp@opera.com>
- Cc: Benoit Jacob <jacob.benoit.1@gmail.com>, WHATWG <whatwg@lists.whatwg.org>, Dean Jackson <dino@apple.com>
On Tue, Jun 25, 2013 at 3:28 PM, Simon Pieters <simonp@opera.com> wrote: > On Tue, 25 Jun 2013 21:01:27 +0200, Dean Jackson <dino@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. It also doesn't provide any way to query arguments to getContext, eg. to see if null would be returned if a particular option is provided, which supportsContext allows. (I don't know if there are any cases where this actually happens, since most options are "best effort" and don't cause context creation to fail if they're not available.) -- Glenn Maynard
Received on Tuesday, 25 June 2013 23:39:26 UTC