mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 05:15:45 +00:00
Backed out changeset 35fc92e75cf7 (bug 1412007) for failing broswer-chrome browser_bug676619.js r=backout on a CLOSED TREE
This commit is contained in:
parent
a859e870fe
commit
270d55d17d
@ -173,7 +173,7 @@ HttpChannelChild::HttpChannelChild()
|
||||
, mKeptAlive(false)
|
||||
, mUnknownDecoderInvolved(false)
|
||||
, mDivertingToParent(false)
|
||||
, mFlushedForDiversion(eNotFlushed)
|
||||
, mFlushedForDiversion(false)
|
||||
, mSuspendSent(false)
|
||||
, mSynthesizedResponse(false)
|
||||
, mShouldInterceptSubsequentRedirect(false)
|
||||
@ -493,7 +493,7 @@ HttpChannelChild::RecvOnStartRequest(const nsresult& channelStatus,
|
||||
LOG(("HttpChannelChild::RecvOnStartRequest [this=%p]\n", this));
|
||||
// mFlushedForDiversion and mDivertingToParent should NEVER be set at this
|
||||
// stage, as they are set in the listener's OnStartRequest.
|
||||
MOZ_RELEASE_ASSERT(mFlushedForDiversion == eNotFlushed,
|
||||
MOZ_RELEASE_ASSERT(!mFlushedForDiversion,
|
||||
"mFlushedForDiversion should be unset before OnStartRequest!");
|
||||
MOZ_RELEASE_ASSERT(!mDivertingToParent,
|
||||
"mDivertingToParent should be unset before OnStartRequest!");
|
||||
@ -554,7 +554,7 @@ HttpChannelChild::OnStartRequest(const nsresult& channelStatus,
|
||||
|
||||
// mFlushedForDiversion and mDivertingToParent should NEVER be set at this
|
||||
// stage, as they are set in the listener's OnStartRequest.
|
||||
MOZ_RELEASE_ASSERT(mFlushedForDiversion == eNotFlushed,
|
||||
MOZ_RELEASE_ASSERT(!mFlushedForDiversion,
|
||||
"mFlushedForDiversion should be unset before OnStartRequest!");
|
||||
MOZ_RELEASE_ASSERT(!mDivertingToParent,
|
||||
"mDivertingToParent should be unset before OnStartRequest!");
|
||||
@ -615,6 +615,8 @@ HttpChannelChild::OnStartRequest(const nsresult& channelStatus,
|
||||
DoOnStartRequest(this, mListenerContext);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class SyntheticDiversionListener final : public nsIStreamListener
|
||||
{
|
||||
RefPtr<HttpChannelChild> mChannel;
|
||||
@ -642,7 +644,6 @@ public:
|
||||
nsresult aStatus) override
|
||||
{
|
||||
mChannel->SendDivertOnStopRequest(aStatus);
|
||||
mChannel->MaybeSendDivertComplete();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -667,6 +668,8 @@ public:
|
||||
|
||||
NS_IMPL_ISUPPORTS(SyntheticDiversionListener, nsIStreamListener);
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
void
|
||||
HttpChannelChild::DoOnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
|
||||
{
|
||||
@ -766,7 +769,7 @@ HttpChannelChild::ProcessOnTransportAndData(const nsresult& aChannelStatus,
|
||||
{
|
||||
LOG(("HttpChannelChild::ProcessOnTransportAndData [this=%p]\n", this));
|
||||
MOZ_ASSERT(OnSocketThread());
|
||||
MOZ_RELEASE_ASSERT(mFlushedForDiversion == eNotFlushed,
|
||||
MOZ_RELEASE_ASSERT(!mFlushedForDiversion,
|
||||
"Should not be receiving any more callbacks from parent!");
|
||||
mEventQ->RunOrEnqueue(new TransportAndDataEvent(this, aChannelStatus,
|
||||
aTransportStatus, aData,
|
||||
@ -825,7 +828,7 @@ HttpChannelChild::OnTransportAndData(const nsresult& channelStatus,
|
||||
// For diversion to parent, just SendDivertOnDataAvailable.
|
||||
if (mDivertingToParent) {
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_RELEASE_ASSERT(mFlushedForDiversion == eNotFlushed,
|
||||
MOZ_RELEASE_ASSERT(!mFlushedForDiversion,
|
||||
"Should not be processing any more callbacks from parent!");
|
||||
|
||||
SendDivertOnDataAvailable(data, offset, count);
|
||||
@ -994,7 +997,7 @@ HttpChannelChild::ProcessOnStopRequest(const nsresult& aChannelStatus,
|
||||
{
|
||||
LOG(("HttpChannelChild::ProcessOnStopRequest [this=%p]\n", this));
|
||||
MOZ_ASSERT(OnSocketThread());
|
||||
MOZ_RELEASE_ASSERT(mFlushedForDiversion == eNotFlushed,
|
||||
MOZ_RELEASE_ASSERT(!mFlushedForDiversion,
|
||||
"Should not be receiving any more callbacks from parent!");
|
||||
|
||||
mEventQ->RunOrEnqueue(new StopRequestEvent(this, aChannelStatus, aTiming),
|
||||
@ -1028,27 +1031,9 @@ HttpChannelChild::MaybeDivertOnStop(const nsresult& aChannelStatus)
|
||||
static_cast<uint32_t>(aChannelStatus)));
|
||||
if (mDivertingToParent) {
|
||||
SendDivertOnStopRequest(aChannelStatus);
|
||||
MaybeSendDivertComplete();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HttpChannelChild::MaybeSendDivertComplete()
|
||||
{
|
||||
if (mFlushedForDiversion == eNotFlushed) {
|
||||
mFlushedForDiversion = eReadyToBeFlushed;
|
||||
return;
|
||||
}
|
||||
|
||||
if (mFlushedForDiversion == ePendingToBeFlushed) {
|
||||
mFlushedForDiversion = eFlushed;
|
||||
SendDivertComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
MOZ_CRASH("We should not be already in this state!");
|
||||
}
|
||||
|
||||
void
|
||||
HttpChannelChild::OnStopRequest(const nsresult& channelStatus,
|
||||
const ResourceTimingStruct& timing)
|
||||
@ -1058,11 +1043,10 @@ HttpChannelChild::OnStopRequest(const nsresult& channelStatus,
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (mDivertingToParent) {
|
||||
MOZ_RELEASE_ASSERT(mFlushedForDiversion == eNotFlushed,
|
||||
MOZ_RELEASE_ASSERT(!mFlushedForDiversion,
|
||||
"Should not be processing any more callbacks from parent!");
|
||||
|
||||
SendDivertOnStopRequest(channelStatus);
|
||||
MaybeSendDivertComplete();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1862,13 +1846,9 @@ HttpChannelChild::FlushedForDiversion()
|
||||
// Once this is set, it should not be unset before HttpChannelChild is taken
|
||||
// down. After it is set, no OnStart/OnData/OnStop callbacks should be
|
||||
// received from the parent channel, nor dequeued from the ChannelEventQueue.
|
||||
mFlushedForDiversion = true;
|
||||
|
||||
if (mFlushedForDiversion == eReadyToBeFlushed) {
|
||||
mFlushedForDiversion = eFlushed;
|
||||
SendDivertComplete();
|
||||
} else {
|
||||
mFlushedForDiversion = ePendingToBeFlushed;
|
||||
}
|
||||
SendDivertComplete();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -319,31 +319,9 @@ private:
|
||||
|
||||
// Once set, OnData and possibly OnStop will be diverted to the parent.
|
||||
Atomic<bool, ReleaseAcquire> mDivertingToParent;
|
||||
|
||||
enum FlushedForDiversionEnum {
|
||||
// This is the initial state.
|
||||
eNotFlushed,
|
||||
|
||||
// This is set when SendOnStopRequest() is called and the previous state was
|
||||
// eNotFlushed. FlushedForDiversion() has not been called yet, but when,
|
||||
// eventually, it will be, SendDivertComplete() can immediately called.
|
||||
eReadyToBeFlushed,
|
||||
|
||||
// This is set by FlushedForDiversion() when SetOnStopRequest() has not been
|
||||
// called yet. When finally SetOnStopRequest() will be called,
|
||||
// SendDivertComplete() will be executed as well.
|
||||
ePendingToBeFlushed,
|
||||
|
||||
// This is the final step. No OnStart/OnData/OnStop callbacks should be
|
||||
// received from the parent channel, nor dequeued from the
|
||||
// ChannelEventQueue.
|
||||
eFlushed,
|
||||
};
|
||||
|
||||
// Atomic becuase it can be touched onSocketThread() for debugging reasons
|
||||
// only.
|
||||
Atomic<FlushedForDiversionEnum, ReleaseAcquire> mFlushedForDiversion;
|
||||
|
||||
// Once set, no OnStart/OnData/OnStop callbacks should be received from the
|
||||
// parent channel, nor dequeued from the ChannelEventQueue.
|
||||
Atomic<bool, ReleaseAcquire> mFlushedForDiversion;
|
||||
// Set if SendSuspend is called. Determines if SendResume is needed when
|
||||
// diverting callbacks to parent.
|
||||
bool mSuspendSent;
|
||||
@ -462,11 +440,6 @@ private:
|
||||
// Collect telemetry for the successful rate of OMT.
|
||||
void CollectOMTTelemetry();
|
||||
|
||||
// When SendDivertOnStopRequest() is called, this method is used to check
|
||||
// mFlushedForDiversion and maybe call SendDivertComplete(). See
|
||||
// mFlushedForDiversion state.
|
||||
void MaybeSendDivertComplete();
|
||||
|
||||
// The result of RetargetDeliveryTo for this channel.
|
||||
// |notRequested| represents OMT is not requested by the channel owner.
|
||||
LABELS_HTTP_CHILD_OMT_STATS mOMTResult = LABELS_HTTP_CHILD_OMT_STATS::notRequested;
|
||||
@ -479,7 +452,6 @@ private:
|
||||
friend class MaybeDivertOnStopHttpEvent;
|
||||
friend class ProgressEvent;
|
||||
friend class StatusEvent;
|
||||
friend class SyntheticDiversionListener;
|
||||
friend class FailedAsyncOpenEvent;
|
||||
friend class Redirect1Event;
|
||||
friend class Redirect3Event;
|
||||
|
Loading…
Reference in New Issue
Block a user