Reviewed by Adam.
- Fix a crash when removing a loading media element from the tree.
- Follow the spec by invoking pause() when element is removed from the tree instead of unloading.
Tests: http/tests/media/remove-while-loading.html
media/remove-from-document.html
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::removedFromDocument):
LayoutTests:
Reviewed by Adam.
Test that removing a media element when it is loading does not crash.
Test that media is paused when it is removed from the tree.
* http/tests/media/remove-while-loading-expected.txt: Added.
* http/tests/media/remove-while-loading.html: Added.
* media/remove-from-document-expected.txt: Added.
* media/remove-from-document.html: Added.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28312
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-12-01 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Adam.
+
+ Test that removing a media element when it is loading does not crash.
+ Test that media is paused when it is removed from the tree.
+
+ * http/tests/media/remove-while-loading-expected.txt: Added.
+ * http/tests/media/remove-while-loading.html: Added.
+ * media/remove-from-document-expected.txt: Added.
+ * media/remove-from-document.html: Added.
+
2007-12-01 Julien Chaffraix <julien.chaffraix@gmail.com>
Bug 16189: XMLHttpRequest::setRequestHeader() should not set certain headers
--- /dev/null
+Test that removing a media element from the tree while loading does not crash.
+
+EVENT(loadedmetadata)
+RUN(document.body.removeChild(video))
+END OF TEST
+
--- /dev/null
+<video></video>
+<p>Test that removing a media element from the tree while loading does not crash.</p>
+<script src=../../../media/video-test.js></script>
+<script>
+waitForEvent('loadedmetadata', function () {
+ run("document.body.removeChild(video)");
+ endTestLater();
+} );
+video.src = "http://127.0.0.1:8000/media/video-load-and-stall.cgi?name=../../../media/content/test.mp4&stallAt=80000";
+</script>
--- /dev/null
+Test that removing a media element from the tree pauses playback but does not unload the media.
+
+EVENT(load)
+TEST(video.networkState == HTMLMediaElement.LOADED) OK
+TEST(!video.paused) OK
+RUN(document.body.removeChild(video))
+TEST(video.networkState == HTMLMediaElement.LOADED) OK
+TEST(video.paused) OK
+END OF TEST
+
--- /dev/null
+<video controls></video>
+<p>Test that removing a media element from the tree pauses playback but does not unload the media.</p>
+<script src=video-test.js></script>
+<script>
+waitForEvent('load', function () {
+ test("video.networkState == HTMLMediaElement.LOADED");
+ test("!video.paused");
+ run("document.body.removeChild(video)");
+ test("video.networkState == HTMLMediaElement.LOADED");
+ test("video.paused");
+ endTest();
+} );
+video.src = "content/test.mp4";
+video.play();
+</script>
+2007-12-01 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Adam.
+
+ - Fix crash when removing a loading media element from the tree.
+ - Follow the spec by invoking pause() when element is removed from the tree instead of unloading.
+
+ Tests: http/tests/media/remove-while-loading.html
+ media/remove-from-document.html
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::removedFromDocument):
+
2007-12-01 Geoffrey Garen <ggaren@apple.com>
Reviewed by Beth Dakin.
void HTMLMediaElement::removedFromDocument()
{
- delete m_movie;
- m_movie = 0;
+ // FIXME: pause() may invoke load() which seem like a strange thing to do as a side effect
+ // of removing an element. This might need to be fixed in the spec.
+ ExceptionCode ec;
+ pause(ec);
HTMLElement::removedFromDocument();
}