Closed Bug 1467018 Opened 2 years ago Closed 2 years ago

More async/await in mediasource mochitests

Categories

(Core :: Audio/Video: Playback, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: jib, Assigned: jib)

References

Details

Attachments

(1 file)

+++ This bug was initially created as a clone of Bug #1462990 +++

I initially grepped for 'then' which missed a lot.

No need for fetchWithXHR() and once() helpers to still take a callback argument.
Comment on attachment 8983646 [details]
Bug 1467018 - Remove callback argument from fetchWithXHR() and once() helpers.

https://reviewboard.mozilla.org/r/249482/#review255786

::: dom/media/mediasource/test/test_BufferedSeek_mp4.html:30
(Diff revision 1)
> -      v.currentTime = target;
> +    v.currentTime = target;
> -    });
> +  });
>  
> -    let wasSeeking = false;
> +  let wasSeeking = false;
>  
> -    v.addEventListener("seeking", function() {
> +  v.addEventListener("seeking", function() {

To be consistent with some of the other changes this could go from `function()` to `() =>` or `await once(...)`

::: dom/media/mediasource/test/test_HaveMetadataUnbufferedSeek.html:31
(Diff revision 1)
> -    }, {once: true});
>  
> -    v.addEventListener("seeking", function() {
> +  await once(v, "seeking");
> -      is(v.readyState, v.HAVE_METADATA, "readyState is HAVE_METADATA");
> +  is(v.readyState, v.HAVE_METADATA, "readyState is HAVE_METADATA");
> -      fetchWithXHR("seek.webm", function(arrayBuffer) {
> -        sb.appendBuffer(new Uint8Array(arrayBuffer, 67833));
> +  sb.appendBuffer(new Uint8Array(await fetchWithXHR("seek.webm"), 67833));
> +  await once(v, "seeked");

Note that the timing here has become more strict on when our handlers are added (and even more so in the similar mp4 test). I think it's okay given when the duration changes are seen by the HTMLMediaElement allowing these seeks to happen, and when `seeked` is fired, but wanted to point it out should we see any changes in the test behaviour following landing.

::: dom/media/mediasource/test/test_MediaSource.html:36
(Diff revision 1)
>    let updatestartCount = 0;
>    let updateendCount = 0;
>    let updateCount = 0;
>  
>    ok(MediaSource.isTypeSupported("video/webm; codecs=vp8"), "VP8 MSE is always supported");
> -  ok(MediaSource.isTypeSupported("audio/webm", "Audio MSE is always supported"));
> +  ok(MediaSource.isTypeSupported("audio/webm"), "Audio MSE is always supported");

Nice catch
Attachment #8983646 - Flags: review?(bvandyk) → review+
Pushed by jbruaroey@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d5fbac7b5457
Remove callback argument from fetchWithXHR() and once() helpers. r=bryce
https://hg.mozilla.org/mozilla-central/rev/d5fbac7b5457
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.