[whatwg] [canvas] Proposal for supportsContext

Ian Hickson ian at hixie.ch
Mon Oct 22 19:14:12 PDT 2012


On Mon, 22 Oct 2012, Glenn Maynard wrote:
> On Mon, Oct 22, 2012 at 6:36 PM, Ian Hickson <ian at hixie.ch> wrote:
> > > 
> > > If you really want to protect users from the behavior of pages, 
> > > you'd really need to make creating the context cheap.  For example, 
> > > don't switch to a high-power GPU until the page actually draws 
> > > something, and--since many pages use both Canvas and WebGL for 
> > > one-shot rendering--be sure to switch back to the low-power GPU 
> > > after some idle time.
> >
> > That does seem like a somewhat better implementation strategy, if 
> > viable, but doesn't preclude the supportsContext() feature.
> 
> It doesn't preclude it, but it doesn't seem to fix the problem, either:
> 
>| Yes, it could. But we don't control Modernizr or any other scripts 
>| people might use. I'd rather provide something at the browser-level to 
>| protect from bad practice than expect every page to behave nicely.
> 
> This (from Dean, the OP) seems to be an argument *against* 
> supportsContext, since supportsContext is precisely "expecting every 
> page to behave nicely".  Something-at-the-browser-level is what I 
> described above (in reply).
> 
> And if the nicer above fix is implementable, supportsContext seems 
> unnecessary.

Well, it's always going to be cheaper to return a boolean than an object, 
so if that _does_ work, then that's better. I agree that it's possible 
that it won't and that we'll have to either drop the feature or live with 
it even though it's not used much.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.'



More information about the whatwg mailing list