mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-29 02:27:30 +09:00
Don't access gNeckoChild if not on main thread. (DiD)
This patch also makes UDPSocketChild::Bind return NS_ERROR_NOT_AVAILABLE when mBackgroundManager is null.
This commit is contained in:
parent
5639ab5968
commit
71a6b780d9
1 changed files with 16 additions and 7 deletions
|
|
@ -172,19 +172,28 @@ UDPSocketChild::Bind(nsIUDPSocketInternal* aSocket,
|
||||||
|
|
||||||
NS_ENSURE_ARG(aSocket);
|
NS_ENSURE_ARG(aSocket);
|
||||||
|
|
||||||
mSocket = aSocket;
|
if (NS_IsMainThread()) {
|
||||||
AddIPDLReference();
|
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
|
// If we want to support a passed-in principal here we'd need to
|
||||||
// convert it to a PrincipalInfo
|
// convert it to a PrincipalInfo
|
||||||
MOZ_ASSERT(!aPrincipal);
|
MOZ_ASSERT(!aPrincipal);
|
||||||
mBackgroundManager->SendPUDPSocketConstructor(this, void_t(), mFilterName);
|
if (!mBackgroundManager->SendPUDPSocketConstructor(
|
||||||
} else {
|
this, void_t(), mFilterName)) {
|
||||||
gNeckoChild->SendPUDPSocketConstructor(this, IPC::Principal(aPrincipal),
|
return NS_ERROR_FAILURE;
|
||||||
mFilterName);
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mSocket = aSocket;
|
||||||
|
AddIPDLReference();
|
||||||
|
|
||||||
SendBind(UDPAddressInfo(nsCString(aHost), aPort), aAddressReuse, aLoopback,
|
SendBind(UDPAddressInfo(nsCString(aHost), aPort), aAddressReuse, aLoopback,
|
||||||
recvBufferSize, sendBufferSize);
|
recvBufferSize, sendBufferSize);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue