Bug 1451262 - Call NS_ProcessPendingEvents after StopSSLServerCertVerificationThreads draft
authorValentin Gosu <valentin.gosu@gmail.com>
Thu, 10 May 2018 10:37:24 +0200
changeset 793513 49074d6815420702c47dc5d93ee4e20ea758d659
parent 793056 9294f67b3f3bd4a3dd898961148cecd8bfc1ce9c
push id109412
push uservalentin.gosu@gmail.com
push dateThu, 10 May 2018 08:37:50 +0000
bugs1451262
milestone62.0a1
Bug 1451262 - Call NS_ProcessPendingEvents after StopSSLServerCertVerificationThreads If there are still pending events after we null out gSocketThread, OnSocketThread() will always return false, which can trigger assertions. MozReview-Commit-ID: CovFIU3cKL
netwerk/base/nsSocketTransportService2.cpp
--- a/netwerk/base/nsSocketTransportService2.cpp
+++ b/netwerk/base/nsSocketTransportService2.cpp
@@ -1062,17 +1062,22 @@ nsSocketTransportService::Run()
 
     // detach all sockets, including locals
     Reset(false);
 
     // Final pass over the event queue. This makes sure that events posted by
     // socket detach handlers get processed.
     NS_ProcessPendingEvents(mRawThread);
 
+    // Stopping the SLL threads can generate new events, so we need to
+    // process them before nulling out gSocketThread, otherwise we can get
+    // !onSocketThread assertions.
     psm::StopSSLServerCertVerificationThreads();
+    NS_ProcessPendingEvents(mRawThread);
+
     gSocketThread = nullptr;
 
     SOCKET_LOG(("STS thread exit\n"));
 
     return NS_OK;
 }
 
 void