Bug 1642303 - Keep channel of FetchPreloader even after the load has finished to let preload consumers use that channel early after opening, r=baku

Differential Revision: https://phabricator.services.mozilla.com/D78729
This commit is contained in:
Honza Bambas
2020-06-10 14:21:56 +00:00
parent e4296af9ab
commit cd05f96111
4 changed files with 14 additions and 23 deletions

View File

@@ -1803,11 +1803,6 @@ NS_IMETHODIMP
XMLHttpRequestMainThread::OnStartRequest(nsIRequest* request) {
AUTO_PROFILER_LABEL("XMLHttpRequestMainThread::OnStartRequest", NETWORK);
if (mFromPreload && !mChannel) {
mChannel = do_QueryInterface(request);
EnsureChannelContentType();
}
nsresult rv = NS_OK;
if (!mFirstStartRequestSeen && mRequestObserver) {
mFirstStartRequestSeen = true;
@@ -2521,9 +2516,8 @@ nsresult XMLHttpRequestMainThread::InitiateFetch(
// May be null when the preload has already finished, but the XHR code
// is safe to live with it.
mChannel = preload->Channel();
if (mChannel) {
EnsureChannelContentType();
}
MOZ_ASSERT(mChannel);
EnsureChannelContentType();
return NS_OK;
}