2009-08-18 23:05:15 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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
|
|
|
|
2015-09-23 11:10:21 +03:00
|
|
|
#include "mozilla/BasePrincipal.h"
|
2009-08-18 23:05:15 +04:00
|
|
|
#include "mozilla/net/PNeckoParent.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 "mozilla/net/NeckoCommon.h"
|
2015-07-07 05:17:00 +03:00
|
|
|
#include "nsIAuthPrompt2.h"
|
2015-06-18 12:23:00 +03:00
|
|
|
#include "nsINetworkPredictor.h"
|
2015-07-07 05:17:00 +03:00
|
|
|
#include "nsNetUtil.h"
|
2009-08-18 23:05:15 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_net_NeckoParent_h
|
|
|
|
#define mozilla_net_NeckoParent_h
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2012-12-29 13:02:16 +04:00
|
|
|
// Used to override channel Private Browsing status if needed.
|
|
|
|
enum PBOverrideStatus {
|
|
|
|
kPBOverride_Unset = 0,
|
|
|
|
kPBOverride_Private,
|
|
|
|
kPBOverride_NotPrivate
|
|
|
|
};
|
|
|
|
|
2009-08-18 23:05:15 +04:00
|
|
|
// Header file contents
|
2014-08-23 07:05:56 +04:00
|
|
|
class NeckoParent
|
|
|
|
: public PNeckoParent
|
2009-08-18 23:05:15 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NeckoParent();
|
2018-04-30 19:46:04 +03:00
|
|
|
virtual ~NeckoParent() = default;
|
2009-08-18 23:05:15 +04:00
|
|
|
|
2016-04-27 07:16:50 +03:00
|
|
|
MOZ_MUST_USE
|
2013-08-21 10:49:41 +04:00
|
|
|
static const char *
|
2016-11-17 16:52:16 +03:00
|
|
|
GetValidatedOriginAttributes(const SerializedLoadContext& aSerialized,
|
|
|
|
PContentParent* aBrowser,
|
|
|
|
nsIPrincipal* aRequestingPrincipal,
|
2017-01-12 19:38:48 +03:00
|
|
|
mozilla::OriginAttributes& aAttrs);
|
2013-08-21 10:49:41 +04:00
|
|
|
|
2012-12-29 13:02:16 +04:00
|
|
|
/*
|
|
|
|
* Creates LoadContext for parent-side of an e10s channel.
|
|
|
|
*
|
2013-08-21 10:49:44 +04:00
|
|
|
* PContentParent corresponds to the process that is requesting the load.
|
2012-12-29 13:02:16 +04:00
|
|
|
*
|
|
|
|
* Returns null if successful, or an error string if failed.
|
|
|
|
*/
|
2016-04-27 07:16:50 +03:00
|
|
|
MOZ_MUST_USE
|
2012-12-29 13:02:16 +04:00
|
|
|
static const char*
|
2014-06-11 09:44:36 +04:00
|
|
|
CreateChannelLoadContext(const PBrowserOrId& aBrowser,
|
2013-08-21 10:49:44 +04:00
|
|
|
PContentParent* aContent,
|
2012-12-29 13:02:16 +04:00
|
|
|
const SerializedLoadContext& aSerialized,
|
2016-11-03 10:18:51 +03:00
|
|
|
nsIPrincipal* aRequestingPrincipal,
|
2012-12-29 13:02:16 +04:00
|
|
|
nsCOMPtr<nsILoadContext> &aResult);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
|
|
|
virtual PCookieServiceParent* AllocPCookieServiceParent() override;
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2015-03-21 19:28:04 +03:00
|
|
|
RecvPCookieServiceConstructor(PCookieServiceParent* aActor) override
|
2013-06-03 14:14:37 +04:00
|
|
|
{
|
|
|
|
return PNeckoParent::RecvPCookieServiceConstructor(aActor);
|
|
|
|
}
|
|
|
|
|
2014-06-11 09:44:36 +04:00
|
|
|
/*
|
|
|
|
* This implementation of nsIAuthPrompt2 is used for nested remote iframes that
|
|
|
|
* want an auth prompt. This class lives in the parent process and informs the
|
|
|
|
* NeckoChild that we want an auth prompt, which forwards the request to the
|
|
|
|
* TabParent in the remote iframe that contains the nested iframe
|
|
|
|
*/
|
2015-03-21 19:28:04 +03:00
|
|
|
class NestedFrameAuthPrompt final : public nsIAuthPrompt2
|
2014-06-11 09:44:36 +04:00
|
|
|
{
|
2014-06-24 20:36:44 +04:00
|
|
|
~NestedFrameAuthPrompt() {}
|
|
|
|
|
2014-06-11 09:44:36 +04:00
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2014-10-24 04:29:00 +04:00
|
|
|
NestedFrameAuthPrompt(PNeckoParent* aParent, TabId aNestedFrameId);
|
2014-06-11 09:44:36 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD PromptAuth(nsIChannel*, uint32_t, nsIAuthInformation*, bool*) override
|
2014-06-11 09:44:36 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHOD AsyncPromptAuth(nsIChannel* aChannel, nsIAuthPromptCallback* callback,
|
|
|
|
nsISupports*, uint32_t,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsIAuthInformation* aInfo, nsICancelable**) override;
|
2014-06-11 09:44:36 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
PNeckoParent* mNeckoParent;
|
2014-10-24 04:29:00 +04:00
|
|
|
TabId mNestedFrameId;
|
2014-06-11 09:44:36 +04:00
|
|
|
};
|
|
|
|
|
2009-08-18 23:05:15 +04:00
|
|
|
protected:
|
2013-06-22 20:09:19 +04:00
|
|
|
virtual PHttpChannelParent*
|
2014-06-11 09:44:36 +04:00
|
|
|
AllocPHttpChannelParent(const PBrowserOrId&, const SerializedLoadContext&,
|
2015-03-21 19:28:04 +03:00
|
|
|
const HttpChannelCreationArgs& aOpenArgs) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2013-06-22 20:09:19 +04:00
|
|
|
RecvPHttpChannelConstructor(
|
2016-11-15 06:26:00 +03:00
|
|
|
PHttpChannelParent* aActor,
|
|
|
|
const PBrowserOrId& aBrowser,
|
|
|
|
const SerializedLoadContext& aSerialized,
|
|
|
|
const HttpChannelCreationArgs& aOpenArgs) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DeallocPHttpChannelParent(PHttpChannelParent*) override;
|
2016-04-11 06:17:02 +03:00
|
|
|
|
2017-03-22 03:59:05 +03:00
|
|
|
virtual PStunAddrsRequestParent* AllocPStunAddrsRequestParent() override;
|
|
|
|
virtual bool
|
|
|
|
DeallocPStunAddrsRequestParent(PStunAddrsRequestParent* aActor) override;
|
|
|
|
|
2016-04-11 06:17:02 +03:00
|
|
|
virtual PAltDataOutputStreamParent* AllocPAltDataOutputStreamParent(
|
2018-04-25 07:01:00 +03:00
|
|
|
const nsCString& type, const int64_t& predictedSize, PHttpChannelParent* channel) override;
|
2016-04-11 06:17:02 +03:00
|
|
|
virtual bool DeallocPAltDataOutputStreamParent(
|
|
|
|
PAltDataOutputStreamParent* aActor) override;
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DeallocPCookieServiceParent(PCookieServiceParent*) override;
|
|
|
|
virtual PWyciwygChannelParent* AllocPWyciwygChannelParent() override;
|
|
|
|
virtual bool DeallocPWyciwygChannelParent(PWyciwygChannelParent*) override;
|
2013-06-22 20:09:19 +04:00
|
|
|
virtual PFTPChannelParent*
|
2014-06-11 09:44:36 +04:00
|
|
|
AllocPFTPChannelParent(const PBrowserOrId& aBrowser,
|
2013-07-08 19:48:39 +04:00
|
|
|
const SerializedLoadContext& aSerialized,
|
2015-03-21 19:28:04 +03:00
|
|
|
const FTPChannelCreationArgs& aOpenArgs) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2013-06-22 20:09:19 +04:00
|
|
|
RecvPFTPChannelConstructor(
|
2016-11-15 06:26:00 +03:00
|
|
|
PFTPChannelParent* aActor,
|
|
|
|
const PBrowserOrId& aBrowser,
|
|
|
|
const SerializedLoadContext& aSerialized,
|
|
|
|
const FTPChannelCreationArgs& aOpenArgs) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DeallocPFTPChannelParent(PFTPChannelParent*) override;
|
2014-01-17 23:49:39 +04:00
|
|
|
virtual PWebSocketParent*
|
2014-06-11 09:44:36 +04:00
|
|
|
AllocPWebSocketParent(const PBrowserOrId& browser,
|
2015-10-28 22:10:42 +03:00
|
|
|
const SerializedLoadContext& aSerialized,
|
|
|
|
const uint32_t& aSerial) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DeallocPWebSocketParent(PWebSocketParent*) override;
|
2013-12-19 07:21:12 +04:00
|
|
|
virtual PTCPSocketParent* AllocPTCPSocketParent(const nsString& host,
|
2015-03-21 19:28:04 +03:00
|
|
|
const uint16_t& port) override;
|
2013-02-07 17:06:58 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DeallocPTCPSocketParent(PTCPSocketParent*) override;
|
2014-01-17 23:49:39 +04:00
|
|
|
virtual PTCPServerSocketParent*
|
|
|
|
AllocPTCPServerSocketParent(const uint16_t& aLocalPort,
|
|
|
|
const uint16_t& aBacklog,
|
2015-03-25 17:36:56 +03:00
|
|
|
const bool& aUseArrayBuffers) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPTCPServerSocketConstructor(PTCPServerSocketParent*,
|
|
|
|
const uint16_t& aLocalPort,
|
|
|
|
const uint16_t& aBacklog,
|
|
|
|
const bool& aUseArrayBuffers) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DeallocPTCPServerSocketParent(PTCPServerSocketParent*) override;
|
2015-04-08 22:35:00 +03:00
|
|
|
virtual PUDPSocketParent* AllocPUDPSocketParent(const Principal& aPrincipal,
|
|
|
|
const nsCString& aFilter) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPUDPSocketConstructor(PUDPSocketParent*,
|
|
|
|
const Principal& aPrincipal,
|
|
|
|
const nsCString& aFilter) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DeallocPUDPSocketParent(PUDPSocketParent*) override;
|
2013-12-11 23:03:51 +04:00
|
|
|
virtual PDNSRequestParent* AllocPDNSRequestParent(const nsCString& aHost,
|
2017-02-14 07:25:35 +03:00
|
|
|
const OriginAttributes& aOriginAttributes,
|
2015-02-19 08:14:00 +03:00
|
|
|
const uint32_t& aFlags,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsCString& aNetworkInterface) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPDNSRequestConstructor(PDNSRequestParent* actor,
|
|
|
|
const nsCString& hostName,
|
2017-02-14 07:25:35 +03:00
|
|
|
const OriginAttributes& aOriginAttributes,
|
2016-11-15 06:26:00 +03:00
|
|
|
const uint32_t& flags,
|
|
|
|
const nsCString& aNetworkInterface) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool DeallocPDNSRequestParent(PDNSRequestParent*) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSpeculativeConnect(const URIParams& aURI,
|
|
|
|
const Principal& aPrincipal,
|
|
|
|
const bool& aAnonymous) override;
|
|
|
|
virtual mozilla::ipc::IPCResult RecvHTMLDNSPrefetch(const nsString& hostname,
|
2017-02-15 12:48:15 +03:00
|
|
|
const OriginAttributes& aOriginAttributes,
|
2016-11-15 06:26:00 +03:00
|
|
|
const uint16_t& flags) override;
|
|
|
|
virtual mozilla::ipc::IPCResult RecvCancelHTMLDNSPrefetch(const nsString& hostname,
|
2017-02-15 12:48:15 +03:00
|
|
|
const OriginAttributes& aOriginAttributes,
|
2016-11-15 06:26:00 +03:00
|
|
|
const uint16_t& flags,
|
|
|
|
const nsresult& reason) override;
|
2015-10-28 22:10:20 +03:00
|
|
|
virtual PWebSocketEventListenerParent*
|
|
|
|
AllocPWebSocketEventListenerParent(const uint64_t& aInnerWindowID) override;
|
|
|
|
virtual bool DeallocPWebSocketEventListenerParent(PWebSocketEventListenerParent*) override;
|
2013-06-03 14:14:37 +04:00
|
|
|
|
2015-03-27 23:12:37 +03:00
|
|
|
virtual PDataChannelParent*
|
|
|
|
AllocPDataChannelParent(const uint32_t& channelId) override;
|
|
|
|
virtual bool DeallocPDataChannelParent(PDataChannelParent* parent) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPDataChannelConstructor(PDataChannelParent* aActor,
|
|
|
|
const uint32_t& channelId) override;
|
2015-03-27 23:12:37 +03:00
|
|
|
|
2017-07-27 23:34:54 +03:00
|
|
|
virtual PSimpleChannelParent*
|
|
|
|
AllocPSimpleChannelParent(const uint32_t& channelId) override;
|
|
|
|
virtual bool DeallocPSimpleChannelParent(PSimpleChannelParent* parent) override;
|
|
|
|
|
|
|
|
virtual mozilla::ipc::IPCResult RecvPSimpleChannelConstructor(PSimpleChannelParent* aActor,
|
|
|
|
const uint32_t& channelId) override;
|
|
|
|
|
2017-04-12 21:43:50 +03:00
|
|
|
virtual PFileChannelParent*
|
|
|
|
AllocPFileChannelParent(const uint32_t& channelId) override;
|
|
|
|
virtual bool DeallocPFileChannelParent(PFileChannelParent* parent) override;
|
|
|
|
|
|
|
|
virtual mozilla::ipc::IPCResult RecvPFileChannelConstructor(PFileChannelParent* aActor,
|
|
|
|
const uint32_t& channelId) override;
|
|
|
|
|
2014-03-11 02:04:28 +04:00
|
|
|
virtual PChannelDiverterParent*
|
2015-03-21 19:28:04 +03:00
|
|
|
AllocPChannelDiverterParent(const ChannelDiverterArgs& channel) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2014-03-11 02:04:28 +04:00
|
|
|
RecvPChannelDiverterConstructor(PChannelDiverterParent* actor,
|
2015-03-21 19:28:04 +03:00
|
|
|
const ChannelDiverterArgs& channel) override;
|
2014-03-11 02:04:28 +04:00
|
|
|
virtual bool DeallocPChannelDiverterParent(PChannelDiverterParent* actor)
|
2015-03-21 19:28:04 +03:00
|
|
|
override;
|
2016-06-07 12:46:03 +03:00
|
|
|
virtual PTransportProviderParent*
|
|
|
|
AllocPTransportProviderParent() override;
|
|
|
|
virtual bool
|
|
|
|
DeallocPTransportProviderParent(PTransportProviderParent* aActor) override;
|
2014-03-11 02:04:28 +04:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvOnAuthAvailable(const uint64_t& aCallbackId,
|
|
|
|
const nsString& aUser,
|
|
|
|
const nsString& aPassword,
|
|
|
|
const nsString& aDomain) override;
|
|
|
|
virtual mozilla::ipc::IPCResult RecvOnAuthCancelled(const uint64_t& aCallbackId,
|
|
|
|
const bool& aUserCancel) override;
|
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
|
|
|
virtual mozilla::ipc::IPCResult RecvPredPredict(const ipc::OptionalURIParams& aTargetURI,
|
|
|
|
const ipc::OptionalURIParams& aSourceURI,
|
|
|
|
const PredictorPredictReason& aReason,
|
2017-02-03 06:16:00 +03:00
|
|
|
const OriginAttributes& aOriginAttributes,
|
2016-11-15 06:26:00 +03:00
|
|
|
const bool& hasVerifier) override;
|
|
|
|
|
|
|
|
virtual mozilla::ipc::IPCResult RecvPredLearn(const ipc::URIParams& aTargetURI,
|
|
|
|
const ipc::OptionalURIParams& aSourceURI,
|
|
|
|
const PredictorPredictReason& aReason,
|
2017-02-03 06:16:00 +03:00
|
|
|
const OriginAttributes& aOriginAttributes) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPredReset() override;
|
|
|
|
|
2017-08-30 16:32:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvRequestContextLoadBegin(const uint64_t& rcid) override;
|
|
|
|
virtual mozilla::ipc::IPCResult RecvRequestContextAfterDOMContentLoaded(const uint64_t& rcid) override;
|
2017-03-23 17:40:36 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvRemoveRequestContext(const uint64_t& rcid) override;
|
2017-01-10 17:39:18 +03:00
|
|
|
|
2017-06-24 03:10:54 +03:00
|
|
|
/* WebExtensions */
|
|
|
|
virtual mozilla::ipc::IPCResult
|
|
|
|
RecvGetExtensionStream(const URIParams& aURI,
|
|
|
|
GetExtensionStreamResolver&& aResolve) override;
|
|
|
|
|
|
|
|
virtual mozilla::ipc::IPCResult
|
|
|
|
RecvGetExtensionFD(const URIParams& aURI,
|
|
|
|
GetExtensionFDResolver&& aResolve) override;
|
2009-08-18 23:05:15 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_net_NeckoParent_h
|