- From: Xiaohan Wang via GitHub <noreply@w3.org>
- Date: Tue, 05 May 2026 06:44:46 +0000
- To: public-html-media@w3.org
xhwang-chromium has just created a new issue for https://github.com/w3c/encrypted-media: == getStatusForPolicy() resolves the promise multiple times without aborting == _Created with the help of AI._ ### Problem Description The algorithm for `getStatusForPolicy()` in Section 10.2 contains a logic error where it can resolve the same promise twice with different values if a policy restriction is met. According to the [specification](https://www.w3.org/TR/encrypted-media/#dom-mediakeys-getstatusforpolicy): > 3.3. For each [=dictionary member=] of `policy`, run the following steps: > 3.3.1. If the [=CDM=] would block presentation of decrypted media data for the [=dictionary member=], then **resolve `promise` with `MediaKeyStatus/"output-restricted"`**. > 3.4. **Resolve `promise` with `MediaKeyStatus/"usable"`**. ### Discussion If a policy requirement (e.g., `minHdcpVersion`) is not met, Step 3.3.1 resolves the promise with `"output-restricted"`. However, the algorithm does not "abort these steps" or return after this resolution. Consequently, it proceeds to Step 3.4, which resolves the *same* promise again with `"usable"`. In WebIDL and JavaScript, once a promise is settled (resolved or rejected), subsequent attempts to resolve or reject it are ignored. However, having a specification algorithm explicitly perform two conflicting resolutions on the same promise is logically incorrect and inconsistent with other algorithms in the spec. For example, [`MediaKeySession.load()`](https://www.w3.org/TR/encrypted-media/#dom-mediakeysession-load) (Step 8.11.1) correctly uses "abort these steps" after a resolution: > 8.11.1. If there is no data stored..., **resolve `promise` with `false` and abort these steps**. ### Suggested Fix Modify Step 3.3.1 to include an instruction to abort the steps after resolution: > 3.3.1. If the [=CDM=] would block presentation of decrypted media data for the [=dictionary member=], then resolve `promise` with `MediaKeyStatus/"output-restricted"` **and abort these steps**. Please view or discuss this issue at https://github.com/w3c/encrypted-media/issues/588 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Tuesday, 5 May 2026 06:44:47 UTC