summaryrefslogtreecommitdiffstats
path: root/dom/network
diff options
context:
space:
mode:
Diffstat (limited to 'dom/network')
-rw-r--r--dom/network/TCPSocketChild.cpp1
-rw-r--r--dom/network/UDPSocketChild.cpp23
2 files changed, 16 insertions, 8 deletions
diff --git a/dom/network/TCPSocketChild.cpp b/dom/network/TCPSocketChild.cpp
index 8eb19a1db..72581ca9d 100644
--- a/dom/network/TCPSocketChild.cpp
+++ b/dom/network/TCPSocketChild.cpp
@@ -50,7 +50,6 @@ namespace dom {
NS_IMPL_CYCLE_COLLECTION_CLASS(TCPSocketChildBase)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(TCPSocketChildBase)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSocket)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
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;