mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 898952 - Media Recording - Avoid to record a stopped MediaStream. r=roc
This commit is contained in:
parent
a98d95a71e
commit
2f37b2b995
@ -166,6 +166,11 @@ MediaRecorder::Start(const Optional<int32_t>& aTimeSlice, ErrorResult& aResult)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mStream->GetStream()->IsFinished() || mStream->GetStream()->IsDestroyed()) {
|
||||||
|
aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (aTimeSlice.WasPassed()) {
|
if (aTimeSlice.WasPassed()) {
|
||||||
if (aTimeSlice.Value() < 0) {
|
if (aTimeSlice.Value() < 0) {
|
||||||
aResult.Throw(NS_ERROR_INVALID_ARG);
|
aResult.Throw(NS_ERROR_INVALID_ARG);
|
||||||
|
@ -117,6 +117,7 @@ MOCHITEST_FILES = \
|
|||||||
test_audiowrite.html \
|
test_audiowrite.html \
|
||||||
test_mediarecorder_creation.html \
|
test_mediarecorder_creation.html \
|
||||||
test_mediarecorder_record_audiocontext.html \
|
test_mediarecorder_record_audiocontext.html \
|
||||||
|
test_mediarecorder_record_stopms.html \
|
||||||
test_mozHasAudio.html \
|
test_mozHasAudio.html \
|
||||||
test_source_media.html \
|
test_source_media.html \
|
||||||
test_autoplay_contentEditable.html \
|
test_autoplay_contentEditable.html \
|
||||||
|
47
content/media/test/test_mediarecorder_record_stopms.html
Normal file
47
content/media/test/test_mediarecorder_record_stopms.html
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Test MediaRecorder Record Stopped Stream</title>
|
||||||
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<pre id="test">
|
||||||
|
<div id="content" style="display: none">
|
||||||
|
<audio id="testAudio"></audio>
|
||||||
|
</div>
|
||||||
|
<script class="testbody" type="text/javascript">
|
||||||
|
|
||||||
|
function startTest() {
|
||||||
|
navigator.mozGetUserMedia({audio: true, fake: true}, function(stream) {
|
||||||
|
var testAudio = document.getElementById('testAudio');
|
||||||
|
|
||||||
|
testAudio.onended = function() {
|
||||||
|
var mediaRecorder = new MediaRecorder(stream);
|
||||||
|
try {
|
||||||
|
mediaRecorder.start();
|
||||||
|
ok(false, 'Recording a stopped stream failed to throw an exception');
|
||||||
|
} catch (e) {
|
||||||
|
is(e.name, 'InvalidStateError',
|
||||||
|
'Recording a stopped stream threw an InvalidStateError');
|
||||||
|
} finally {
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
testAudio.mozSrcObject = stream;
|
||||||
|
testAudio.play();
|
||||||
|
stream.stop();
|
||||||
|
}, function(err) {
|
||||||
|
ok(false, 'Unexpected error fired with: ' + err);
|
||||||
|
SimpleTest.finish();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
startTest();
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user