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 {
|
2019-02-06 18:57:37 +03:00
|
|
|
friend class 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
|
2016-11-17 16:52:16 +03:00
|
|
|
static const char* GetValidatedOriginAttributes(
|
|
|
|
const SerializedLoadContext& aSerialized, PContentParent* aBrowser,
|
2017-01-12 19:38:48 +03:00
|
|
|
nsIPrincipal* aRequestingPrincipal, 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* CreateChannelLoadContext(
|
2014-06-11 09:44:36 +04:00
|
|
|
const PBrowserOrId& aBrowser, PContentParent* aContent,
|
2012-12-29 13:02:16 +04:00
|
|
|
const SerializedLoadContext& aSerialized,
|
2016-11-03 10:18:51 +03:00
|
|
|
nsIPrincipal* aRequestingPrincipal, nsCOMPtr<nsILoadContext>& aResult);
|
2012-12-29 13:02:16 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
2019-02-06 18:58:07 +03:00
|
|
|
PCookieServiceParent* AllocPCookieServiceParent();
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPCookieServiceConstructor(
|
2015-03-21 19:28:04 +03:00
|
|
|
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-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*,
|
2015-03-21 19:28:04 +03:00
|
|
|
uint32_t, 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:
|
2019-01-11 23:55:07 +03:00
|
|
|
bool mSocketProcessBridgeInited;
|
|
|
|
|
2019-02-06 18:58:07 +03:00
|
|
|
PHttpChannelParent* AllocPHttpChannelParent(
|
2018-11-28 23:40:35 +03:00
|
|
|
const PBrowserOrId&, const SerializedLoadContext&,
|
2019-02-06 18:58:07 +03:00
|
|
|
const HttpChannelCreationArgs& aOpenArgs);
|
2018-11-28 23:40:35 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPHttpChannelConstructor(
|
|
|
|
PHttpChannelParent* aActor, const PBrowserOrId& aBrowser,
|
|
|
|
const SerializedLoadContext& aSerialized,
|
|
|
|
const HttpChannelCreationArgs& aOpenArgs) override;
|
2019-02-06 18:58:07 +03:00
|
|
|
bool DeallocPHttpChannelParent(PHttpChannelParent*);
|
2016-04-11 06:17:02 +03:00
|
|
|
|
2019-02-06 18:58:07 +03:00
|
|
|
PStunAddrsRequestParent* AllocPStunAddrsRequestParent();
|
|
|
|
bool DeallocPStunAddrsRequestParent(PStunAddrsRequestParent* aActor);
|
2017-03-22 03:59:05 +03:00
|
|
|
|
2019-02-06 18:58:07 +03:00
|
|
|
PWebrtcProxyChannelParent* AllocPWebrtcProxyChannelParent(
|
|
|
|
const PBrowserOrId& aBrowser);
|
|
|
|
bool DeallocPWebrtcProxyChannelParent(PWebrtcProxyChannelParent* aActor);
|
2018-06-05 20:10:16 +03:00
|
|
|
|
2019-02-06 18:58:07 +03:00
|
|
|
PAltDataOutputStreamParent* AllocPAltDataOutputStreamParent(
|
2018-04-25 07:01:00 +03:00
|
|
|
const nsCString& type, const int64_t& predictedSize,
|
2019-02-06 18:58:07 +03:00
|
|
|
PHttpChannelParent* channel);
|
|
|
|
bool DeallocPAltDataOutputStreamParent(PAltDataOutputStreamParent* aActor);
|
|
|
|
|
|
|
|
bool DeallocPCookieServiceParent(PCookieServiceParent*);
|
|
|
|
PFTPChannelParent* AllocPFTPChannelParent(
|
2013-07-08 19:48:39 +04:00
|
|
|
const PBrowserOrId& aBrowser, const SerializedLoadContext& aSerialized,
|
2019-02-06 18:58:07 +03:00
|
|
|
const FTPChannelCreationArgs& aOpenArgs);
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPFTPChannelConstructor(
|
|
|
|
PFTPChannelParent* aActor, const PBrowserOrId& aBrowser,
|
|
|
|
const SerializedLoadContext& aSerialized,
|
|
|
|
const FTPChannelCreationArgs& aOpenArgs) override;
|
2019-02-06 18:58:07 +03:00
|
|
|
bool DeallocPFTPChannelParent(PFTPChannelParent*);
|
|
|
|
PWebSocketParent* AllocPWebSocketParent(
|
2015-10-28 22:10:42 +03:00
|
|
|
const PBrowserOrId& browser, const SerializedLoadContext& aSerialized,
|
2019-02-06 18:58:07 +03:00
|
|
|
const uint32_t& aSerial);
|
|
|
|
bool DeallocPWebSocketParent(PWebSocketParent*);
|
|
|
|
PTCPSocketParent* AllocPTCPSocketParent(const nsString& host,
|
|
|
|
const uint16_t& port);
|
2013-02-07 17:06:58 +04:00
|
|
|
|
2019-02-06 18:58:07 +03:00
|
|
|
bool DeallocPTCPSocketParent(PTCPSocketParent*);
|
|
|
|
PTCPServerSocketParent* AllocPTCPServerSocketParent(
|
2014-01-17 23:49:39 +04:00
|
|
|
const uint16_t& aLocalPort, const uint16_t& aBacklog,
|
2019-02-06 18:58:07 +03:00
|
|
|
const bool& aUseArrayBuffers);
|
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;
|
2019-02-06 18:58:07 +03:00
|
|
|
bool DeallocPTCPServerSocketParent(PTCPServerSocketParent*);
|
|
|
|
PUDPSocketParent* AllocPUDPSocketParent(const Principal& aPrincipal,
|
|
|
|
const nsCString& aFilter);
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPUDPSocketConstructor(
|
|
|
|
PUDPSocketParent*, const Principal& aPrincipal,
|
|
|
|
const nsCString& aFilter) override;
|
2019-02-06 18:58:07 +03:00
|
|
|
bool DeallocPUDPSocketParent(PUDPSocketParent*);
|
|
|
|
PDNSRequestParent* AllocPDNSRequestParent(
|
2017-02-14 07:25:35 +03:00
|
|
|
const nsCString& aHost, const OriginAttributes& aOriginAttributes,
|
2019-02-06 18:58:07 +03:00
|
|
|
const uint32_t& aFlags);
|
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,
|
2018-05-16 23:05:03 +03:00
|
|
|
const uint32_t& flags) override;
|
2019-02-06 18:58:07 +03:00
|
|
|
bool DeallocPDNSRequestParent(PDNSRequestParent*);
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvSpeculativeConnect(const URIParams& aURI,
|
|
|
|
const Principal& aPrincipal,
|
|
|
|
const bool& aAnonymous);
|
|
|
|
mozilla::ipc::IPCResult RecvHTMLDNSPrefetch(
|
2016-11-15 06:26:00 +03:00
|
|
|
const nsString& hostname, const bool& isHttps,
|
2019-02-06 18:58:43 +03:00
|
|
|
const OriginAttributes& aOriginAttributes, const uint16_t& flags);
|
|
|
|
mozilla::ipc::IPCResult RecvCancelHTMLDNSPrefetch(
|
2016-11-15 06:26:00 +03:00
|
|
|
const nsString& hostname, const bool& isHttps,
|
2017-02-15 12:48:15 +03:00
|
|
|
const OriginAttributes& aOriginAttributes, const uint16_t& flags,
|
2019-02-06 18:58:43 +03:00
|
|
|
const nsresult& reason);
|
2019-02-06 18:58:07 +03:00
|
|
|
PWebSocketEventListenerParent* AllocPWebSocketEventListenerParent(
|
|
|
|
const uint64_t& aInnerWindowID);
|
|
|
|
bool DeallocPWebSocketEventListenerParent(PWebSocketEventListenerParent*);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-02-06 18:58:07 +03:00
|
|
|
PDataChannelParent* AllocPDataChannelParent(const uint32_t& channelId);
|
|
|
|
bool DeallocPDataChannelParent(PDataChannelParent* parent);
|
2015-03-27 23:12:37 +03:00
|
|
|
|
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
|
|
|
|
2019-02-06 18:58:07 +03:00
|
|
|
PSimpleChannelParent* AllocPSimpleChannelParent(const uint32_t& channelId);
|
|
|
|
bool DeallocPSimpleChannelParent(PSimpleChannelParent* parent);
|
2017-07-27 23:34:54 +03:00
|
|
|
|
|
|
|
virtual mozilla::ipc::IPCResult RecvPSimpleChannelConstructor(
|
|
|
|
PSimpleChannelParent* aActor, const uint32_t& channelId) override;
|
|
|
|
|
2019-02-06 18:58:07 +03:00
|
|
|
PFileChannelParent* AllocPFileChannelParent(const uint32_t& channelId);
|
|
|
|
bool DeallocPFileChannelParent(PFileChannelParent* parent);
|
2017-04-12 21:43:50 +03:00
|
|
|
|
|
|
|
virtual mozilla::ipc::IPCResult RecvPFileChannelConstructor(
|
|
|
|
PFileChannelParent* aActor, const uint32_t& channelId) override;
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-02-06 18:58:07 +03:00
|
|
|
PChannelDiverterParent* AllocPChannelDiverterParent(
|
|
|
|
const ChannelDiverterArgs& channel);
|
2014-03-11 02:04:28 +04:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPChannelDiverterConstructor(
|
|
|
|
PChannelDiverterParent* actor,
|
2015-03-21 19:28:04 +03:00
|
|
|
const ChannelDiverterArgs& channel) override;
|
2019-02-06 18:58:07 +03:00
|
|
|
bool DeallocPChannelDiverterParent(PChannelDiverterParent* actor);
|
|
|
|
PTransportProviderParent* AllocPTransportProviderParent();
|
|
|
|
bool DeallocPTransportProviderParent(PTransportProviderParent* aActor);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvOnAuthAvailable(const uint64_t& aCallbackId,
|
|
|
|
const nsString& aUser,
|
|
|
|
const nsString& aPassword,
|
|
|
|
const nsString& aDomain);
|
|
|
|
mozilla::ipc::IPCResult RecvOnAuthCancelled(const uint64_t& aCallbackId,
|
|
|
|
const bool& aUserCancel);
|
2014-06-11 09:44:36 +04:00
|
|
|
|
2015-06-18 12:23:00 +03:00
|
|
|
/* Predictor Messages */
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvPredPredict(
|
2019-03-06 17:05:50 +03:00
|
|
|
const Maybe<ipc::URIParams>& aTargetURI,
|
|
|
|
const Maybe<ipc::URIParams>& aSourceURI,
|
2016-11-15 06:26:00 +03:00
|
|
|
const PredictorPredictReason& aReason,
|
2019-02-06 18:58:43 +03:00
|
|
|
const OriginAttributes& aOriginAttributes, const bool& hasVerifier);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvPredLearn(
|
2019-03-06 17:05:50 +03:00
|
|
|
const ipc::URIParams& aTargetURI, const Maybe<ipc::URIParams>& aSourceURI,
|
2016-11-15 06:26:00 +03:00
|
|
|
const PredictorPredictReason& aReason,
|
2019-02-06 18:58:43 +03:00
|
|
|
const OriginAttributes& aOriginAttributes);
|
|
|
|
mozilla::ipc::IPCResult RecvPredReset();
|
2016-11-15 06:26:00 +03:00
|
|
|
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvRequestContextLoadBegin(const uint64_t& rcid);
|
|
|
|
mozilla::ipc::IPCResult RecvRequestContextAfterDOMContentLoaded(
|
|
|
|
const uint64_t& rcid);
|
|
|
|
mozilla::ipc::IPCResult RecvRemoveRequestContext(const uint64_t& rcid);
|
2017-01-10 17:39:18 +03:00
|
|
|
|
2017-06-24 03:10:54 +03:00
|
|
|
/* WebExtensions */
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvGetExtensionStream(
|
|
|
|
const URIParams& aURI, GetExtensionStreamResolver&& aResolve);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvGetExtensionFD(const URIParams& aURI,
|
|
|
|
GetExtensionFDResolver&& aResolve);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-03-15 21:55:10 +03:00
|
|
|
PClassifierDummyChannelParent* AllocPClassifierDummyChannelParent(
|
2018-10-25 11:44:12 +03:00
|
|
|
nsIURI* aURI, nsIURI* aTopWindowURI, const nsresult& aTopWindowURIResult,
|
2019-03-04 09:30:00 +03:00
|
|
|
const Maybe<LoadInfoArgs>& aLoadInfo);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-03-15 21:55:10 +03:00
|
|
|
bool DeallocPClassifierDummyChannelParent(
|
|
|
|
PClassifierDummyChannelParent* aChild);
|
2018-11-30 13:46:48 +03:00
|
|
|
|
2019-03-15 21:55:10 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvPClassifierDummyChannelConstructor(
|
|
|
|
PClassifierDummyChannelParent* aActor, nsIURI* aURI,
|
|
|
|
nsIURI* aTopWindowURI, const nsresult& aTopWindowURIResult,
|
2019-03-04 09:30:00 +03:00
|
|
|
const Maybe<LoadInfoArgs>& aLoadInfo) override;
|
2019-01-11 23:55:07 +03:00
|
|
|
|
2019-02-06 18:58:43 +03:00
|
|
|
mozilla::ipc::IPCResult RecvInitSocketProcessBridge(
|
|
|
|
InitSocketProcessBridgeResolver&& aResolver);
|
2019-03-18 17:50:56 +03:00
|
|
|
|
|
|
|
mozilla::ipc::IPCResult RecvEnsureHSTSData(
|
|
|
|
EnsureHSTSDataResolver&& aResolver);
|
2009-08-18 23:05:15 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_net_NeckoParent_h
|