Modified: trunk/Source/WebCore/ChangeLog (200038 => 200039)
--- trunk/Source/WebCore/ChangeLog 2016-04-25 19:08:53 UTC (rev 200038)
+++ trunk/Source/WebCore/ChangeLog 2016-04-25 19:37:17 UTC (rev 200039)
@@ -1,3 +1,21 @@
+2016-04-25 Eric Carlson <eric.carl...@apple.com>
+
+ Stop listening for "media can start" notifications when media player is cleared
+ https://bugs.webkit.org/show_bug.cgi?id=156985
+ <rdar://problem/23158505>
+
+ Reviewed by Jer Noble.
+
+ No new tests, I have not been able to create a test that reliably reproduces this.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::loadInternal): Add logging.
+ (WebCore::HTMLMediaElement::selectMediaResource): Assert and return early if there is
+ no media player.
+ (WebCore::HTMLMediaElement::clearMediaPlayer): Stop listening for can start notifications.
+ (WebCore::HTMLMediaElement::visibilityStateChanged): Add logging.
+ (WebCore::HTMLMediaElement::mediaCanStart): Ditto.
+
2016-04-25 Chris Dumez <cdu...@apple.com>
[Web IDL] Specify default values for parameters of type 'unsigned short'
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (200038 => 200039)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-04-25 19:08:53 UTC (rev 200038)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-04-25 19:37:17 UTC (rev 200039)
@@ -1138,6 +1138,8 @@
void HTMLMediaElement::loadInternal()
{
+ LOG(Media, "HTMLMediaElement::loadInternal(%p)", this);
+
// Some of the code paths below this function dispatch the BeforeLoad event. This ASSERT helps
// us catch those bugs more quickly without needing all the branches to align to actually
// trigger the event.
@@ -1145,11 +1147,12 @@
// If we can't start a load right away, start it later.
if (!m_mediaSession->pageAllowsDataLoading(*this)) {
+ LOG(Media, "HTMLMediaElement::loadInternal(%p) - not allowed to load in background, waiting", this);
setShouldDelayLoadEvent(false);
if (m_isWaitingUntilMediaCanStart)
return;
+ m_isWaitingUntilMediaCanStart = true;
document().addMediaCanStartListener(this);
- m_isWaitingUntilMediaCanStart = true;
return;
}
@@ -1185,6 +1188,10 @@
{
LOG(Media, "HTMLMediaElement::selectMediaResource(%p)", this);
+ ASSERT(m_player);
+ if (!m_player)
+ return;
+
enum Mode { attribute, children };
// 3 - If the media element has a src attribute, then let mode be attribute.
@@ -4994,6 +5001,11 @@
}
#endif
+ if (m_isWaitingUntilMediaCanStart) {
+ m_isWaitingUntilMediaCanStart = false;
+ document().removeMediaCanStartListener(this);
+ }
+
m_player = nullptr;
stopPeriodicTimers();
@@ -5139,8 +5151,8 @@
void HTMLMediaElement::visibilityStateChanged()
{
- LOG(Media, "HTMLMediaElement::visibilityStateChanged(%p)", this);
m_elementIsHidden = document().hidden();
+ LOG(Media, "HTMLMediaElement::visibilityStateChanged(%p) - visible = %s", this, boolString(!m_elementIsHidden));
updateSleepDisabling();
m_mediaSession->visibilityChanged();
}
@@ -5584,7 +5596,8 @@
void HTMLMediaElement::mediaCanStart()
{
- LOG(Media, "HTMLMediaElement::mediaCanStart(%p)", this);
+ LOG(Media, "HTMLMediaElement::mediaCanStart(%p) - m_isWaitingUntilMediaCanStart = %s, m_pausedInternal = %s",
+ this, boolString(m_isWaitingUntilMediaCanStart), boolString(m_pausedInternal) );
ASSERT(m_isWaitingUntilMediaCanStart || m_pausedInternal);
if (m_isWaitingUntilMediaCanStart) {