[encrypted-media] Inconsistent handling of invalid parameters

jrummell-chromium has just created a new issue for https://github.com/w3c/encrypted-media:

== Inconsistent handling of invalid parameters ==
Most of the parameters provided to the CDM are expected to be validated by the User Agent and return a TypeError if it's invalid. There are cases where the User Agent may not know how to validate a parameter, so additional validation may be done by the CDM. For example, section 6.7.1 for [update()](https://w3c.github.io/encrypted-media/#dom-mediakeysession-update) states how the CDM should handle an invalid |response| parameter:

> 6.7.1 If the format of sanitized response is invalid in any way, reject promise with a newly created TypeError.

However, if the CDM fails to process the |serverCertificate| provided for [setServerCertificate()](https://w3c.github.io/encrypted-media/#dom-mediakeys-setservercertificate), the CDM must:

> 5.2 Use this object's cdm instance to process sanitized certificate.
> 5.3 If the preceding step failed, resolve promise with a new DOMException whose name is the appropriate error name.

Invalid data for setServerCertificate() results in a DOMException, while invalid data for Update() results in a TypeError. TypeError is not a DOMException.

Noticed this as the W3C EME test drm-invalid-license.https.html expects a TypeError when update() called with invalid data, while drm-mp4-syntax-mediakeys.https.html expects a DOMException when setServerCertificate() called with invalid data (new Uint8Array(200)).

Please view or discuss this issue at https://github.com/w3c/encrypted-media/issues/433 using your GitHub account

Received on Saturday, 2 December 2017 01:56:01 UTC