Bug 90272 - <video> element delays document load event for ~ 3 seconds
Summary: <video> element delays document load event for ~ 3 seconds
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL: http://steffenweber.net/chrome-video-...
Depends on:
Reported: 2012-06-29 04:38 PDT by Steffen Weber
Modified: 2013-06-18 08:48 PDT (History)
9 users (show)

See Also:

Patch (3.61 KB, patch)
2013-06-13 04:35 PDT, Santosh Mahto
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion (556.51 KB, application/zip)
2013-06-13 07:06 PDT, Build Bot
no flags Details
Patch (3.93 KB, patch)
2013-06-13 21:36 PDT, Santosh Mahto
no flags Details | Formatted Diff | Diff
Patch (3.98 KB, patch)
2013-06-16 01:48 PDT, Santosh Mahto
no flags Details | Formatted Diff | Diff
patch for landing (3.98 KB, patch)
2013-06-16 01:58 PDT, Santosh Mahto
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Steffen Weber 2012-06-29 04:38:35 PDT
If the video element has a source then it delays the document's load event for about 3 seconds even though the attribute preload="none" has been set.

Test case: http://steffenweber.net/chrome-video-document-load-delay/video.html

Expected result: The document load event should fire without noticeable delay.
What happens instead? The document load event is delayed by ~ 3 seconds.

UserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.43 Safari/536.11

The problem is not limited to Linux, it occurs on Windows and Mac OS X, too.
Comment 1 Steffen Weber 2012-07-04 02:27:33 PDT
The latest Chrome Nightly for Windows (22.0.1194.1 canary) is affected, too.
Comment 2 Steffen Weber 2013-03-14 09:17:29 PDT
Bug still exists in Chrome 26.0.1410.33 beta (WebKit 537.31)
Comment 3 Santosh Mahto 2013-06-13 04:35:29 PDT
Created attachment 204573 [details]
Comment 4 Build Bot 2013-06-13 07:06:28 PDT
Comment on attachment 204573 [details]

Attachment 204573 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/847142

New failing tests:
Comment 5 Build Bot 2013-06-13 07:06:30 PDT
Created attachment 204583 [details]
Archive of layout-test-results from webkit-ews-03 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-03  Port: mac-mountainlion  Platform: Mac OS X 10.8.3
Comment 6 Eric Carlson 2013-06-13 08:13:30 PDT
Comment on attachment 204573 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=204573&action=review

> LayoutTests/media/media-preload-no-delay-loadevent.html:8
> +function finish(){

Nit: a function's opening brace should be on a new line.

> LayoutTests/media/media-preload-no-delay-loadevent.html:12
> +		}

Eek, a tab!

> LayoutTests/media/media-preload-no-delay-loadevent.html:22
> +		document.getElementById('load-time').innerHTML = loadTime + '  PASS';

Logging the time it takes to load will make this test flakey because not all bots run at the same speed.

> LayoutTests/media/media-preload-no-delay-loadevent.html:30
> +	<source src="void.mp4">

This test should use a valid media file that can be loaded by the platform being tested. See how other tests use "findMediaFile" to choose a platform appropriate test file.
Comment 7 Santosh Mahto 2013-06-13 21:36:28 PDT
Created attachment 204669 [details]
Comment 8 Eric Carlson 2013-06-14 07:30:50 PDT
Comment on attachment 204669 [details]

View in context: https://bugs.webkit.org/attachment.cgi?id=204669&action=review

> Source/WebCore/ChangeLog:11
> +        (WebCore::HTMLMediaElement::prepareForLoad):

Nit: I think it is useful to have per-method comments so it is easier to understand what changed when reading the ChangeLog later.

> LayoutTests/media/media-preload-no-delay-loadevent.html:8
> +        testRunner.waitUntilDone();

Nit: double indent

> LayoutTests/media/media-preload-no-delay-loadevent.html:37
> +    var source = document.getElementById('source');
> +    source.src = findMediaFile("video", "content/test.mp4");

Nit: there is no need to use a <source> element when only one media url is used.
Comment 9 Santosh Mahto 2013-06-16 01:48:11 PDT
Created attachment 204783 [details]
Comment 10 Santosh Mahto 2013-06-16 01:58:02 PDT
Created attachment 204784 [details]
patch for landing
Comment 11 Santosh Mahto 2013-06-16 02:03:22 PDT
review+ by  Eric Carlson
Comment 12 Santosh Mahto 2013-06-18 05:56:06 PDT
Done all the requested changes
I uploaded the patch for landing 
please have a look.
Comment 13 WebKit Commit Bot 2013-06-18 08:16:20 PDT
Comment on attachment 204784 [details]
patch for landing

Clearing flags on attachment: 204784

Committed r151684: <http://trac.webkit.org/changeset/151684>
Comment 14 WebKit Commit Bot 2013-06-18 08:16:22 PDT
All reviewed patches have been landed.  Closing bug.
Comment 15 Steffen Weber 2013-06-18 08:48:24 PDT