Bug 560806 - No duration or seeking on Ogg video URL's that redirect - r=roc (CLOSED TREE)

This commit is contained in:
Chris Double 2010-04-22 12:32:52 +12:00
parent bc56aab89c
commit 7d3964aa08
2 changed files with 23 additions and 0 deletions

View File

@ -441,6 +441,25 @@ nsHTMLMediaElement::OnChannelRedirect(nsIChannel *aChannel,
{
NS_ASSERTION(aChannel == mChannel, "Channels should match!");
mChannel = aNewChannel;
// Handle forwarding of Range header so that the intial detection
// of seeking support (via result code 206) works across redirects.
nsCOMPtr<nsIHttpChannel> http = do_QueryInterface(aChannel);
NS_ENSURE_STATE(http);
NS_NAMED_LITERAL_CSTRING(rangeHdr, "Range");
nsCAutoString rangeVal;
if (NS_SUCCEEDED(http->GetRequestHeader(rangeHdr, rangeVal))) {
NS_ENSURE_STATE(!rangeVal.IsEmpty());
http = do_QueryInterface(aNewChannel);
NS_ENSURE_STATE(http);
nsresult rv = http->SetRequestHeader(rangeHdr, rangeVal, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
}
return NS_OK;
}

View File

@ -75,6 +75,10 @@ var gPlayTests = [
{ name:"audio-overhang.ogg", type:"audio/ogg", duration:2.3 },
{ name:"video-overhang.ogg", type:"audio/ogg", duration:3.966 },
// Test playback/metadata work after a redirect
{ name:"redirect.sjs?http://mochi.test:8888/tests/content/media/test/320x240.ogv",
type:"video/ogg", duration:0.233 },
{ name:"bogus.duh", type:"bogus/duh" }
];