2009-07-30 Eric Carlson <eric.carlson@apple.com>

        Reviewed by Simon Fraser.

        Video elements fires another "load" event when attached to DOM
        https://bugs.webkit.org/show_bug.cgi?id=27623

        Test: media/media-load-event.html

        * html/HTMLMediaElement.cpp:
        (WebCore::HTMLMediaElement::insertedIntoDocument):
            Only schedule load when element's network state is NETWORK_EMPTY.

2009-07-30  Eric Carlson  <eric.carlson@apple.com>

        Reviewed by Simon Fraser.

        Video elements fires another "load" event when attached to DOM
        https://bugs.webkit.org/show_bug.cgi?id=27623

        * media/media-load-event-expected.txt: Added.
        * media/media-load-event.html: Added.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@46581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a8c2e78e
2009-07-30 Eric Carlson <eric.carlson@apple.com>
Reviewed by Simon Fraser.
Video elements fires another "load" event when attached to DOM
https://bugs.webkit.org/show_bug.cgi?id=27623
* media/media-load-event-expected.txt: Added.
* media/media-load-event.html: Added.
2009-07-29 Jian Li <jianli@chromium.org>
Reviewed by Darin Adler.
......
Test that media file is not reloaded when an element is inserted into the DOM.
RUN(media = document.createElement('audio'))
RUN(media.src = 'content/test.wav')
RUN(media.load())
EVENT(loadstart)
EVENT(durationchange)
EVENT(loadeddata)
EVENT(load)
RUN(document.getElementById('parent').appendChild(media))
RUN(media.play())
EVENT(play)
EVENT(playing)
END OF TEST
<html>
<head>
<script src=video-test.js></script>
<script>
function loaded()
{
consoleWrite("EVENT(load)");
consoleWrite("");
run("document.getElementById('parent').appendChild(media)");
run("media.play()");
window.setTimeout(endTest, 250);
consoleWrite("");
}
function start()
{
run("media = document.createElement('audio')");
media.onload = loaded;
waitForEvent("loadstart");
waitForEvent("waiting");
waitForEvent("ratechange");
waitForEvent("durationchange");
waitForEvent("pause");
waitForEvent("play");
waitForEvent("playing");
waitForEvent('loadeddata');
run("media.src = 'content/test.wav'");
run("media.load()");
consoleWrite("");
}
</script>
</head>
<body onload="start()">
<p>Test that media file is not reloaded when an element is inserted into the DOM.</p>
<div id="parent"></div>
</body>
</html>
2009-07-30 Eric Carlson <eric.carlson@apple.com>
Reviewed by Simon Fraser.
Video elements fires another "load" event when attached to DOM
https://bugs.webkit.org/show_bug.cgi?id=27623
Test: media/media-load-event.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::insertedIntoDocument):
Only schedule load when element's network state is NETWORK_EMPTY.
2009-07-30 Anton Muhin <antonm@chromium.org>
Reviewed by David Levin.
......
......@@ -234,7 +234,7 @@ RenderObject* HTMLMediaElement::createRenderer(RenderArena* arena, RenderStyle*)
void HTMLMediaElement::insertedIntoDocument()
{
HTMLElement::insertedIntoDocument();
if (!src().isEmpty())
if (!src().isEmpty() && m_networkState == NETWORK_EMPTY)
scheduleLoad();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment