2013-05-10 12:00:28 +00:00
|
|
|
|
2009-08-18 19:05:15 +00:00
|
|
|
/* vim: set sw=2 ts=8 et tw=80 : */
|
|
|
|
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-08-18 19:05:15 +00:00
|
|
|
|
2013-11-11 22:52:33 +00:00
|
|
|
#include "necko-config.h"
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 18:55:33 +00:00
|
|
|
#include "nsHttp.h"
|
2009-08-18 19:05:15 +00:00
|
|
|
#include "mozilla/net/NeckoChild.h"
|
2010-07-19 18:33:33 +00:00
|
|
|
#include "mozilla/dom/ContentChild.h"
|
2019-04-09 22:39:01 +00:00
|
|
|
#include "mozilla/dom/BrowserChild.h"
|
2009-08-18 19:05:15 +00:00
|
|
|
#include "mozilla/net/HttpChannelChild.h"
|
2010-03-25 23:02:28 +00:00
|
|
|
#include "mozilla/net/CookieServiceChild.h"
|
2010-08-10 18:47:00 +00:00
|
|
|
#include "mozilla/net/FTPChannelChild.h"
|
2019-05-21 17:04:23 +00:00
|
|
|
#include "mozilla/net/DataChannelChild.h"
|
|
|
|
#include "mozilla/net/FileChannelChild.h"
|
2011-05-04 13:36:23 +00:00
|
|
|
#include "mozilla/net/WebSocketChannelChild.h"
|
2015-10-28 19:10:20 +00:00
|
|
|
#include "mozilla/net/WebSocketEventListenerChild.h"
|
2013-12-11 19:03:51 +00:00
|
|
|
#include "mozilla/net/DNSRequestChild.h"
|
2014-03-10 22:04:28 +00:00
|
|
|
#include "mozilla/net/ChannelDiverterChild.h"
|
2016-06-07 09:46:03 +00:00
|
|
|
#include "mozilla/net/IPCTransportProvider.h"
|
2012-09-24 18:53:49 +00:00
|
|
|
#include "mozilla/dom/network/TCPSocketChild.h"
|
2013-07-29 17:36:43 +00:00
|
|
|
#include "mozilla/dom/network/TCPServerSocketChild.h"
|
2013-05-10 12:00:28 +00:00
|
|
|
#include "mozilla/dom/network/UDPSocketChild.h"
|
2016-04-11 03:17:02 +00:00
|
|
|
#include "mozilla/net/AltDataOutputStreamChild.h"
|
2019-03-15 18:55:10 +00:00
|
|
|
#include "mozilla/net/ClassifierDummyChannelChild.h"
|
2019-02-25 21:50:42 +00:00
|
|
|
#include "mozilla/net/SocketProcessBridgeChild.h"
|
2017-03-24 01:04:41 +00:00
|
|
|
#ifdef MOZ_WEBRTC
|
2019-07-29 12:27:59 +00:00
|
|
|
# include "mozilla/net/ProxyConfigLookupChild.h"
|
2017-03-22 00:59:05 +00:00
|
|
|
# include "mozilla/net/StunAddrsRequestChild.h"
|
2018-06-05 17:10:16 +00:00
|
|
|
# include "mozilla/net/WebrtcProxyChannelChild.h"
|
2017-03-24 01:04:41 +00:00
|
|
|
#endif
|
2016-04-11 03:17:02 +00:00
|
|
|
|
2013-10-18 20:57:55 +00:00
|
|
|
#include "SerializedLoadContext.h"
|
2017-06-14 00:15:00 +00:00
|
|
|
#include "nsGlobalWindow.h"
|
2014-08-23 03:05:56 +00:00
|
|
|
#include "nsIOService.h"
|
2015-06-18 09:23:00 +00:00
|
|
|
#include "nsINetworkPredictor.h"
|
|
|
|
#include "nsINetworkPredictorVerifier.h"
|
2018-05-30 14:36:42 +00:00
|
|
|
#include "nsINetworkLinkService.h"
|
2018-09-04 20:45:22 +00:00
|
|
|
#include "nsQueryObject.h"
|
2015-06-18 09:23:00 +00:00
|
|
|
#include "mozilla/ipc/URIUtils.h"
|
2015-07-06 05:55:00 +00:00
|
|
|
#include "nsNetUtil.h"
|
2019-05-21 17:04:23 +00:00
|
|
|
#include "SimpleChannel.h"
|
2012-09-24 18:53:49 +00:00
|
|
|
|
2013-07-29 17:36:43 +00:00
|
|
|
using mozilla::dom::TCPServerSocketChild;
|
|
|
|
using mozilla::dom::TCPSocketChild;
|
2013-05-10 12:00:28 +00:00
|
|
|
using mozilla::dom::UDPSocketChild;
|
2009-08-18 19:05:15 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
PNeckoChild* gNeckoChild = nullptr;
|
2009-08-18 19:05:15 +00:00
|
|
|
|
|
|
|
// C++ file contents
|
|
|
|
|
|
|
|
NeckoChild::~NeckoChild() {
|
2015-07-31 20:50:08 +00:00
|
|
|
// Send__delete__(gNeckoChild);
|
|
|
|
gNeckoChild = nullptr;
|
2009-08-18 19:05:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void NeckoChild::InitNeckoChild() {
|
2015-02-09 22:34:50 +00:00
|
|
|
MOZ_ASSERT(IsNeckoChild(), "InitNeckoChild called by non-child!");
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 18:55:33 +00:00
|
|
|
|
|
|
|
if (!gNeckoChild) {
|
2017-07-06 12:00:35 +00:00
|
|
|
mozilla::dom::ContentChild* cpc =
|
2010-07-19 18:33:33 +00:00
|
|
|
mozilla::dom::ContentChild::GetSingleton();
|
2009-08-18 19:05:15 +00:00
|
|
|
NS_ASSERTION(cpc, "Content Protocol is NULL!");
|
2017-05-26 01:06:00 +00:00
|
|
|
if (NS_WARN_IF(cpc->IsShuttingDown())) {
|
|
|
|
return;
|
|
|
|
}
|
2017-07-06 12:00:35 +00:00
|
|
|
gNeckoChild = cpc->SendPNeckoConstructor();
|
2009-08-18 19:05:15 +00:00
|
|
|
NS_ASSERTION(gNeckoChild, "PNecko Protocol init failed!");
|
2019-02-25 21:50:42 +00:00
|
|
|
SocketProcessBridgeChild::GetSocketProcessBridge();
|
2009-08-18 19:05:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-28 20:40:35 +00:00
|
|
|
PHttpChannelChild* NeckoChild::AllocPHttpChannelChild(
|
|
|
|
const PBrowserOrId& browser, const SerializedLoadContext& loadContext,
|
|
|
|
const HttpChannelCreationArgs& aOpenArgs) {
|
2012-10-09 23:46:24 +00:00
|
|
|
// We don't allocate here: instead we always use IPDL constructor that takes
|
|
|
|
// an existing HttpChildChannel
|
2018-06-18 05:43:11 +00:00
|
|
|
MOZ_ASSERT_UNREACHABLE(
|
|
|
|
"AllocPHttpChannelChild should not be called on "
|
|
|
|
"child");
|
2012-10-09 23:46:24 +00:00
|
|
|
return nullptr;
|
2009-08-18 19:05:15 +00:00
|
|
|
}
|
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
bool NeckoChild::DeallocPHttpChannelChild(PHttpChannelChild* channel) {
|
2015-02-09 22:34:50 +00:00
|
|
|
MOZ_ASSERT(IsNeckoChild(), "DeallocPHttpChannelChild called by non-child!");
|
Bug 530952: Electrolysis HTTP Channel implementation. author=jduell, r=bsmedberg, sr=bz
- Supports only primitive xpcshell HTTP requests which don't set/get HTTP
headers, don't do redirects, observers, load groups, or anything else other
than basic things like looking at the reply body, Content-type, Content-length, etc.
- Tested with network/test/unit_ipc/test_simple_wrap.js (patch @ bug 521922)
- Only used if "NECKO_E10S_HTTP" set in environment.
- Force http.h to get #included before any IPDL files, to centralize #define
handling of LOG and to make sure FORCE_PR_LOGGING is set if needed (bug
545995)
2009-09-22 18:55:33 +00:00
|
|
|
|
2010-06-27 16:44:15 +00:00
|
|
|
HttpChannelChild* child = static_cast<HttpChannelChild*>(channel);
|
2019-05-28 17:06:01 +00:00
|
|
|
child->Release();
|
2009-09-17 23:09:20 +00:00
|
|
|
return true;
|
2009-08-18 19:05:15 +00:00
|
|
|
}
|
|
|
|
|
2017-03-22 00:59:05 +00:00
|
|
|
PStunAddrsRequestChild* NeckoChild::AllocPStunAddrsRequestChild() {
|
|
|
|
// We don't allocate here: instead we always use IPDL constructor that takes
|
|
|
|
// an existing object
|
2018-06-18 05:43:11 +00:00
|
|
|
MOZ_ASSERT_UNREACHABLE(
|
|
|
|
"AllocPStunAddrsRequestChild should not be called "
|
|
|
|
"on child");
|
2017-03-22 00:59:05 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPStunAddrsRequestChild(PStunAddrsRequestChild* aActor) {
|
2017-03-24 01:04:41 +00:00
|
|
|
#ifdef MOZ_WEBRTC
|
2017-03-22 00:59:05 +00:00
|
|
|
StunAddrsRequestChild* p = static_cast<StunAddrsRequestChild*>(aActor);
|
|
|
|
p->ReleaseIPDLReference();
|
2017-03-24 01:04:41 +00:00
|
|
|
#endif
|
2017-03-22 00:59:05 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-06-05 17:10:16 +00:00
|
|
|
PWebrtcProxyChannelChild* NeckoChild::AllocPWebrtcProxyChannelChild(
|
2019-04-26 14:46:26 +00:00
|
|
|
const TabId& tabId) {
|
2018-06-05 17:10:16 +00:00
|
|
|
// We don't allocate here: instead we always use IPDL constructor that takes
|
|
|
|
// an existing object
|
|
|
|
MOZ_ASSERT_UNREACHABLE(
|
|
|
|
"AllocPWebrtcProxyChannelChild should not be called on"
|
|
|
|
" child");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPWebrtcProxyChannelChild(
|
|
|
|
PWebrtcProxyChannelChild* aActor) {
|
|
|
|
#ifdef MOZ_WEBRTC
|
|
|
|
WebrtcProxyChannelChild* child =
|
|
|
|
static_cast<WebrtcProxyChannelChild*>(aActor);
|
|
|
|
child->ReleaseIPDLReference();
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-04-11 03:17:02 +00:00
|
|
|
PAltDataOutputStreamChild* NeckoChild::AllocPAltDataOutputStreamChild(
|
2018-04-25 04:01:00 +00:00
|
|
|
const nsCString& type, const int64_t& predictedSize,
|
2016-04-11 03:17:02 +00:00
|
|
|
PHttpChannelChild* channel) {
|
2017-06-11 22:24:00 +00:00
|
|
|
// We don't allocate here: see HttpChannelChild::OpenAlternativeOutputStream()
|
2018-06-18 05:43:11 +00:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPAltDataOutputStreamChild should not be called");
|
2017-06-11 22:24:00 +00:00
|
|
|
return nullptr;
|
2016-04-11 03:17:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPAltDataOutputStreamChild(
|
|
|
|
PAltDataOutputStreamChild* aActor) {
|
|
|
|
AltDataOutputStreamChild* child =
|
|
|
|
static_cast<AltDataOutputStreamChild*>(aActor);
|
|
|
|
child->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-06-11 05:44:36 +00:00
|
|
|
PFTPChannelChild* NeckoChild::AllocPFTPChannelChild(
|
2013-07-08 15:48:39 +00:00
|
|
|
const PBrowserOrId& aBrowser, const SerializedLoadContext& aSerialized,
|
|
|
|
const FTPChannelCreationArgs& aOpenArgs) {
|
2010-08-10 18:47:00 +00:00
|
|
|
// We don't allocate here: see FTPChannelChild::AsyncOpen()
|
2016-12-02 21:46:53 +00:00
|
|
|
MOZ_CRASH("AllocPFTPChannelChild should not be called");
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2010-08-10 18:47:00 +00:00
|
|
|
}
|
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
bool NeckoChild::DeallocPFTPChannelChild(PFTPChannelChild* channel) {
|
2015-02-09 22:34:50 +00:00
|
|
|
MOZ_ASSERT(IsNeckoChild(), "DeallocPFTPChannelChild called by non-child!");
|
2010-08-10 18:47:00 +00:00
|
|
|
|
|
|
|
FTPChannelChild* child = static_cast<FTPChannelChild*>(channel);
|
|
|
|
child->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
PCookieServiceChild* NeckoChild::AllocPCookieServiceChild() {
|
2010-03-25 23:02:28 +00:00
|
|
|
// We don't allocate here: see nsCookieService::GetSingleton()
|
2018-06-18 05:43:11 +00:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPCookieServiceChild should not be called");
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2010-03-25 23:02:28 +00:00
|
|
|
}
|
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
bool NeckoChild::DeallocPCookieServiceChild(PCookieServiceChild* cs) {
|
|
|
|
NS_ASSERTION(IsNeckoChild(),
|
|
|
|
"DeallocPCookieServiceChild called by non-child!");
|
2010-03-25 23:02:28 +00:00
|
|
|
|
|
|
|
CookieServiceChild* p = static_cast<CookieServiceChild*>(cs);
|
|
|
|
p->Release();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-06-11 05:44:36 +00:00
|
|
|
PWebSocketChild* NeckoChild::AllocPWebSocketChild(
|
2015-10-28 19:10:42 +00:00
|
|
|
const PBrowserOrId& browser, const SerializedLoadContext& aSerialized,
|
|
|
|
const uint32_t& aSerial) {
|
2018-06-18 05:43:11 +00:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPWebSocketChild should not be called");
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2011-05-04 13:36:23 +00:00
|
|
|
}
|
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
bool NeckoChild::DeallocPWebSocketChild(PWebSocketChild* child) {
|
2011-05-04 13:36:23 +00:00
|
|
|
WebSocketChannelChild* p = static_cast<WebSocketChannelChild*>(child);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-10-28 19:10:20 +00:00
|
|
|
PWebSocketEventListenerChild* NeckoChild::AllocPWebSocketEventListenerChild(
|
|
|
|
const uint64_t& aInnerWindowID) {
|
2017-06-14 00:15:00 +00:00
|
|
|
nsCOMPtr<nsIEventTarget> target;
|
2017-11-06 18:09:35 +00:00
|
|
|
if (nsGlobalWindowInner* win =
|
|
|
|
nsGlobalWindowInner::GetInnerWindowWithId(aInnerWindowID)) {
|
2017-06-14 00:15:00 +00:00
|
|
|
target = win->EventTargetFor(TaskCategory::Other);
|
|
|
|
}
|
|
|
|
|
2015-10-28 19:10:20 +00:00
|
|
|
RefPtr<WebSocketEventListenerChild> c =
|
2017-06-14 00:15:00 +00:00
|
|
|
new WebSocketEventListenerChild(aInnerWindowID, target);
|
|
|
|
|
|
|
|
if (target) {
|
|
|
|
gNeckoChild->SetEventTargetForActor(c, target);
|
|
|
|
}
|
|
|
|
|
2015-10-26 15:31:00 +00:00
|
|
|
return c.forget().take();
|
|
|
|
}
|
|
|
|
|
2015-10-28 19:10:20 +00:00
|
|
|
bool NeckoChild::DeallocPWebSocketEventListenerChild(
|
|
|
|
PWebSocketEventListenerChild* aActor) {
|
|
|
|
RefPtr<WebSocketEventListenerChild> c =
|
|
|
|
dont_AddRef(static_cast<WebSocketEventListenerChild*>(aActor));
|
2015-10-26 15:31:00 +00:00
|
|
|
MOZ_ASSERT(c);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-03-27 20:12:37 +00:00
|
|
|
PDataChannelChild* NeckoChild::AllocPDataChannelChild(
|
|
|
|
const uint32_t& channelId) {
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Should never get here");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPDataChannelChild(PDataChannelChild* child) {
|
2019-05-21 17:04:23 +00:00
|
|
|
static_cast<DataChannelChild*>(child)->Release();
|
2015-03-27 20:12:37 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-04-12 18:43:50 +00:00
|
|
|
PFileChannelChild* NeckoChild::AllocPFileChannelChild(
|
|
|
|
const uint32_t& channelId) {
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Should never get here");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPFileChannelChild(PFileChannelChild* child) {
|
2019-05-21 17:04:23 +00:00
|
|
|
static_cast<FileChannelChild*>(child)->Release();
|
2017-04-12 18:43:50 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-07-27 20:34:54 +00:00
|
|
|
PSimpleChannelChild* NeckoChild::AllocPSimpleChannelChild(
|
|
|
|
const uint32_t& channelId) {
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Should never get here");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPSimpleChannelChild(PSimpleChannelChild* child) {
|
2019-05-21 17:04:23 +00:00
|
|
|
static_cast<SimpleChannelChild*>(child)->Release();
|
2017-07-27 20:34:54 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-12-19 03:21:12 +00:00
|
|
|
PTCPSocketChild* NeckoChild::AllocPTCPSocketChild(const nsString& host,
|
|
|
|
const uint16_t& port) {
|
2017-06-11 22:22:00 +00:00
|
|
|
TCPSocketChild* p = new TCPSocketChild(host, port, nullptr);
|
2013-07-29 17:36:43 +00:00
|
|
|
p->AddIPDLReference();
|
|
|
|
return p;
|
2012-09-24 18:53:49 +00:00
|
|
|
}
|
|
|
|
|
2013-07-08 15:48:39 +00:00
|
|
|
bool NeckoChild::DeallocPTCPSocketChild(PTCPSocketChild* child) {
|
2012-09-24 18:53:49 +00:00
|
|
|
TCPSocketChild* p = static_cast<TCPSocketChild*>(child);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-07-29 17:36:43 +00:00
|
|
|
PTCPServerSocketChild* NeckoChild::AllocPTCPServerSocketChild(
|
|
|
|
const uint16_t& aLocalPort, const uint16_t& aBacklog,
|
2015-03-25 14:36:56 +00:00
|
|
|
const bool& aUseArrayBuffers) {
|
2018-06-18 05:43:11 +00:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPTCPServerSocket should not be called");
|
2013-07-29 17:36:43 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPTCPServerSocketChild(PTCPServerSocketChild* child) {
|
|
|
|
TCPServerSocketChild* p = static_cast<TCPServerSocketChild*>(child);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-04-25 14:18:11 +00:00
|
|
|
PUDPSocketChild* NeckoChild::AllocPUDPSocketChild(nsIPrincipal* aPrincipal,
|
2015-04-08 19:35:00 +00:00
|
|
|
const nsCString& aFilter) {
|
2018-06-18 05:43:11 +00:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPUDPSocket should not be called");
|
2013-05-10 12:00:28 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPUDPSocketChild(PUDPSocketChild* child) {
|
|
|
|
UDPSocketChild* p = static_cast<UDPSocketChild*>(child);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-12-11 19:03:51 +00:00
|
|
|
PDNSRequestChild* NeckoChild::AllocPDNSRequestChild(
|
2017-02-14 04:25:35 +00:00
|
|
|
const nsCString& aHost, const OriginAttributes& aOriginAttributes,
|
2018-05-16 20:05:03 +00:00
|
|
|
const uint32_t& aFlags) {
|
2013-12-11 19:03:51 +00:00
|
|
|
// We don't allocate here: instead we always use IPDL constructor that takes
|
|
|
|
// an existing object
|
2018-06-18 05:43:11 +00:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPDNSRequestChild should not be called on child");
|
2013-12-11 19:03:51 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPDNSRequestChild(PDNSRequestChild* aChild) {
|
|
|
|
DNSRequestChild* p = static_cast<DNSRequestChild*>(aChild);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-10 22:04:28 +00:00
|
|
|
PChannelDiverterChild* NeckoChild::AllocPChannelDiverterChild(
|
|
|
|
const ChannelDiverterArgs& channel) {
|
|
|
|
return new ChannelDiverterChild();
|
2018-11-30 10:46:48 +00:00
|
|
|
;
|
2014-03-10 22:04:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPChannelDiverterChild(PChannelDiverterChild* child) {
|
|
|
|
delete static_cast<ChannelDiverterChild*>(child);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-06-07 09:46:03 +00:00
|
|
|
PTransportProviderChild* NeckoChild::AllocPTransportProviderChild() {
|
|
|
|
// This refcount is transferred to the receiver of the message that
|
|
|
|
// includes the PTransportProviderChild actor.
|
|
|
|
RefPtr<TransportProviderChild> res = new TransportProviderChild();
|
|
|
|
|
|
|
|
return res.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPTransportProviderChild(
|
|
|
|
PTransportProviderChild* aActor) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-10-24 00:29:00 +00:00
|
|
|
mozilla::ipc::IPCResult NeckoChild::RecvAsyncAuthPromptForNestedFrame(
|
|
|
|
const TabId& aNestedFrameId, const nsCString& aUri, const nsString& aRealm,
|
2014-06-11 05:44:36 +00:00
|
|
|
const uint64_t& aCallbackId) {
|
2019-04-09 22:39:01 +00:00
|
|
|
RefPtr<dom::BrowserChild> browserChild =
|
|
|
|
dom::BrowserChild::FindBrowserChild(aNestedFrameId);
|
|
|
|
if (!browserChild) {
|
2014-06-11 05:44:36 +00:00
|
|
|
MOZ_CRASH();
|
2016-11-15 03:26:00 +00:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
2014-06-11 05:44:36 +00:00
|
|
|
}
|
2019-04-09 22:39:01 +00:00
|
|
|
browserChild->SendAsyncAuthPrompt(aUri, aRealm, aCallbackId);
|
2016-11-15 03:26:00 +00:00
|
|
|
return IPC_OK();
|
2014-06-11 05:44:36 +00:00
|
|
|
}
|
|
|
|
|
2015-06-18 09:23:00 +00:00
|
|
|
/* Predictor Messages */
|
2016-04-15 02:26:58 +00:00
|
|
|
mozilla::ipc::IPCResult NeckoChild::RecvPredOnPredictPrefetch(
|
|
|
|
const URIParams& aURI, const uint32_t& aHttpStatus) {
|
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
|
|
|
"PredictorChild::RecvOnPredictPrefetch "
|
|
|
|
"off main thread.");
|
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
|
|
|
|
|
|
|
// Get the current predictor
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsCOMPtr<nsINetworkPredictorVerifier> predictor =
|
|
|
|
do_GetService("@mozilla.org/network/predictor;1", &rv);
|
2016-11-15 03:26:00 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
|
2016-04-15 02:26:58 +00:00
|
|
|
|
|
|
|
predictor->OnPredictPrefetch(uri, aHttpStatus);
|
2016-11-15 03:26:00 +00:00
|
|
|
return IPC_OK();
|
2016-04-15 02:26:58 +00:00
|
|
|
}
|
|
|
|
|
2015-06-18 09:23:00 +00:00
|
|
|
mozilla::ipc::IPCResult NeckoChild::RecvPredOnPredictPreconnect(
|
|
|
|
const URIParams& aURI) {
|
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
|
|
|
"PredictorChild::RecvOnPredictPreconnect "
|
|
|
|
"off main thread.");
|
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
|
|
|
|
|
|
|
// Get the current predictor
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsCOMPtr<nsINetworkPredictorVerifier> predictor =
|
|
|
|
do_GetService("@mozilla.org/network/predictor;1", &rv);
|
2016-11-15 03:26:00 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
|
2015-06-18 09:23:00 +00:00
|
|
|
|
|
|
|
predictor->OnPredictPreconnect(uri);
|
2016-11-15 03:26:00 +00:00
|
|
|
return IPC_OK();
|
2015-06-18 09:23:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::ipc::IPCResult NeckoChild::RecvPredOnPredictDNS(
|
|
|
|
const URIParams& aURI) {
|
|
|
|
MOZ_ASSERT(NS_IsMainThread(),
|
|
|
|
"PredictorChild::RecvOnPredictDNS off "
|
|
|
|
"main thread.");
|
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
|
|
|
|
|
|
|
// Get the current predictor
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsCOMPtr<nsINetworkPredictorVerifier> predictor =
|
|
|
|
do_GetService("@mozilla.org/network/predictor;1", &rv);
|
2016-11-15 03:26:00 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
|
2015-06-18 09:23:00 +00:00
|
|
|
|
|
|
|
predictor->OnPredictDNS(uri);
|
2016-11-15 03:26:00 +00:00
|
|
|
return IPC_OK();
|
2015-06-18 09:23:00 +00:00
|
|
|
}
|
|
|
|
|
2016-08-26 06:40:57 +00:00
|
|
|
mozilla::ipc::IPCResult NeckoChild::RecvSpeculativeConnectRequest() {
|
2016-03-28 23:43:01 +00:00
|
|
|
nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
|
|
|
|
if (obsService) {
|
|
|
|
obsService->NotifyObservers(nullptr, "speculative-connect-request",
|
2016-08-26 06:40:57 +00:00
|
|
|
nullptr);
|
2016-03-28 23:43:01 +00:00
|
|
|
}
|
2016-11-15 03:26:00 +00:00
|
|
|
return IPC_OK();
|
2016-03-28 23:43:01 +00:00
|
|
|
}
|
|
|
|
|
2018-05-30 14:36:42 +00:00
|
|
|
mozilla::ipc::IPCResult NeckoChild::RecvNetworkChangeNotification(
|
|
|
|
nsCString const& type) {
|
|
|
|
nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
|
|
|
|
if (obsService) {
|
|
|
|
obsService->NotifyObservers(nullptr, NS_NETWORK_LINK_TOPIC,
|
|
|
|
NS_ConvertUTF8toUTF16(type).get());
|
|
|
|
}
|
|
|
|
return IPC_OK();
|
|
|
|
}
|
|
|
|
|
2019-03-15 18:55:10 +00:00
|
|
|
PClassifierDummyChannelChild* NeckoChild::AllocPClassifierDummyChannelChild(
|
2018-10-25 08:44:12 +00:00
|
|
|
nsIURI* aURI, nsIURI* aTopWindowURI, const nsresult& aTopWindowURIResult,
|
2019-03-04 06:30:00 +00:00
|
|
|
const Maybe<LoadInfoArgs>& aLoadInfo) {
|
2019-03-15 18:55:10 +00:00
|
|
|
return new ClassifierDummyChannelChild();
|
2018-10-12 09:40:36 +00:00
|
|
|
}
|
|
|
|
|
2019-03-15 18:55:10 +00:00
|
|
|
bool NeckoChild::DeallocPClassifierDummyChannelChild(
|
|
|
|
PClassifierDummyChannelChild* aActor) {
|
|
|
|
delete static_cast<ClassifierDummyChannelChild*>(aActor);
|
2018-10-12 09:40:36 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-07-29 12:27:59 +00:00
|
|
|
PProxyConfigLookupChild* NeckoChild::AllocPProxyConfigLookupChild() {
|
|
|
|
MOZ_CRASH("AllocPProxyConfigLookupChild should not be called");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool NeckoChild::DeallocPProxyConfigLookupChild(
|
|
|
|
PProxyConfigLookupChild* aActor) {
|
|
|
|
#ifdef MOZ_WEBRTC
|
|
|
|
delete static_cast<ProxyConfigLookupChild*>(aActor);
|
|
|
|
#endif
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|