Re: getUserMedia({ }) should be a TypeError

On 6/30/15 2:31 AM, Adam Bergkvist wrote:
> On 2015-06-19 00:54, Jan-Ivar Bruaroey wrote:
>> 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
> To clarify, empty dictionaries in new APIs throw TypeError when there is
> at least one required member specified for those dictionaries, right?

Right.

> If there's a trend towards specifying dictionaries more strictly (like
> with required) then I think TypeError is the way to go. That would make
> our "custom requirements", described in prose, indistinguishable from
> errors enforced by WebIDL extensions such as the required keyword.

Exactly.

> /Adam

.: Jan-Ivar :.

Received on Tuesday, 30 June 2015 13:52:41 UTC