mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 1415090. P1 - always move the channel back to the foreground when OnStopRequest() is fired. r=bechen,gerald
It is a good practice to make the call flow simplier. It also makes the changes in the following patches easier. MozReview-Commit-ID: CKjRBReLFro --HG-- extra : rebase_source : 1903b0648b718541af9f796dfa664209552f47d2 extra : intermediate-source : 12ffa8e5cb637dbb4d425d6b2ddae6c7574f767a extra : source : a1d92c67ec461f8fda88546fd1f0be0c00c39dc7
This commit is contained in:
parent
43f3a3faf6
commit
6021447a83
@ -380,6 +380,17 @@ ChannelMediaResource::OnStopRequest(nsIRequest* aRequest,
|
||||
|
||||
mChannelStatistics.Stop();
|
||||
|
||||
// Move this request back into the foreground. This is necessary for
|
||||
// requests owned by video documents to ensure the load group fires
|
||||
// OnStopRequest when restoring from session history.
|
||||
nsLoadFlags loadFlags;
|
||||
DebugOnly<nsresult> rv = mChannel->GetLoadFlags(&loadFlags);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "GetLoadFlags() failed!");
|
||||
|
||||
if (loadFlags & nsIRequest::LOAD_BACKGROUND) {
|
||||
ModifyLoadFlags(loadFlags & ~nsIRequest::LOAD_BACKGROUND);
|
||||
}
|
||||
|
||||
// Note that aStatus might have succeeded --- this might be a normal close
|
||||
// --- even in situations where the server cut us off because we were
|
||||
// suspended. So we need to "reopen on error" in that case too. The only
|
||||
@ -405,17 +416,6 @@ ChannelMediaResource::OnStopRequest(nsIRequest* aRequest,
|
||||
|
||||
mCacheStream.NotifyDataEnded(aStatus);
|
||||
|
||||
// Move this request back into the foreground. This is necessary for
|
||||
// requests owned by video documents to ensure the load group fires
|
||||
// OnStopRequest when restoring from session history.
|
||||
nsLoadFlags loadFlags;
|
||||
DebugOnly<nsresult> rv = mChannel->GetLoadFlags(&loadFlags);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "GetLoadFlags() failed!");
|
||||
|
||||
if (loadFlags & nsIRequest::LOAD_BACKGROUND) {
|
||||
ModifyLoadFlags(loadFlags & ~nsIRequest::LOAD_BACKGROUND);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user