mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 448534. Make sure that the video stops when the element is removed from the document. r+sr=roc
This commit is contained in:
parent
049c383b84
commit
568a5251fd
@ -515,6 +515,9 @@ nsresult nsHTMLMediaElement::BindToTree(nsIDocument* aDocument, nsIContent* aPar
|
||||
void nsHTMLMediaElement::UnbindFromTree(PRBool aDeep,
|
||||
PRBool aNullParent)
|
||||
{
|
||||
if (!mPaused && mNetworkState != nsIDOMHTMLMediaElement::EMPTY)
|
||||
Pause();
|
||||
|
||||
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
|
||||
}
|
||||
|
||||
|
@ -143,10 +143,10 @@ nsresult nsHTMLVideoElement::BindToTree(nsIDocument* aDocument, nsIContent* aPar
|
||||
void nsHTMLVideoElement::UnbindFromTree(PRBool aDeep,
|
||||
PRBool aNullParent)
|
||||
{
|
||||
nsHTMLMediaElement::UnbindFromTree(aDeep, aNullParent);
|
||||
|
||||
if (mDecoder)
|
||||
mDecoder->ElementUnavailable();
|
||||
|
||||
nsHTMLMediaElement::UnbindFromTree(aDeep, aNullParent);
|
||||
}
|
||||
|
||||
nsresult nsHTMLVideoElement::InitializeDecoder(nsAString& aChosenMediaResource)
|
||||
|
BIN
content/media/video/test/320x240.ogg
Normal file
BIN
content/media/video/test/320x240.ogg
Normal file
Binary file not shown.
@ -53,6 +53,8 @@ _TEST_FILES = test_autoplay.html \
|
||||
test_playbackRate.html \
|
||||
test_readyState.html \
|
||||
test_start.html \
|
||||
test_bug448534.html \
|
||||
320x240.ogg \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
51
content/media/video/test/test_bug448534.html
Normal file
51
content/media/video/test/test_bug448534.html
Normal file
@ -0,0 +1,51 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=448534
|
||||
-->
|
||||
|
||||
<head>
|
||||
<title>Test for Bug 448534</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=448535">Mozilla Bug 448534</a>
|
||||
<!-- Ogg video obtained from Theora test suite: http://v2v.cc/~j/theora_testsuite/ -->
|
||||
<video id='v'
|
||||
src='320x240.ogg'
|
||||
onplay='return started();'
|
||||
onpause='return stopped();'></video>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var v = $('v');
|
||||
var played = false;
|
||||
var passed = false;
|
||||
function started() {
|
||||
ok(!v.paused, "Video should not be paused while playing");
|
||||
v.parentNode.removeChild(v);
|
||||
played = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function stopped() {
|
||||
ok(v.paused, "Video should be paused after removing from the Document");
|
||||
passed = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
ok(played, "Video did not send play event");
|
||||
ok(passed, "Video was not paused when removed from the Document");
|
||||
SimpleTest.finish();
|
||||
return false;
|
||||
}, 6000);
|
||||
|
||||
v.play();
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user