From 502ede1da361c08c6045584132898a5cd779b912 Mon Sep 17 00:00:00 2001 From: David Zbarsky Date: Sat, 10 Aug 2013 11:18:12 -0400 Subject: [PATCH] Bug 890570 - PTCPSocket constructor doesn't need PBrowser r=jduell --- dom/network/src/PTCPSocket.ipdl | 4 +--- dom/network/src/TCPSocketChild.cpp | 3 +-- dom/network/src/TCPSocketParent.cpp | 7 +++++-- dom/network/src/TCPSocketParent.h | 3 +-- netwerk/ipc/NeckoParent.h | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dom/network/src/PTCPSocket.ipdl b/dom/network/src/PTCPSocket.ipdl index 0681aa525610..538fb9715e4a 100644 --- a/dom/network/src/PTCPSocket.ipdl +++ b/dom/network/src/PTCPSocket.ipdl @@ -6,7 +6,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ include protocol PNecko; -include protocol PBrowser; include "mozilla/net/NeckoMessageUtils.h"; @@ -36,8 +35,7 @@ protocol PTCPSocket manager PNecko; parent: - Open(nsString host, uint16_t port, bool useSSL, nsString binaryType, - nullable PBrowser browser); + Open(nsString host, uint16_t port, bool useSSL, nsString binaryType); Data(SendableData data); Suspend(); Resume(); diff --git a/dom/network/src/TCPSocketChild.cpp b/dom/network/src/TCPSocketChild.cpp index 5440c6416f4b..c123d294dffa 100644 --- a/dom/network/src/TCPSocketChild.cpp +++ b/dom/network/src/TCPSocketChild.cpp @@ -91,8 +91,7 @@ TCPSocketChild::Open(nsITCPSocketInternal* aSocket, const nsAString& aHost, } AddIPDLReference(); gNeckoChild->SendPTCPSocketConstructor(this); - SendOpen(nsString(aHost), aPort, aUseSSL, nsString(aBinaryType), - GetTabChildFrom(aWindow)); + SendOpen(nsString(aHost), aPort, aUseSSL, nsString(aBinaryType)); return NS_OK; } diff --git a/dom/network/src/TCPSocketParent.cpp b/dom/network/src/TCPSocketParent.cpp index e5b099702d19..6b0dbfe4c47f 100644 --- a/dom/network/src/TCPSocketParent.cpp +++ b/dom/network/src/TCPSocketParent.cpp @@ -11,6 +11,8 @@ #include "nsCxPusher.h" #include "mozilla/unused.h" #include "mozilla/AppProcessChecker.h" +#include "mozilla/net/NeckoCommon.h" +#include "mozilla/net/PNeckoParent.h" namespace IPC { @@ -80,11 +82,12 @@ NS_IMETHODIMP_(nsrefcnt) TCPSocketParent::Release(void) bool TCPSocketParent::RecvOpen(const nsString& aHost, const uint16_t& aPort, const bool& aUseSSL, - const nsString& aBinaryType, PBrowserParent* aBrowser) + const nsString& aBinaryType) { // We don't have browser actors in xpcshell, and hence can't run automated // tests without this loophole. - if (aBrowser && !AssertAppProcessPermission(aBrowser, "tcp-socket")) { + if (net::UsingNeckoIPCSecurity() && + !AssertAppProcessPermission(Manager()->Manager(), "tcp-socket")) { FireInteralError(this, __LINE__); return true; } diff --git a/dom/network/src/TCPSocketParent.h b/dom/network/src/TCPSocketParent.h index bad8ca77b992..b9e0b74cfccf 100644 --- a/dom/network/src/TCPSocketParent.h +++ b/dom/network/src/TCPSocketParent.h @@ -47,8 +47,7 @@ public: TCPSocketParent() : mIntermediaryObj(nullptr) {} virtual bool RecvOpen(const nsString& aHost, const uint16_t& aPort, - const bool& useSSL, const nsString& aBinaryType, - PBrowserParent* aBrowser); + const bool& useSSL, const nsString& aBinaryType); virtual bool RecvSuspend() MOZ_OVERRIDE; virtual bool RecvResume() MOZ_OVERRIDE; diff --git a/netwerk/ipc/NeckoParent.h b/netwerk/ipc/NeckoParent.h index 311718e1f4ef..b29572a8e18b 100644 --- a/netwerk/ipc/NeckoParent.h +++ b/netwerk/ipc/NeckoParent.h @@ -86,7 +86,7 @@ protected: virtual PWebSocketParent* AllocPWebSocketParent(PBrowserParent* browser, const SerializedLoadContext& aSerialized); virtual bool DeallocPWebSocketParent(PWebSocketParent*); -virtual PTCPSocketParent* AllocPTCPSocketParent(); + virtual PTCPSocketParent* AllocPTCPSocketParent(); virtual PRemoteOpenFileParent* AllocPRemoteOpenFileParent(const URIParams& aFileURI, PBrowserParent* aBrowser)