Bug 1648132 - Do not allow setting new listener after we handle all the IPCs before SendOnStartReqeust, r=kershaw

HttpChannelChild::OnStartRequest should copy argument only since HttpChannelChild::RecvAttachStreamFilter, who sets new listener, could be after OnStartRequest.

Differential Revision: https://phabricator.services.mozilla.com/D80964
This commit is contained in:
Junior Hsu 2020-06-24 21:38:57 +00:00
Родитель c5f74d8b96
Коммит 8a0ff94b82
1 изменённых файлов: 7 добавлений и 2 удалений

Просмотреть файл

@ -460,6 +460,8 @@ void HttpChannelChild::OnStartRequest(
return;
}
// Copy arguments only. It's possible to handle other IPC between
// OnStartRequest and DoOnStartRequest.
mComputedCrossOriginOpenerPolicy = aArgs.openerPolicy();
if (!mCanceled && NS_SUCCEEDED(mStatus)) {
@ -514,8 +516,6 @@ void HttpChannelChild::OnStartRequest(
//
// gHttpHandler->OnExamineResponse(this);
mTracingEnabled = false;
ResourceTimingStructArgsToTimingsStruct(aArgs.timing(), mTransactionTimings);
mAllRedirectsSameOrigin = aArgs.allRedirectsSameOrigin();
@ -658,6 +658,11 @@ void HttpChannelChild::DoOnStartRequest(nsIRequest* aRequest,
LOG(("HttpChannelChild::DoOnStartRequest [this=%p]\n", this));
// We handle all the listener chaining before OnStartRequest at this moment.
// Prevent additional listeners being added to the chain after the request
// as started.
mTracingEnabled = false;
// mListener could be null if the redirect setup is not completed.
MOZ_ASSERT(mListener || mOnStartRequestCalled);
if (!mListener) {