зеркало из https://github.com/mozilla/gecko-dev.git
Bug 467972 - Load() invoked to do seek in onended results in sending onloadedmetadata; r=chris.double sr=roc
This commit is contained in:
Родитель
e04708dfff
Коммит
b6c86e257a
|
@ -1386,12 +1386,16 @@ void nsOggDecoder::MetadataLoaded()
|
|||
if (mShuttingDown)
|
||||
return;
|
||||
|
||||
// Only inform the element of MetadataLoaded if not doing a load() in order
|
||||
// to fulfill a seek, otherwise we'll get multiple metadataloaded events.
|
||||
PRBool notifyElement = PR_TRUE;
|
||||
{
|
||||
nsAutoMonitor mon(mMonitor);
|
||||
mDuration = mDecodeStateMachine ? mDecodeStateMachine->GetDuration() : -1;
|
||||
notifyElement = mNextState != PLAY_STATE_SEEKING;
|
||||
}
|
||||
|
||||
if (mElement) {
|
||||
if (mElement && notifyElement) {
|
||||
mElement->MetadataLoaded();
|
||||
}
|
||||
}
|
||||
|
@ -1400,8 +1404,16 @@ void nsOggDecoder::FirstFrameLoaded()
|
|||
{
|
||||
if (mShuttingDown)
|
||||
return;
|
||||
|
||||
// Only inform the element of FirstFrameLoaded if not doing a load() in order
|
||||
// to fulfill a seek, otherwise we'll get multiple loadedfirstframe events.
|
||||
PRBool notifyElement = PR_TRUE;
|
||||
{
|
||||
nsAutoMonitor mon(mMonitor);
|
||||
notifyElement = mNextState != PLAY_STATE_SEEKING;
|
||||
}
|
||||
|
||||
if (mElement) {
|
||||
if (mElement && notifyElement) {
|
||||
mElement->FirstFrameLoaded();
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,7 @@ _TEST_FILES = test_autoplay.html \
|
|||
test_ended1.html \
|
||||
test_ended2.html \
|
||||
test_networkState.html \
|
||||
test_onloadedmetadata.html \
|
||||
test_paused.html \
|
||||
test_readyState.html \
|
||||
test_seek1.html \
|
||||
|
|
|
@ -0,0 +1,88 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=467972
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 467972</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/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=467972">Mozilla Bug 467972</a>
|
||||
|
||||
<video id="v"
|
||||
src="320x240.ogg"
|
||||
onloadedmetadata="return loadedMetaData();"
|
||||
onended="playbackEnded();"
|
||||
onloadedfirstframe="return loadedFirstFrame();"
|
||||
onseeking="seekStarted();"
|
||||
onseeked="seekEnded();"
|
||||
controls></video>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 467972 **/
|
||||
|
||||
|
||||
var gEnded = false;
|
||||
var gSeekStarted = false;
|
||||
var gSeekEnded = false;
|
||||
var gLoadedFirstFrameCount = 0;
|
||||
var gLoadedMetaDataCount = 0;
|
||||
|
||||
function get(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
|
||||
function video() {
|
||||
return get('v');
|
||||
}
|
||||
|
||||
function seekStarted() {
|
||||
gSeekStarted = true;
|
||||
}
|
||||
|
||||
function seekEnded() {
|
||||
gSeekEnded = true;
|
||||
video().play();
|
||||
}
|
||||
|
||||
function loadedFirstFrame() {
|
||||
gLoadedFirstFrameCount++;
|
||||
ok(gLoadedFirstFrameCount <= 1, "No more than 1 onloadedfirstframe events");
|
||||
}
|
||||
|
||||
function loadedMetaData() {
|
||||
gLoadedMetaDataCount++;
|
||||
ok(gLoadedMetaDataCount <= 1, "No more than 1 onloadedmetadata events");
|
||||
video().play();
|
||||
return false;
|
||||
}
|
||||
|
||||
function playbackEnded() {
|
||||
if (!gEnded) {
|
||||
video().currentTime = 0;
|
||||
gEnded = true;
|
||||
} else {
|
||||
ok(gSeekEnded, "Should have received seekended");
|
||||
ok(gSeekStarted, "Should have received seekstarted");
|
||||
ok(gLoadedFirstFrameCount == 1, "Should have 1 onloadedfirstframe event");
|
||||
ok(gLoadedMetaDataCount == 1, "Should have 1 onloadedmetadata event");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче