Bug 485471. nsHTMLMediaElement's mChannel should be updated when redirects happen. r=bzbarsky,sr=roc

This commit is contained in:
Chris Pearce 2009-05-18 10:20:37 +12:00
parent ba13940408
commit f3be9df7f6
2 changed files with 20 additions and 0 deletions

View File

@ -311,6 +311,14 @@ protected:
*/
void ChangeDelayLoadStatus(PRBool aDelay);
/**
* Called when our channel is redirected to another channel.
* Updates our mChannel reference to aNewChannel.
*/
nsresult OnChannelRedirect(nsIChannel *aChannel,
nsIChannel *aNewChannel,
PRUint32 aFlags);
nsRefPtr<nsMediaDecoder> mDecoder;
// Holds a reference to the first channel we open to the media resource.

View File

@ -262,6 +262,8 @@ NS_IMETHODIMP nsHTMLMediaElement::MediaLoadListener::OnChannelRedirect(nsIChanne
nsIChannel* aNewChannel,
PRUint32 aFlags)
{
if (mElement)
mElement->OnChannelRedirect(aOldChannel, aNewChannel, aFlags);
nsCOMPtr<nsIChannelEventSink> sink = do_QueryInterface(mNextListener);
if (sink)
return sink->OnChannelRedirect(aOldChannel, aNewChannel, aFlags);
@ -345,6 +347,16 @@ NS_IMETHODIMP nsHTMLMediaElement::GetNetworkState(PRUint16 *aNetworkState)
return NS_OK;
}
nsresult
nsHTMLMediaElement::OnChannelRedirect(nsIChannel *aChannel,
nsIChannel *aNewChannel,
PRUint32 aFlags)
{
NS_ASSERTION(aChannel == mChannel, "Channels should match!");
mChannel = aNewChannel;
return NS_OK;
}
void nsHTMLMediaElement::AbortExistingLoads()
{
// Abort any already-running instance of the resource selection algorithm.