<video> element delays document load event for ~ 3 seconds
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jun 2013 15:16:02 +0000 (15:16 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jun 2013 15:16:02 +0000 (15:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90272

Patch by Santosh Mahto <santosh.ma@samsung.com> on 2013-06-18
Reviewed by Eric Carlson.

Source/WebCore:

Test: media/media-preload-no-delay-loadevent.html

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::prepareForLoad):
No need to delay document load event here  when preload="none"

LayoutTests:

* media/media-preload-no-delay-loadevent-expected.txt: Added.
* media/media-preload-no-delay-loadevent.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/media/media-preload-no-delay-loadevent-expected.txt [new file with mode: 0644]
LayoutTests/media/media-preload-no-delay-loadevent.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/html/HTMLMediaElement.cpp

index 57a0d20..898629a 100644 (file)
@@ -1,3 +1,13 @@
+2013-06-18  Santosh Mahto  <santosh.ma@samsung.com>
+
+        <video> element delays document load event for ~ 3 seconds
+        https://bugs.webkit.org/show_bug.cgi?id=90272
+
+        Reviewed by Eric Carlson.
+
+        * media/media-preload-no-delay-loadevent-expected.txt: Added.
+        * media/media-preload-no-delay-loadevent.html: Added.
+
 2013-06-18  Gabor Abraham  <abrhm@inf.u-szeged.hu>
 
         [Qt] Unreviewed gardening. Rebaseline and skipping some tests.
diff --git a/LayoutTests/media/media-preload-no-delay-loadevent-expected.txt b/LayoutTests/media/media-preload-no-delay-loadevent-expected.txt
new file mode 100644 (file)
index 0000000..14a5aa6
--- /dev/null
@@ -0,0 +1 @@
+Document load event triggered: Load Time < 2s PASS
diff --git a/LayoutTests/media/media-preload-no-delay-loadevent.html b/LayoutTests/media/media-preload-no-delay-loadevent.html
new file mode 100644 (file)
index 0000000..67c3b59
--- /dev/null
@@ -0,0 +1,41 @@
+<html>
+<head>
+<script src=media-file.js></script>
+<script src=video-test.js></script>
+<script>
+var startTime = new Date().getTime();
+if (window.testRunner)
+    testRunner.waitUntilDone();
+
+function finish()
+{
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.notifyDone();
+    }
+}
+
+window.addEventListener('load', function()
+{
+    var endTime = new Date().getTime();
+    var loadTime = endTime - startTime;
+    if(loadTime > 2000)
+        document.getElementById('load-time').innerHTML = 'Load Time > 2s' + '  FAIL';
+    else
+        document.getElementById('load-time').innerHTML = 'Load Time < 2s' + '  PASS';
+    finish();
+}, false);
+
+</script>
+<body>
+
+<video id="video" controls preload="none">
+</video>
+<script>
+    var vid = document.getElementById('video');
+    vid.src = findMediaFile("video", "content/test.mp4");
+</script>
+<div>Document load event triggered: <span id="load-time">not yet</span></div>
+
+</body>
+</html>
index 838da96..a6833d1 100644 (file)
@@ -1,3 +1,16 @@
+2013-06-18  Santosh Mahto  <santosh.ma@samsung.com>
+
+        <video> element delays document load event for ~ 3 seconds
+        https://bugs.webkit.org/show_bug.cgi?id=90272
+
+        Reviewed by Eric Carlson.
+
+        Test: media/media-preload-no-delay-loadevent.html
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::prepareForLoad):
+        No need to delay document load event here  when preload="none"
+
 2013-06-18  Diego Pino Garcia  <dpino@igalia.com>
 
         [GTK] Remove comment about possibility of handling ObjCPolymorphic (it's used by ObjC bindings only)
index 38a3fb7..7f7b32e 100644 (file)
@@ -863,7 +863,8 @@ void HTMLMediaElement::prepareForLoad()
     // The spec doesn't say to block the load event until we actually run the asynchronous section
     // algorithm, but do it now because we won't start that until after the timer fires and the 
     // event may have already fired by then.
-    setShouldDelayLoadEvent(true);
+    if (m_preload != MediaPlayer::None)
+        setShouldDelayLoadEvent(true);
 
     configureMediaControls();
 }