bug 1301407 - ensure PSM is initialized on the main thread before doing a speculative connect r=mcmanus a=ritu
authorDavid Keeler <dkeeler@mozilla.com>
Thu, 22 Sep 2016 14:54:48 -0700
changeset 428775 6b1a3f769aa6d826bd404750e7af66702ff01214
parent 428774 29d25f5224ad918470c049f1991628853e1831cd
child 428776 9c7f589a8f74bc57fe02a85abb4bd5aa352af129
push id33416
push userpaul@paul.cx
push dateMon, 24 Oct 2016 16:26:20 +0000
reviewersmcmanus, ritu
bugs1301407
milestone50.0
bug 1301407 - ensure PSM is initialized on the main thread before doing a speculative connect r=mcmanus a=ritu 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 = false;
     if (overrider) {