Catch the rejected promise to avoid harness error

This commit is contained in:
CYBAI 2018-10-14 15:43:19 +08:00
parent 0284afc51a
commit 46b9f61417
3 changed files with 5 additions and 4 deletions

View file

@ -6,7 +6,7 @@
<script>
test(function(t) {
var v = document.createElement('video');
v.play(); // invokes resource selection and sets .paused to false
v.play().catch(() => {}); // invokes resource selection and sets .paused to false
assert_equals(v.networkState, v.NETWORK_NO_SOURCE, 'networkState');
assert_false(v.paused, 'paused');
v.setAttribute('src', ''); // invokes media load which sets .paused to true

View file

@ -12,7 +12,8 @@ async_test(function(t)
var v = doc.createElement("video");
doc.body.appendChild(v);
v.src = getVideoURI("/media/movie_5");
v.play();
v.play().catch(() => {});
v.addEventListener("timeupdate", t.step_func(function() {
assert_false(v.paused);
if (v.currentTime > 0) {