- From: ddorwin via GitHub <sysbot+gh@w3.org>
- Date: Mon, 20 Jul 2015 23:30:37 +0000
- To: public-html-media@w3.org
ddorwin has just created a new issue for https://github.com/w3c/encrypted-media: == The definition of MediaKeyStatusMap's ForEachCallback is incorrect == The spec currently has: >`callback ForEachCallback = void (BufferSource keyId, MediaKeyStatus status);` First, values always come before keys in forEach callbacks (modulo what appear to be [bugs](https://www.w3.org/Bugs/Public/show_bug.cgi?id=28978) in Web IDL). Thus, `ForEachCallback`'s parameters should be reversed so the "value" is first and the "key" is second. <br/>However, I don’t believe either signature is currently possible because `MediaKeyStatusMap` has an `iterable` declaration. Based on my interpretation (see [bug 28978](https://www.w3.org/Bugs/Public/show_bug.cgi?id=28978) and item 2 in [bug 28979](https://www.w3.org/Bugs/Public/show_bug.cgi?id=28979)), the callback would be called with `index, [keyId, status]`. (This may not be the correct ordering - see [bug 28978](https://www.w3.org/Bugs/Public/show_bug.cgi?id=28978).) In addition, we may not need to explicitly specify `forEach`. See item 4 in [bug 28979](https://www.w3.org/Bugs/Public/show_bug.cgi?id=28979)). Given the complexity, it would probably still be a good idea to explain the format in a non-normative note. <br/>If our intent is for `MediaKeyStatusMap` to be like a Map, the [iterable declaration](https://heycam.github.io/webidl/#dfn-iterable-declaration) breaks this. We may want to just remove the iterable declaration and specify the "entries", "keys", "values" and `@@iterator` methods explicitly. That would allow us to have a `ForEachCallback` that behaves the same as a `Map`. <br/>Note: If we continue to use an iterable declaration, we may also want to rework the prose to explicitly identify the “key” and “value” and reference https://heycam.github.io/webidl/#dfn-value-pairs-to-iterate-over like https://fetch.spec.whatwg.org/#headers-class. See https://github.com/w3c/encrypted-media/issues/75
Received on Monday, 20 July 2015 23:30:38 UTC