W3C home > Mailing lists > Public > public-media-capture@w3.org > June 2015

getUserMedia({ }) should be a TypeError

From: Jan-Ivar Bruaroey <jib@mozilla.com>
Date: Thu, 18 Jun 2015 18:53:15 -0400
Message-ID: <55834BDB.30501@mozilla.com>
To: public-media-capture@w3.org
In hindsight, I think it's clear that getUserMedia({ }) should be a 
TypeError rather than a NotSupportedError.

Having { lasers: true } throw NotSupportedError may sound good, but 
gives the wrong impression, as it leads to surprise when { lasers: true, 
audio: true } succeeds without error.

More importantly, the arrival of the required keyword for dictionary 
members in WebIDL suggests that empty dictionaries in new APIs are more 
likely to throw TypeError than anything else.

Even though the 'required' keyword wont work in our particular case, who 
knows, WebIDL may someday add a way to specify mutually-exclusive 
required members, and we'd wish we'd made this change now.

This also aligns well with the recent move to make this validation 
synchronous #182

.: Jan-Ivar :.

Received on Thursday, 18 June 2015 22:53:47 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 18 June 2015 22:53:47 UTC