Re: gUM constraints webidl implementer feedback

On 10/16/13 6:42 AM, Harald Alvestrand wrote:
> On 10/15/2013 08:28 PM, Jan-Ivar Bruaroey wrote:
>>
>>  1. Mandatory constraints aren't implementable as webidl dictionaries.
>>       * We're supposed to detect unknown mandatory constraints and
>>         fail on them, but webidl dictionaries /silently ignore/
>>         unknown keys!
>>
>
> I thought this was a feature... don't you get to see the ignored keys 
> in the engine?

No, our webidl-compiler-generated bindings create a new dictionary from 
default values and then interrogates known members it finds in the 
provided content JS object through inspection. This is for security 
reasons, as content JS objects may be toxic. - Unknown members have 
unknown types, so including them safely becomes tricky.

>> 1.
>>       * To work around this problem, I had to alter the API to take
>>         the mandatory member as a plain object (which makes our
>>         webidl security guys' neck-hair stand up, but it's ok), like
>>         this:
>>           o dictionary MediaTrackConstraints {
>>                 object mandatory; // so we can see unknown +
>>             unsupported constraints
>>                 sequence<MediaTrackConstraint> _optional;
>>             };
>>       * I then convert it internally to this structure after scanning
>>         for unknown keys, which should be safe:
>>           o dictionary MediaTrackConstraintsInternal {
>>                 MediaTrackConstraintSet mandatory; // holds only
>>             supported constraints
>>                 sequence<MediaTrackConstraint> _optional;
>>             };
>>
>>
>> In lieu of alternative solutions to number 6, I'd like to see the 
>> spec be explicit about what's needed to implement this as it stands.
>
> Seems to me we have a differing understanding of how the engine should 
> deal with dictionaries.

I agree. Maybe the webidl group can help clarify?

.: Jan-Ivar :.

Received on Wednesday, 16 October 2013 19:40:14 UTC