2011-03-14 Joseph Pecoraro <joepeck@webkit.org>
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 04:11:30 +0000 (04:11 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 15 Mar 2011 04:11:30 +0000 (04:11 +0000)
        Reviewed by Eric Carlson.

        Stalled media elements don't stop delaying the load event
        https://bugs.webkit.org/show_bug.cgi?id=56316

        * http/tests/media/video-play-stall-before-meta-data-expected.txt: Added.
        * http/tests/media/video-play-stall-before-meta-data.html: Added.
2011-03-14  Joseph Pecoraro  <joepeck@webkit.org>

        Reviewed by Eric Carlson.

        Stalled media elements don't stop delaying the load event
        https://bugs.webkit.org/show_bug.cgi?id=56316

        We should stop delaying the load event when the load has
        stalled naturally, or if we require a user gesture to
        continue the load.

        Test: http/tests/media/video-play-stall-before-meta-data.html

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::setNetworkState): when suspending, stop delaying.
        (WebCore::HTMLMediaElement::progressEventTimerFired): when stalling, stop delaying.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@81104 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/http/tests/media/video-play-stall-before-meta-data-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/media/video-play-stall-before-meta-data.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp

index 728c3b2..52e28cf 100644 (file)
@@ -1,3 +1,13 @@
+2011-03-14  Joseph Pecoraro  <joepeck@webkit.org>
+
+        Reviewed by Eric Carlson.
+
+        Stalled media elements don't stop delaying the load event
+        https://bugs.webkit.org/show_bug.cgi?id=56316
+
+        * http/tests/media/video-play-stall-before-meta-data-expected.txt: Added.
+        * http/tests/media/video-play-stall-before-meta-data.html: Added.
+
 2011-03-13  MORITA Hajime  <morrita@google.com>
 
         Reviewed by Tony Chang.
diff --git a/LayoutTests/http/tests/media/video-play-stall-before-meta-data-expected.txt b/LayoutTests/http/tests/media/video-play-stall-before-meta-data-expected.txt
new file mode 100644 (file)
index 0000000..5881008
--- /dev/null
@@ -0,0 +1,8 @@
+Test that stalling very early, while loading meta-data, stops delaying the load event.
+
+EVENT(beforeload)
+EVENT(loadstart)
+EVENT(stalled)
+EVENT(window.onload)
+END OF TEST
+
diff --git a/LayoutTests/http/tests/media/video-play-stall-before-meta-data.html b/LayoutTests/http/tests/media/video-play-stall-before-meta-data.html
new file mode 100644 (file)
index 0000000..6d63835
--- /dev/null
@@ -0,0 +1,21 @@
+<video></video>
+<p>Test that stalling very early, while loading meta-data, stops delaying the load event.</p>
+<script src=../../media-resources/video-test.js></script>
+<script>
+
+    // Expected events.
+    waitForEvent("beforeload");
+    waitForEvent("loadstart");
+    waitForEvent("stalled");
+    waitForEvent("suspend");
+
+    // We want to make sure the onload event fires.
+    window.onload = function() {
+       consoleWrite("EVENT(window.onload)");
+       endTest();
+    };
+
+    // Load should stall very early in the loading process.
+    video.src = "http://127.0.0.1:8000/media/video-load-and-stall.cgi?name=../../../media/content/test.mp4&stallAt=1";
+
+</script>
index b97db73..2ed8bf2 100644 (file)
@@ -1,3 +1,20 @@
+2011-03-14  Joseph Pecoraro  <joepeck@webkit.org>
+
+        Reviewed by Eric Carlson.
+
+        Stalled media elements don't stop delaying the load event
+        https://bugs.webkit.org/show_bug.cgi?id=56316
+
+        We should stop delaying the load event when the load has
+        stalled naturally, or if we require a user gesture to
+        continue the load.
+
+        Test: http/tests/media/video-play-stall-before-meta-data.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::setNetworkState): when suspending, stop delaying.
+        (WebCore::HTMLMediaElement::progressEventTimerFired): when stalling, stop delaying.
+
 2011-03-13  MORITA Hajime  <morrita@google.com>
 
         Reviewed by Tony Chang.
index 7bc48ca..41ad65d 100644 (file)
@@ -896,6 +896,7 @@ void HTMLMediaElement::setNetworkState(MediaPlayer::NetworkState state)
         if (m_networkState > NETWORK_IDLE) {
             m_progressEventTimer.stop();
             scheduleEvent(eventNames().suspendEvent);
+            setShouldDelayLoadEvent(false);
         }
         m_networkState = NETWORK_IDLE;
     }
@@ -1027,6 +1028,7 @@ void HTMLMediaElement::progressEventTimerFired(Timer<HTMLMediaElement>*)
         if (timedelta > 3.0 && !m_sentStalledEvent) {
             scheduleEvent(eventNames().stalledEvent);
             m_sentStalledEvent = true;
+            setShouldDelayLoadEvent(false);
         }
     } else {
         scheduleEvent(eventNames().progressEvent);