Bug 926665 - Clear mMediaSource when Attach fails. r=doublec.

This commit is contained in:
Matthew Gregan 2013-10-16 15:23:39 +13:00
parent 047acd439f
commit 8465bcf506
3 changed files with 29 additions and 2 deletions

View File

@ -1137,14 +1137,14 @@ nsresult HTMLMediaElement::LoadResource()
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
return rv;
}
mMediaSource = source.forget();
nsRefPtr<MediaSourceDecoder> decoder = new MediaSourceDecoder(this);
if (!mMediaSource->Attach(decoder)) {
if (!source->Attach(decoder)) {
// TODO: Handle failure: run "If the media data cannot be fetched at
// all, due to network errors, causing the user agent to give up
// trying to fetch the resource" section of resource fetch algorithm.
return NS_ERROR_FAILURE;
}
mMediaSource = source.forget();
nsRefPtr<MediaResource> resource = new MediaSourceResource();
return FinishDecoderSetup(decoder, resource, nullptr, nullptr);
}

View File

@ -0,0 +1,26 @@
<html>
<head>
<meta charset="UTF-8">
<script style="display: none;" id="fuzz1" type="text/javascript;version=1.7">
function boom()
{
var mediaSource = new window.MediaSource();
var mediaSourceURL = URL.createObjectURL(mediaSource);
var v1 = document.createElement('video');
v1.src = mediaSourceURL;
mediaSource.addEventListener("sourceopen", function (e) {
var v2 = document.createElement('video');
v2.src = mediaSourceURL;
setTimeout(function () {
v2.src = "data:text/plain,1";
v1.src = "data:text/plain,2";
}, 0);
});
}
</script>
</head>
<body onload="boom();"></body>
</html>

View File

@ -59,3 +59,4 @@ load 910171-1.html
load 920987.html
skip-if(B2G) load oscillator-ended-1.html # intermittent B2G timeouts, bug 920338
skip-if(B2G) load oscillator-ended-2.html # intermittent B2G timeouts, bug 920338
test-pref(media.mediasource.enabled,true) load 926665.html