зеркало из https://github.com/mozilla/gecko-dev.git
Bug 870916 - Make socket transport avoid off-main-thread usage of wrapped JS components. r=mcmanus
This commit is contained in:
Родитель
ac2f174bae
Коммит
3a7fe9a2b2
|
@ -17,6 +17,7 @@
|
|||
#include "nsTransportUtils.h"
|
||||
#include "nsProxyInfo.h"
|
||||
#include "nsNetCID.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "netCore.h"
|
||||
|
@ -1858,10 +1859,15 @@ nsSocketTransport::GetSecurityCallbacks(nsIInterfaceRequestor **callbacks)
|
|||
NS_IMETHODIMP
|
||||
nsSocketTransport::SetSecurityCallbacks(nsIInterfaceRequestor *callbacks)
|
||||
{
|
||||
nsCOMPtr<nsIInterfaceRequestor> threadsafeCallbacks;
|
||||
NS_NewNotificationCallbacksAggregation(callbacks, nullptr,
|
||||
NS_GetCurrentThread(),
|
||||
getter_AddRefs(threadsafeCallbacks));
|
||||
|
||||
nsCOMPtr<nsISupports> secinfo;
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
mCallbacks = callbacks;
|
||||
mCallbacks = threadsafeCallbacks;
|
||||
SOCKET_LOG(("Reset callbacks for secinfo=%p callbacks=%p\n",
|
||||
mSecInfo.get(), mCallbacks.get()));
|
||||
|
||||
|
@ -1871,7 +1877,7 @@ nsSocketTransport::SetSecurityCallbacks(nsIInterfaceRequestor *callbacks)
|
|||
// don't call into PSM while holding mLock!!
|
||||
nsCOMPtr<nsISSLSocketControl> secCtrl(do_QueryInterface(secinfo));
|
||||
if (secCtrl)
|
||||
secCtrl->SetNotificationCallbacks(callbacks);
|
||||
secCtrl->SetNotificationCallbacks(threadsafeCallbacks);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче