w3c / encrypted-media

Encrypted Media Extensions
https://w3c.github.io/encrypted-media/
Other
177 stars 79 forks source link

Resolve promises before enqueuing events #538

Closed joeyparrish closed 1 month ago

joeyparrish commented 2 months ago

Closes #461


Preview | Diff

joeyparrish commented 2 months ago

@jrummell-chromium JFYI

joeyparrish commented 1 month ago

Promises need to be resolved in task queues also.

I don't understand what you mean by this. Can you suggest an edit to show me what language you would agree with?

marcoscaceres commented 1 month ago

Sorry for the delay:

For example, from the Fetch spec:

  1. Queue a fetch task to run the following steps, with fetchParams’s task destination. 1.1 Pull from bytes buffer into stream. 1.1 If stream is errored, then terminate fetchParams’s controller. 1.1 Resolve promise with undefined.

See also https://www.w3.org/TR/web-share/ ... how the global task queue is used to resolve promises.

joeyparrish commented 1 month ago

I audited every instance of "resolve" or "resolved" in the spec. All have values, and all are now inside either "Run the following steps in parallel" or "queue a task" or "Use the cdm to execute". (I had to fix only one instance of a missing queue, in the recently-introduced method getStatusForPolicy().)

joeyparrish commented 1 month ago

Also worth a note, since we're being thorough: we resolve a promise inside the session closed algorithm, which is always run inside a task or in a set of parallel steps.

joeyparrish commented 1 month ago

I'm ready to merge this if there is no further feedback.

I'll be on leave for five weeks starting June 22, so if a positive consensus is reached after that date, please don't wait for me to hit the "merge" button.