w3c / webcodecs

WebCodecs is a flexible web API for encoding and decoding audio and video.
https://w3c.github.io/webcodecs/
Other
937 stars 131 forks source link

Under what conditions should the ImageDecoder [[completed promise]] and ImageTrackList [[ready promise]] be rejected? #793

Closed aosmond closed 3 weeks ago

aosmond commented 3 weeks ago

The specification doesn't ever describe when we should reject ImageDecoder [[completed promise]] and ImageTrackList [[ready promise]].

We have tests that suggest that they should be rejected: https://github.com/web-platform-tests/wpt/blob/53a1437dcfc754a3dc8ffe0bd34f9a6524e49fcf/webcodecs/image-decoder.https.any.js#L484 https://github.com/web-platform-tests/wpt/blob/53a1437dcfc754a3dc8ffe0bd34f9a6524e49fcf/webcodecs/image-decoder.https.any.js#L171

Also, I created the promises at ImageDecoder initialization. Filling in the gaps with tests meant rejecting both promises in these error cases, but that meant the WPT harness reported uncaught exceptions for the promise that wasn't checked in the test. Should we be creating the promises on demand when the JS caller first calls the getter?

dalecurtis commented 3 weeks ago

Thanks for filing!

I'll put together some PRs to add these steps.

I'm not sure what you mean about creating the promises. We do create them at construction in Chromium.

aosmond commented 3 weeks ago

Thanks for filing!

* `completed` should be rejected if https://w3c.github.io/webcodecs/#imagedecoder-close-imagedecoder is run and it hasn't been resolved.

* `ready` should be rejected by failed decodes and if https://w3c.github.io/webcodecs/#imagedecoder-close-imagedecoder is run and it hasn't been resolved.

I'll put together some PRs to add these steps.

Awesome thank you!

I'm not sure what you mean about creating the promises. We do create them at construction in Chromium.

Does Chromium get uncaught exception errors in the WPT harness when running the tests I referenced? The only obvious ways to silence them for me in Firefox was to either update the meta INI files, or to alter the test to make sure all of the promises reject with the expected result.

dalecurtis commented 3 weeks ago

No I don't think we get any errors running those tests. The results files are clear AFAICT: https://source.chromium.org/search?ss=chromium&q=imageDecoder%20file:testexpectations https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/webcodecs/image-decoder.https.any.js