Task or microtask for invoking error callbacks?
dalecurtis opened this issue · comments
Spec language for invoking the error callback says to "queue a task":
https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-task
Actually following this advice breaks some web platform tests. E.g.,
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/webcodecs/audio-encoder.https.any.js;l=196;drc=004515931845095d994006bca1401c3bf94ecb68
It seems reasonable to expect the error callback to have been delivered after awaiting flush; so I think we want to change the language around invoking the error callback to "queue a microtask":
https://html.spec.whatwg.org/multipage/webappapis.html#queue-a-microtask
Alternatively, we could invoke the error callback before rejecting pending flush promises.
Alternatively, we could invoke the error callback before rejecting pending flush promises.
I think that's what we should do
We generally tend to stay away from queuing micro tasks explicitly.
See discussion in web-platform-tests/interop#382 (comment) and web-platform-tests/interop#382 (comment), This would guarantee the flush promise to reject after the error callback is executed.
This turned out to be a bug in our implementation, so I don't think we need to change this after all.