Bug 1646592 - P4 Remove the depedency between OnStartRequestSent and AttachStreamFilter, r=mayhemer,necko-reviewers

We're shorter the name!

Depends on D81274

Differential Revision: https://phabricator.services.mozilla.com/D81275
This commit is contained in:
Junior Hsu 2020-07-07 21:46:34 +00:00
Родитель 069f0d6456
Коммит 9b0685fe4c
4 изменённых файлов: 9 добавлений и 18 удалений

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

@ -194,7 +194,7 @@ HttpChannelChild::HttpChannelChild()
mIsLastPartOfMultiPart(false),
mSuspendForWaitCompleteRedirectSetup(false),
mRecvOnStartRequestSentCalled(false),
mSuspendedByWaitingForPermissionCookieStreamFilter(false) {
mSuspendedByWaitingForPermissionCookie(false) {
LOG(("Creating HttpChannelChild @%p\n", this));
mChannelCreationTime = PR_Now();
@ -408,8 +408,8 @@ mozilla::ipc::IPCResult HttpChannelChild::RecvOnStartRequestSent() {
mRecvOnStartRequestSentCalled = true;
if (mSuspendedByWaitingForPermissionCookieStreamFilter) {
mSuspendedByWaitingForPermissionCookieStreamFilter = false;
if (mSuspendedByWaitingForPermissionCookie) {
mSuspendedByWaitingForPermissionCookie = false;
mEventQ->Resume();
}
return IPC_OK();
@ -553,7 +553,7 @@ void HttpChannelChild::OnStartRequest(
MOZ_ASSERT(NS_IsMainThread());
mEventQ->Suspend();
mSuspendedByWaitingForPermissionCookieStreamFilter = true;
mSuspendedByWaitingForPermissionCookie = true;
mEventQ->PrependEvent(MakeUnique<NeckoTargetChannelFunctionEvent>(
this, [self = UnsafePtr<HttpChannelChild>(this)]() {
self->DoOnStartRequest(self, nullptr);

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

@ -474,9 +474,9 @@ class HttpChannelChild final : public PHttpChannelChild,
// True if RecvOnStartRequestSent was received.
uint8_t mRecvOnStartRequestSentCalled : 1;
// True if this channel is suspened by waiting for permission, cookie or
// stream filter. That is, RecvOnStartRequestSent is received.
uint8_t mSuspendedByWaitingForPermissionCookieStreamFilter : 1;
// True if this channel is suspened by waiting for permission or cookie.
// That is, RecvOnStartRequestSent is received.
uint8_t mSuspendedByWaitingForPermissionCookie : 1;
void FinishInterceptedRedirect();
void CleanupRedirectingChannel(nsresult rv);

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

@ -83,8 +83,7 @@ HttpChannelParent::HttpChannelParent(dom::BrowserParent* iframeEmbedding,
mCacheNeedFlowControlInitialized(false),
mNeedFlowControl(true),
mSuspendedForFlowControl(false),
mAfterOnStartRequestBegun(false),
mStreamFilterAttached(false) {
mAfterOnStartRequestBegun(false) {
LOG(("Creating HttpChannelParent [this=%p]\n", this));
// Ensure gHttpHandler is initialized: we need the atom table up and running.
@ -1546,8 +1545,7 @@ HttpChannelParent::OnStartRequest(nsIRequest* aRequest) {
// Bug 1645901: Currently Set-Cookie is passed to child process on main
// thread, which is racy with PBackground. We should have a way to set cookie
// in child for Set-Cookie response header.
args.shouldWaitForOnStartRequestSent() =
isDocument || hasSetCookie || mStreamFilterAttached;
args.shouldWaitForOnStartRequestSent() = isDocument || hasSetCookie;
rv = NS_OK;
@ -2675,7 +2673,6 @@ auto HttpChannelParent::AttachStreamFilter(
-> RefPtr<ChildEndpointPromise> {
LOG(("HttpChannelParent::AttachStreamFilter [this=%p]", this));
MOZ_ASSERT(!mAfterOnStartRequestBegun);
mStreamFilterAttached = true;
if (mIPCClosed) {
return ChildEndpointPromise::CreateAndReject(false, __func__);

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

@ -362,12 +362,6 @@ class HttpChannelParent final : public nsIInterfaceRequestor,
// Used to ensure methods can't be called before OnStartRequest.
uint8_t mAfterOnStartRequestBegun : 1;
// Set if the channel is attached with a stream filter and will send
// OnStartRequestSent to keep the order with OnStartRequest.
// AttachStreamFilter should be handled before OnStartRequest goes to the
// listener in child process, which could be racy with OnStartRequest.
uint8_t mStreamFilterAttached : 1;
// Number of events to wait before actually invoking AsyncOpen on the main
// channel. For each asynchronous step required before InvokeAsyncOpen, should
// increase 1 to mAsyncOpenBarrier and invoke TryInvokeAsyncOpen after