2013-05-10 16:00:28 +04:00
|
|
|
|
2009-08-18 23:05:15 +04:00
|
|
|
/* vim: set sw=2 ts=8 et tw=80 : */
|
|
|
|
|
2012-05-21 15:12:37 +04: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 23:05:15 +04:00
|
|
|
|
2013-11-12 02:52:33 +04: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 22:55:33 +04:00
|
|
|
#include "nsHttp.h"
|
2009-08-18 23:05:15 +04:00
|
|
|
#include "mozilla/net/NeckoChild.h"
|
2010-07-19 22:33:33 +04:00
|
|
|
#include "mozilla/dom/ContentChild.h"
|
2014-06-11 09:44:36 +04:00
|
|
|
#include "mozilla/dom/TabChild.h"
|
2009-08-18 23:05:15 +04:00
|
|
|
#include "mozilla/net/HttpChannelChild.h"
|
2010-03-26 02:02:28 +03:00
|
|
|
#include "mozilla/net/CookieServiceChild.h"
|
2010-10-11 15:35:10 +04:00
|
|
|
#include "mozilla/net/WyciwygChannelChild.h"
|
2010-08-10 22:47:00 +04:00
|
|
|
#include "mozilla/net/FTPChannelChild.h"
|
2011-05-04 17:36:23 +04:00
|
|
|
#include "mozilla/net/WebSocketChannelChild.h"
|
2015-10-28 22:10:20 +03:00
|
|
|
#include "mozilla/net/WebSocketEventListenerChild.h"
|
2013-12-11 23:03:51 +04:00
|
|
|
#include "mozilla/net/DNSRequestChild.h"
|
2014-03-11 02:04:28 +04:00
|
|
|
#include "mozilla/net/ChannelDiverterChild.h"
|
2016-06-07 12:46:03 +03:00
|
|
|
#include "mozilla/net/IPCTransportProvider.h"
|
2012-09-24 22:53:49 +04:00
|
|
|
#include "mozilla/dom/network/TCPSocketChild.h"
|
2013-07-29 21:36:43 +04:00
|
|
|
#include "mozilla/dom/network/TCPServerSocketChild.h"
|
2013-05-10 16:00:28 +04:00
|
|
|
#include "mozilla/dom/network/UDPSocketChild.h"
|
2016-04-11 06:17:02 +03:00
|
|
|
#include "mozilla/net/AltDataOutputStreamChild.h"
|
2017-03-24 04:04:41 +03:00
|
|
|
#ifdef MOZ_WEBRTC
|
2017-03-22 03:59:05 +03:00
|
|
|
#include "mozilla/net/StunAddrsRequestChild.h"
|
2017-03-24 04:04:41 +03:00
|
|
|
#endif
|
2016-04-11 06:17:02 +03:00
|
|
|
|
2013-10-19 00:57:55 +04:00
|
|
|
#include "SerializedLoadContext.h"
|
2017-06-14 03:15:00 +03:00
|
|
|
#include "nsGlobalWindow.h"
|
2014-08-23 07:05:56 +04:00
|
|
|
#include "nsIOService.h"
|
2015-06-18 12:23:00 +03:00
|
|
|
#include "nsINetworkPredictor.h"
|
|
|
|
#include "nsINetworkPredictorVerifier.h"
|
2018-05-30 17:36:42 +03:00
|
|
|
#include "nsINetworkLinkService.h"
|
2015-06-18 12:23:00 +03:00
|
|
|
#include "mozilla/ipc/URIUtils.h"
|
2015-07-06 08:55:00 +03:00
|
|
|
#include "nsNetUtil.h"
|
2012-09-24 22:53:49 +04:00
|
|
|
|
|
|
|
using mozilla::dom::TCPSocketChild;
|
2013-07-29 21:36:43 +04:00
|
|
|
using mozilla::dom::TCPServerSocketChild;
|
2013-05-10 16:00:28 +04:00
|
|
|
using mozilla::dom::UDPSocketChild;
|
2009-08-18 23:05:15 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2012-07-30 18:20:58 +04:00
|
|
|
PNeckoChild *gNeckoChild = nullptr;
|
2009-08-18 23:05:15 +04:00
|
|
|
|
|
|
|
// C++ file contents
|
|
|
|
|
|
|
|
NeckoChild::~NeckoChild()
|
|
|
|
{
|
2015-07-31 23:50:08 +03:00
|
|
|
//Send__delete__(gNeckoChild);
|
|
|
|
gNeckoChild = nullptr;
|
2009-08-18 23:05:15 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
void NeckoChild::InitNeckoChild()
|
|
|
|
{
|
2015-02-10 01:34:50 +03: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 22:55:33 +04:00
|
|
|
|
|
|
|
if (!gNeckoChild) {
|
2017-07-06 15:00:35 +03:00
|
|
|
mozilla::dom::ContentChild * cpc =
|
2010-07-19 22:33:33 +04:00
|
|
|
mozilla::dom::ContentChild::GetSingleton();
|
2009-08-18 23:05:15 +04:00
|
|
|
NS_ASSERTION(cpc, "Content Protocol is NULL!");
|
2017-05-26 04:06:00 +03:00
|
|
|
if (NS_WARN_IF(cpc->IsShuttingDown())) {
|
|
|
|
return;
|
|
|
|
}
|
2017-07-06 15:00:35 +03:00
|
|
|
gNeckoChild = cpc->SendPNeckoConstructor();
|
2009-08-18 23:05:15 +04:00
|
|
|
NS_ASSERTION(gNeckoChild, "PNecko Protocol init failed!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-10 03:46:24 +04:00
|
|
|
PHttpChannelChild*
|
2014-06-11 09:44:36 +04:00
|
|
|
NeckoChild::AllocPHttpChannelChild(const PBrowserOrId& browser,
|
2013-07-08 19:48:39 +04:00
|
|
|
const SerializedLoadContext& loadContext,
|
|
|
|
const HttpChannelCreationArgs& aOpenArgs)
|
2009-08-18 23:05:15 +04:00
|
|
|
{
|
2012-10-10 03:46:24 +04:00
|
|
|
// We don't allocate here: instead we always use IPDL constructor that takes
|
|
|
|
// an existing HttpChildChannel
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPHttpChannelChild should not be called on "
|
|
|
|
"child");
|
2012-10-10 03:46:24 +04:00
|
|
|
return nullptr;
|
2009-08-18 23:05:15 +04:00
|
|
|
}
|
|
|
|
|
2017-07-06 15:00:35 +03:00
|
|
|
bool
|
2013-07-08 19:48:39 +04:00
|
|
|
NeckoChild::DeallocPHttpChannelChild(PHttpChannelChild* channel)
|
2009-08-18 23:05:15 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03: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 22:55:33 +04:00
|
|
|
|
2010-06-27 20:44:15 +04:00
|
|
|
HttpChannelChild* child = static_cast<HttpChannelChild*>(channel);
|
|
|
|
child->ReleaseIPDLReference();
|
2009-09-18 03:09:20 +04:00
|
|
|
return true;
|
2009-08-18 23:05:15 +04:00
|
|
|
}
|
|
|
|
|
2017-03-22 03:59:05 +03:00
|
|
|
PStunAddrsRequestChild*
|
|
|
|
NeckoChild::AllocPStunAddrsRequestChild()
|
|
|
|
{
|
|
|
|
// We don't allocate here: instead we always use IPDL constructor that takes
|
|
|
|
// an existing object
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPStunAddrsRequestChild should not be called "
|
|
|
|
"on child");
|
2017-03-22 03:59:05 +03:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
NeckoChild::DeallocPStunAddrsRequestChild(PStunAddrsRequestChild* aActor)
|
|
|
|
{
|
2017-03-24 04:04:41 +03:00
|
|
|
#ifdef MOZ_WEBRTC
|
2017-03-22 03:59:05 +03:00
|
|
|
StunAddrsRequestChild* p = static_cast<StunAddrsRequestChild*>(aActor);
|
|
|
|
p->ReleaseIPDLReference();
|
2017-03-24 04:04:41 +03:00
|
|
|
#endif
|
2017-03-22 03:59:05 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-04-11 06:17:02 +03:00
|
|
|
PAltDataOutputStreamChild*
|
|
|
|
NeckoChild::AllocPAltDataOutputStreamChild(
|
|
|
|
const nsCString& type,
|
2018-04-25 07:01:00 +03:00
|
|
|
const int64_t& predictedSize,
|
2016-04-11 06:17:02 +03:00
|
|
|
PHttpChannelChild* channel)
|
|
|
|
{
|
2017-06-12 01:24:00 +03:00
|
|
|
// We don't allocate here: see HttpChannelChild::OpenAlternativeOutputStream()
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPAltDataOutputStreamChild should not be called");
|
2017-06-12 01:24:00 +03:00
|
|
|
return nullptr;
|
2016-04-11 06:17:02 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
NeckoChild::DeallocPAltDataOutputStreamChild(PAltDataOutputStreamChild* aActor)
|
|
|
|
{
|
|
|
|
AltDataOutputStreamChild* child = static_cast<AltDataOutputStreamChild*>(aActor);
|
|
|
|
child->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-08-10 22:47:00 +04:00
|
|
|
PFTPChannelChild*
|
2014-06-11 09:44:36 +04:00
|
|
|
NeckoChild::AllocPFTPChannelChild(const PBrowserOrId& aBrowser,
|
2013-07-08 19:48:39 +04:00
|
|
|
const SerializedLoadContext& aSerialized,
|
|
|
|
const FTPChannelCreationArgs& aOpenArgs)
|
2010-08-10 22:47:00 +04:00
|
|
|
{
|
|
|
|
// We don't allocate here: see FTPChannelChild::AsyncOpen()
|
2016-12-03 00:46:53 +03:00
|
|
|
MOZ_CRASH("AllocPFTPChannelChild should not be called");
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-08-10 22:47:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 19:48:39 +04:00
|
|
|
NeckoChild::DeallocPFTPChannelChild(PFTPChannelChild* channel)
|
2010-08-10 22:47:00 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(IsNeckoChild(), "DeallocPFTPChannelChild called by non-child!");
|
2010-08-10 22:47:00 +04:00
|
|
|
|
|
|
|
FTPChannelChild* child = static_cast<FTPChannelChild*>(channel);
|
|
|
|
child->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-07-08 19:48:39 +04:00
|
|
|
PCookieServiceChild*
|
|
|
|
NeckoChild::AllocPCookieServiceChild()
|
2010-03-26 02:02:28 +03:00
|
|
|
{
|
|
|
|
// We don't allocate here: see nsCookieService::GetSingleton()
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPCookieServiceChild should not be called");
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-03-26 02:02:28 +03:00
|
|
|
}
|
|
|
|
|
2013-07-08 19:48:39 +04:00
|
|
|
bool
|
|
|
|
NeckoChild::DeallocPCookieServiceChild(PCookieServiceChild* cs)
|
2010-03-26 02:02:28 +03:00
|
|
|
{
|
2013-07-08 19:48:39 +04:00
|
|
|
NS_ASSERTION(IsNeckoChild(), "DeallocPCookieServiceChild called by non-child!");
|
2010-03-26 02:02:28 +03:00
|
|
|
|
|
|
|
CookieServiceChild *p = static_cast<CookieServiceChild*>(cs);
|
|
|
|
p->Release();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2010-10-11 15:35:10 +04:00
|
|
|
PWyciwygChannelChild*
|
2013-07-08 19:48:39 +04:00
|
|
|
NeckoChild::AllocPWyciwygChannelChild()
|
2010-10-11 15:35:10 +04:00
|
|
|
{
|
2017-06-12 01:21:00 +03:00
|
|
|
// We don't allocate here: see nsWyciwygProtocolHandler::NewChannel2()
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPWyciwygChannelChild should not be called");
|
2017-06-12 01:21:00 +03:00
|
|
|
return nullptr;
|
2010-10-11 15:35:10 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 19:48:39 +04:00
|
|
|
NeckoChild::DeallocPWyciwygChannelChild(PWyciwygChannelChild* channel)
|
2010-10-11 15:35:10 +04:00
|
|
|
{
|
2015-02-10 01:34:50 +03:00
|
|
|
MOZ_ASSERT(IsNeckoChild(), "DeallocPWyciwygChannelChild called by non-child!");
|
2010-10-11 15:35:10 +04:00
|
|
|
|
|
|
|
WyciwygChannelChild *p = static_cast<WyciwygChannelChild*>(channel);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-05-04 17:36:23 +04:00
|
|
|
PWebSocketChild*
|
2014-06-11 09:44:36 +04:00
|
|
|
NeckoChild::AllocPWebSocketChild(const PBrowserOrId& browser,
|
2015-10-28 22:10:42 +03:00
|
|
|
const SerializedLoadContext& aSerialized,
|
|
|
|
const uint32_t& aSerial)
|
2011-05-04 17:36:23 +04:00
|
|
|
{
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPWebSocketChild should not be called");
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2011-05-04 17:36:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 19:48:39 +04:00
|
|
|
NeckoChild::DeallocPWebSocketChild(PWebSocketChild* child)
|
2011-05-04 17:36:23 +04:00
|
|
|
{
|
|
|
|
WebSocketChannelChild* p = static_cast<WebSocketChannelChild*>(child);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:10:20 +03:00
|
|
|
PWebSocketEventListenerChild*
|
|
|
|
NeckoChild::AllocPWebSocketEventListenerChild(const uint64_t& aInnerWindowID)
|
2015-10-26 18:31:00 +03:00
|
|
|
{
|
2017-06-14 03:15:00 +03:00
|
|
|
nsCOMPtr<nsIEventTarget> target;
|
2017-11-06 21:09:35 +03:00
|
|
|
if (nsGlobalWindowInner* win = nsGlobalWindowInner::GetInnerWindowWithId(aInnerWindowID)) {
|
2017-06-14 03:15:00 +03:00
|
|
|
target = win->EventTargetFor(TaskCategory::Other);
|
|
|
|
}
|
|
|
|
|
2015-10-28 22:10:20 +03:00
|
|
|
RefPtr<WebSocketEventListenerChild> c =
|
2017-06-14 03:15:00 +03:00
|
|
|
new WebSocketEventListenerChild(aInnerWindowID, target);
|
|
|
|
|
|
|
|
if (target) {
|
|
|
|
gNeckoChild->SetEventTargetForActor(c, target);
|
|
|
|
}
|
|
|
|
|
2015-10-26 18:31:00 +03:00
|
|
|
return c.forget().take();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2015-10-28 22:10:20 +03:00
|
|
|
NeckoChild::DeallocPWebSocketEventListenerChild(PWebSocketEventListenerChild* aActor)
|
2015-10-26 18:31:00 +03:00
|
|
|
{
|
2015-10-28 22:10:20 +03:00
|
|
|
RefPtr<WebSocketEventListenerChild> c =
|
|
|
|
dont_AddRef(static_cast<WebSocketEventListenerChild*>(aActor));
|
2015-10-26 18:31:00 +03:00
|
|
|
MOZ_ASSERT(c);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2015-03-27 23:12:37 +03:00
|
|
|
PDataChannelChild*
|
|
|
|
NeckoChild::AllocPDataChannelChild(const uint32_t& channelId)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Should never get here");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
NeckoChild::DeallocPDataChannelChild(PDataChannelChild* child)
|
|
|
|
{
|
|
|
|
// NB: See DataChannelChild::ActorDestroy.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-04-12 21:43:50 +03:00
|
|
|
PFileChannelChild*
|
|
|
|
NeckoChild::AllocPFileChannelChild(const uint32_t& channelId)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Should never get here");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
NeckoChild::DeallocPFileChannelChild(PFileChannelChild* child)
|
|
|
|
{
|
|
|
|
// NB: See FileChannelChild::ActorDestroy.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-07-27 23:34:54 +03:00
|
|
|
PSimpleChannelChild*
|
|
|
|
NeckoChild::AllocPSimpleChannelChild(const uint32_t& channelId)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT_UNREACHABLE("Should never get here");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
NeckoChild::DeallocPSimpleChannelChild(PSimpleChannelChild* child)
|
|
|
|
{
|
|
|
|
// NB: See SimpleChannelChild::ActorDestroy.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-09-24 22:53:49 +04:00
|
|
|
PTCPSocketChild*
|
2013-12-19 07:21:12 +04:00
|
|
|
NeckoChild::AllocPTCPSocketChild(const nsString& host,
|
|
|
|
const uint16_t& port)
|
2012-09-24 22:53:49 +04:00
|
|
|
{
|
2017-06-12 01:22:00 +03:00
|
|
|
TCPSocketChild* p = new TCPSocketChild(host, port, nullptr);
|
2013-07-29 21:36:43 +04:00
|
|
|
p->AddIPDLReference();
|
|
|
|
return p;
|
2012-09-24 22:53:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-07-08 19:48:39 +04:00
|
|
|
NeckoChild::DeallocPTCPSocketChild(PTCPSocketChild* child)
|
2012-09-24 22:53:49 +04:00
|
|
|
{
|
|
|
|
TCPSocketChild* p = static_cast<TCPSocketChild*>(child);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-07-29 21:36:43 +04:00
|
|
|
PTCPServerSocketChild*
|
|
|
|
NeckoChild::AllocPTCPServerSocketChild(const uint16_t& aLocalPort,
|
|
|
|
const uint16_t& aBacklog,
|
2015-03-25 17:36:56 +03:00
|
|
|
const bool& aUseArrayBuffers)
|
2013-07-29 21:36:43 +04:00
|
|
|
{
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPTCPServerSocket should not be called");
|
2013-07-29 21:36:43 +04:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
NeckoChild::DeallocPTCPServerSocketChild(PTCPServerSocketChild* child)
|
|
|
|
{
|
|
|
|
TCPServerSocketChild* p = static_cast<TCPServerSocketChild*>(child);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-05-10 16:00:28 +04:00
|
|
|
PUDPSocketChild*
|
2015-04-08 22:35:00 +03:00
|
|
|
NeckoChild::AllocPUDPSocketChild(const Principal& aPrincipal,
|
|
|
|
const nsCString& aFilter)
|
2013-05-10 16:00:28 +04:00
|
|
|
{
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPUDPSocket should not be called");
|
2013-05-10 16:00:28 +04:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
NeckoChild::DeallocPUDPSocketChild(PUDPSocketChild* child)
|
|
|
|
{
|
|
|
|
|
|
|
|
UDPSocketChild* p = static_cast<UDPSocketChild*>(child);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-12-11 23:03:51 +04:00
|
|
|
PDNSRequestChild*
|
|
|
|
NeckoChild::AllocPDNSRequestChild(const nsCString& aHost,
|
2017-02-14 07:25:35 +03:00
|
|
|
const OriginAttributes& aOriginAttributes,
|
2018-05-16 23:05:03 +03:00
|
|
|
const uint32_t& aFlags)
|
2013-12-11 23:03:51 +04:00
|
|
|
{
|
|
|
|
// We don't allocate here: instead we always use IPDL constructor that takes
|
|
|
|
// an existing object
|
2018-06-18 08:43:11 +03:00
|
|
|
MOZ_ASSERT_UNREACHABLE("AllocPDNSRequestChild should not be called on child");
|
2013-12-11 23:03:51 +04:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
NeckoChild::DeallocPDNSRequestChild(PDNSRequestChild* aChild)
|
|
|
|
{
|
|
|
|
DNSRequestChild *p = static_cast<DNSRequestChild*>(aChild);
|
|
|
|
p->ReleaseIPDLReference();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-11 02:04:28 +04:00
|
|
|
PChannelDiverterChild*
|
|
|
|
NeckoChild::AllocPChannelDiverterChild(const ChannelDiverterArgs& channel)
|
|
|
|
{
|
|
|
|
return new ChannelDiverterChild();;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
NeckoChild::DeallocPChannelDiverterChild(PChannelDiverterChild* child)
|
|
|
|
{
|
|
|
|
delete static_cast<ChannelDiverterChild*>(child);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-06-07 12:46:03 +03: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;
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2014-10-24 04:29:00 +04:00
|
|
|
NeckoChild::RecvAsyncAuthPromptForNestedFrame(const TabId& aNestedFrameId,
|
2014-06-11 09:44:36 +04:00
|
|
|
const nsCString& aUri,
|
|
|
|
const nsString& aRealm,
|
|
|
|
const uint64_t& aCallbackId)
|
|
|
|
{
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<dom::TabChild> tabChild = dom::TabChild::FindTabChild(aNestedFrameId);
|
2015-01-30 12:07:12 +03:00
|
|
|
if (!tabChild) {
|
2014-06-11 09:44:36 +04:00
|
|
|
MOZ_CRASH();
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_FAIL_NO_REASON(this);
|
2014-06-11 09:44:36 +04:00
|
|
|
}
|
|
|
|
tabChild->SendAsyncAuthPrompt(aUri, aRealm, aCallbackId);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2014-06-11 09:44:36 +04:00
|
|
|
}
|
|
|
|
|
2015-06-18 12:23:00 +03:00
|
|
|
/* Predictor Messages */
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-04-15 05:26:58 +03:00
|
|
|
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 06:26:00 +03:00
|
|
|
NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
|
2016-04-15 05:26:58 +03:00
|
|
|
|
|
|
|
predictor->OnPredictPrefetch(uri, aHttpStatus);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-04-15 05:26:58 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-06-18 12:23:00 +03:00
|
|
|
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 06:26:00 +03:00
|
|
|
NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
|
2015-06-18 12:23:00 +03:00
|
|
|
|
|
|
|
predictor->OnPredictPreconnect(uri);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-06-18 12:23:00 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2015-06-18 12:23:00 +03:00
|
|
|
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 06:26:00 +03:00
|
|
|
NS_ENSURE_SUCCESS(rv, IPC_FAIL_NO_REASON(this));
|
2015-06-18 12:23:00 +03:00
|
|
|
|
|
|
|
predictor->OnPredictDNS(uri);
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2015-06-18 12:23:00 +03:00
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-08-26 09:40:57 +03:00
|
|
|
NeckoChild::RecvSpeculativeConnectRequest()
|
2016-03-29 02:43:01 +03:00
|
|
|
{
|
|
|
|
nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
|
|
|
|
if (obsService) {
|
|
|
|
obsService->NotifyObservers(nullptr, "speculative-connect-request",
|
2016-08-26 09:40:57 +03:00
|
|
|
nullptr);
|
2016-03-29 02:43:01 +03:00
|
|
|
}
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-03-29 02:43:01 +03:00
|
|
|
}
|
|
|
|
|
2018-05-30 17:36:42 +03: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();
|
|
|
|
}
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|