bug 1301407 - ensure PSM is initialized on the main thread before doing a speculative connect r?mcmanus draft
authorDavid Keeler <dkeeler@mozilla.com>
Thu, 22 Sep 2016 14:54:48 -0700
changeset 416724 b1b52c8a23cc127d9c2a07b2aba28638b7e76266
parent 416562 f0e6cc6360213ba21fd98c887b55fce5c680df68
child 531936 8c374029e790ebc2556600b039f4dd2ed2cf14c9
push id30232
push userdkeeler@mozilla.com
push dateThu, 22 Sep 2016 21:55:12 +0000
reviewersmcmanus
bugs1301407
milestone52.0a1
bug 1301407 - ensure PSM is initialized on the main thread before doing a speculative connect r?mcmanus MozReview-Commit-ID: Bc9KiN3Qw1E
netwerk/protocol/http/nsHttpConnectionMgr.cpp
--- a/netwerk/protocol/http/nsHttpConnectionMgr.cpp
+++ b/netwerk/protocol/http/nsHttpConnectionMgr.cpp
@@ -403,16 +403,21 @@ private:
 nsresult
 nsHttpConnectionMgr::SpeculativeConnect(nsHttpConnectionInfo *ci,
                                         nsIInterfaceRequestor *callbacks,
                                         uint32_t caps,
                                         NullHttpTransaction *nullTransaction)
 {
     MOZ_ASSERT(NS_IsMainThread(), "nsHttpConnectionMgr::SpeculativeConnect called off main thread!");
 
+    if (!IsNeckoChild()) {
+        // HACK: make sure PSM gets initialized on the main thread.
+        net_EnsurePSMInit();
+    }
+
     LOG(("nsHttpConnectionMgr::SpeculativeConnect [ci=%s]\n",
          ci->HashKey().get()));
 
     nsCOMPtr<nsISpeculativeConnectionOverrider> overrider =
         do_GetInterface(callbacks);
 
     bool allow1918 = overrider ? overrider->GetAllow1918() : false;