Bug 1496257 - P3 queue the nsHttpChannel::AsyncOpenFinal if the socket process is not ready
authorJunior Hsu <juhsu@mozilla.com>
Wed, 10 Oct 2018 18:15:23 -0700
changeset 448027 f7ea92227fd01e56ab016d08eb6ad651811f026d
parent 448026 e97fe90fa93bb3df64d3a262c815971a20003d1a
child 448028 879997404310931a986a2b73315881bf24126b5a
push id22
push userjuhsu@mozilla.com
push dateThu, 13 Dec 2018 22:13:38 +0000
bugs1496257
milestone65.0a1
Bug 1496257 - P3 queue the nsHttpChannel::AsyncOpenFinal if the socket process is not ready Summary: Need not to cherry-pick this patch if we don't split nsHttpTranscation Reviewers: mayhemer Tags: #secure-revision Bug #: 1496257 Differential Revision: https://phabricator.services.mozilla.com/D8327
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -6491,16 +6491,28 @@ nsHttpChannel::AsyncOpen(nsIStreamListen
     }
 
     mIsPending = true;
     mWasOpened = true;
 
     mListener = listener;
     mListenerContext = context;
 
+    if (UseSocketProcess() &&
+        !gIOService->IsSocketProcessLaunchComplete()) {
+        RefPtr<nsHttpChannel> self = this;
+        RefPtr<Runnable> event =
+            NS_NewRunnableFunction("nsHttpChannel::AsyncOpenFinal",
+                [self]() {
+                    self->AsyncOpenFinal(TimeStamp::Now());
+            });
+        gIOService->AppendPendingEvent(event);
+        return NS_OK;
+    }
+
     // PauseTask/DelayHttpChannel queuing
     if (!DelayHttpChannelQueue::AttemptQueueChannel(this)) {
         // If fuzzyfox is disabled; or adding to the queue failed, the channel must continue.
         AsyncOpenFinal(TimeStamp::Now());
     }
 
     return NS_OK;
 }