mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-05-29 16:10:41 +00:00
import from UXP: Don't access gNeckoChild if not on main thread. (DiD) (71a6b780)
This commit is contained in:
@@ -172,19 +172,28 @@ UDPSocketChild::Bind(nsIUDPSocketInternal* aSocket,
|
||||
|
||||
NS_ENSURE_ARG(aSocket);
|
||||
|
||||
mSocket = aSocket;
|
||||
AddIPDLReference();
|
||||
if (NS_IsMainThread()) {
|
||||
if (!gNeckoChild->SendPUDPSocketConstructor(
|
||||
this, IPC::Principal(aPrincipal), mFilterName)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
} else {
|
||||
if (!mBackgroundManager) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
if (mBackgroundManager) {
|
||||
// If we want to support a passed-in principal here we'd need to
|
||||
// convert it to a PrincipalInfo
|
||||
MOZ_ASSERT(!aPrincipal);
|
||||
mBackgroundManager->SendPUDPSocketConstructor(this, void_t(), mFilterName);
|
||||
} else {
|
||||
gNeckoChild->SendPUDPSocketConstructor(this, IPC::Principal(aPrincipal),
|
||||
mFilterName);
|
||||
if (!mBackgroundManager->SendPUDPSocketConstructor(
|
||||
this, void_t(), mFilterName)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
mSocket = aSocket;
|
||||
AddIPDLReference();
|
||||
|
||||
SendBind(UDPAddressInfo(nsCString(aHost), aPort), aAddressReuse, aLoopback,
|
||||
recvBufferSize, sendBufferSize);
|
||||
return NS_OK;
|
||||
|
||||
Reference in New Issue
Block a user