On 10/19/13 12:32 AM, Harald Alvestrand wrote:
> The behaviour I want is:
>
> getUserMedia(.... mandatory(knownKey='foo', unknownKey='bar') ...)
>
> should call the error callback ("constraints can't be satisfied"),
> with "unknownKey='bar'" as the constraint that couldn't be satisfied.
>
> getUserMedia(.... optional((knownKey='foo'), (unknownKey='bar')) ...)
>
> should silently succeed.
Me too, though I'd prefer throwing "constraints aren't supported" and
leave the error callback for when sources don't satisfy.
> If that means dictionaries aren't the right object, we'll have to use
> something else.
I can't think of a better fit. Perhaps we could ask the webidl group for
an " ExtendedAttributeMandatory" on dictionaries that throws on unknown
keys instead of ignoring them?
A webidl type that lets everything through already exists: 'object' -
FWIW I think the workaround we have now of using object in the external
API works. We just copy it to the dictionary internally once we've
checked for unknowns, so we still benefit from the definitions. Also
this is just for mandatory constraints, optional ones work fine.
We could ask for an "ExtendedAttributeTreatAsObject" which at least is
more readable than non-descript object. e.g.:
dictionary MediaTrackConstraints {
[TreatAsObject] // so we can see unknown + unsupported constraints
MediaTrackConstraintSet mandatory;
sequence<MediaTrackConstraint> _optional;
};
.: Jan-Ivar :.