Skip to content
Permalink
Browse files
Changing <video> src during 'ended' event can leave screen sleep disa…
…bled

https://bugs.webkit.org/show_bug.cgi?id=152018

Reviewed by Eric Carlson.

Resetting a HTMLMediaElement's src during 'ended' introduces a race condition: whether
the 'mediaPlayerRateChanged()' notification will fire before createMediaPlayer() destroys
the old MediaPlayer firing said notification.

To break the race condition, always update the sleep disabling assertion after destroying
the media player (by creating a new one).

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::createMediaPlayer):


Canonical link: https://commits.webkit.org/170177@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@193798 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
jernoble committed Dec 9, 2015
1 parent b8e8cff commit 28a48552790a440cae00190b6e43feaf802863e3
Showing with 19 additions and 0 deletions.
  1. +17 −0 Source/WebCore/ChangeLog
  2. +2 −0 Source/WebCore/html/HTMLMediaElement.cpp
@@ -1,3 +1,20 @@
2015-12-08 Jer Noble <jer.noble@apple.com>

Changing <video> src during 'ended' event can leave screen sleep disabled
https://bugs.webkit.org/show_bug.cgi?id=152018

Reviewed by Eric Carlson.

Resetting a HTMLMediaElement's src during 'ended' introduces a race condition: whether
the 'mediaPlayerRateChanged()' notification will fire before createMediaPlayer() destroys
the old MediaPlayer firing said notification.

To break the race condition, always update the sleep disabling assertion after destroying
the media player (by creating a new one).

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::createMediaPlayer):

2015-12-08 Brady Eidson <beidson@apple.com>

Modern IDB: Fire blocked events for delete requests that are blocked.
@@ -5790,6 +5790,8 @@ void HTMLMediaElement::createMediaPlayer()
enqueuePlaybackTargetAvailabilityChangedEvent(); // Ensure the event listener gets at least one event.
}
#endif

updateSleepDisabling();
}

#if ENABLE(WEB_AUDIO)

0 comments on commit 28a4855

Please sign in to comment.