summaryrefslogtreecommitdiffstats
path: root/dom/network
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2019-07-16 18:59:14 +0200
committerwolfbeast <mcwerewolf@wolfbeast.com>2019-07-16 18:59:14 +0200
commitca0083022fad1f9fb2a7b1d4b94f32402026e3e6 (patch)
tree4433953f8f699baa22340714eaf286b11da8ca45 /dom/network
parentc4d192b49246ed72e2b857452b557ef1bef83c58 (diff)
downloadUXP-ca0083022fad1f9fb2a7b1d4b94f32402026e3e6.tar
UXP-ca0083022fad1f9fb2a7b1d4b94f32402026e3e6.tar.gz
UXP-ca0083022fad1f9fb2a7b1d4b94f32402026e3e6.tar.lz
UXP-ca0083022fad1f9fb2a7b1d4b94f32402026e3e6.tar.xz
UXP-ca0083022fad1f9fb2a7b1d4b94f32402026e3e6.zip
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.
Diffstat (limited to 'dom/network')
-rw-r--r--dom/network/UDPSocketChild.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/dom/network/UDPSocketChild.cpp b/dom/network/UDPSocketChild.cpp
index 6e374ce31..d205e7e8a 100644
--- a/dom/network/UDPSocketChild.cpp
+++ b/dom/network/UDPSocketChild.cpp
@@ -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;