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