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"
|
2014-08-23 07:05:56 +04:00
|
|
|
#include "mozilla/net/OfflineObserver.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
|
|
|
|
, public DisconnectableParent
|
2009-08-18 23:05:15 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NeckoParent();
|
|
|
|
virtual ~NeckoParent();
|
|
|
|
|
2013-08-21 10:49:41 +04:00
|
|
|
MOZ_WARN_UNUSED_RESULT
|
|
|
|
static const char *
|
|
|
|
GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
|
|
|
PContentParent* aBrowser,
|
2015-09-23 11:10:21 +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.
|
|
|
|
*/
|
|
|
|
MOZ_WARN_UNUSED_RESULT
|
|
|
|
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,
|
|
|
|
nsCOMPtr<nsILoadContext> &aResult);
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
|
|
|
virtual nsresult OfflineNotification(nsISupports *) override;
|
|
|
|
virtual uint32_t GetAppId() override { return NECKO_UNKNOWN_APP_ID; }
|
2013-06-03 14:14:37 +04:00
|
|
|
virtual void
|
|
|
|
CloneManagees(ProtocolBase* aSource,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::ipc::ProtocolCloneContext* aCtx) override;
|
|
|
|
virtual PCookieServiceParent* AllocPCookieServiceParent() override;
|
2013-06-03 14:14:37 +04:00
|
|
|
virtual bool
|
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;
|
2013-06-22 20:09:19 +04:00
|
|
|
virtual bool
|
|
|
|
RecvPHttpChannelConstructor(
|
|
|
|
PHttpChannelParent* aActor,
|
2014-06-11 09:44:36 +04:00
|
|
|
const PBrowserOrId& aBrowser,
|
2013-06-22 20:09:19 +04:00
|
|
|
const SerializedLoadContext& aSerialized,
|
2015-03-21 19:28:04 +03:00
|
|
|
const HttpChannelCreationArgs& aOpenArgs) override;
|
|
|
|
virtual bool DeallocPHttpChannelParent(PHttpChannelParent*) override;
|
|
|
|
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;
|
2013-06-22 20:09:19 +04:00
|
|
|
virtual bool
|
|
|
|
RecvPFTPChannelConstructor(
|
|
|
|
PFTPChannelParent* aActor,
|
2014-06-11 09:44:36 +04:00
|
|
|
const PBrowserOrId& aBrowser,
|
2013-06-22 20:09:19 +04:00
|
|
|
const SerializedLoadContext& aSerialized,
|
2015-03-21 19:28:04 +03:00
|
|
|
const FTPChannelCreationArgs& aOpenArgs) override;
|
|
|
|
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 16:28:37 +03:00
|
|
|
const SerializedLoadContext& aSerialized) 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
|
|
|
|
2014-05-30 23:50:51 +04:00
|
|
|
virtual PRemoteOpenFileParent*
|
|
|
|
AllocPRemoteOpenFileParent(const SerializedLoadContext& aSerialized,
|
|
|
|
const URIParams& aFileURI,
|
2015-03-21 19:28:04 +03:00
|
|
|
const OptionalURIParams& aAppURI) override;
|
2014-05-30 23:50:51 +04:00
|
|
|
virtual bool
|
|
|
|
RecvPRemoteOpenFileConstructor(PRemoteOpenFileParent* aActor,
|
|
|
|
const SerializedLoadContext& aSerialized,
|
|
|
|
const URIParams& aFileURI,
|
|
|
|
const OptionalURIParams& aAppURI)
|
2015-03-21 19:28:04 +03:00
|
|
|
override;
|
2013-07-08 19:48:39 +04:00
|
|
|
virtual bool DeallocPRemoteOpenFileParent(PRemoteOpenFileParent* aActor)
|
2015-03-21 19:28:04 +03:00
|
|
|
override;
|
2012-12-22 17:56:21 +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;
|
2013-07-29 21:36:43 +04:00
|
|
|
virtual bool RecvPTCPServerSocketConstructor(PTCPServerSocketParent*,
|
|
|
|
const uint16_t& aLocalPort,
|
|
|
|
const uint16_t& aBacklog,
|
2015-03-25 17:36:56 +03:00
|
|
|
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;
|
|
|
|
virtual bool 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,
|
2015-02-19 08:14:00 +03:00
|
|
|
const uint32_t& aFlags,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsCString& aNetworkInterface) override;
|
2013-12-11 23:03:51 +04:00
|
|
|
virtual bool RecvPDNSRequestConstructor(PDNSRequestParent* actor,
|
|
|
|
const nsCString& hostName,
|
2015-02-19 08:14:00 +03:00
|
|
|
const uint32_t& flags,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsCString& aNetworkInterface) override;
|
|
|
|
virtual bool DeallocPDNSRequestParent(PDNSRequestParent*) override;
|
2015-05-06 04:15:36 +03:00
|
|
|
virtual bool RecvSpeculativeConnect(const URIParams& aURI, const bool& aAnonymous) override;
|
2010-07-26 22:49:09 +04:00
|
|
|
virtual bool RecvHTMLDNSPrefetch(const nsString& hostname,
|
2015-03-21 19:28:04 +03:00
|
|
|
const uint16_t& flags) override;
|
2012-01-21 03:14:46 +04:00
|
|
|
virtual bool RecvCancelHTMLDNSPrefetch(const nsString& hostname,
|
2012-08-22 19:56:38 +04:00
|
|
|
const uint16_t& flags,
|
2015-03-21 19:28:04 +03:00
|
|
|
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
|
|
|
|
|
|
|
virtual mozilla::ipc::IProtocol*
|
|
|
|
CloneProtocol(Channel* aChannel,
|
2015-03-21 19:28:04 +03:00
|
|
|
mozilla::ipc::ProtocolCloneContext* aCtx) override;
|
2015-03-27 23:12:37 +03:00
|
|
|
|
|
|
|
virtual PDataChannelParent*
|
|
|
|
AllocPDataChannelParent(const uint32_t& channelId) override;
|
|
|
|
virtual bool DeallocPDataChannelParent(PDataChannelParent* parent) override;
|
|
|
|
|
|
|
|
virtual bool RecvPDataChannelConstructor(PDataChannelParent* aActor,
|
|
|
|
const uint32_t& channelId) override;
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual PRtspControllerParent* AllocPRtspControllerParent() override;
|
|
|
|
virtual bool DeallocPRtspControllerParent(PRtspControllerParent*) override;
|
2013-06-03 14:14:37 +04:00
|
|
|
|
2014-04-03 15:08:34 +04:00
|
|
|
virtual PRtspChannelParent*
|
|
|
|
AllocPRtspChannelParent(const RtspChannelConnectArgs& aArgs)
|
2015-03-21 19:28:04 +03:00
|
|
|
override;
|
2014-04-03 15:08:34 +04:00
|
|
|
virtual bool
|
|
|
|
RecvPRtspChannelConstructor(PRtspChannelParent* aActor,
|
|
|
|
const RtspChannelConnectArgs& aArgs)
|
2015-03-21 19:28:04 +03:00
|
|
|
override;
|
|
|
|
virtual bool DeallocPRtspChannelParent(PRtspChannelParent*) override;
|
2014-04-03 15:08:34 +04:00
|
|
|
|
2014-03-11 02:04:28 +04:00
|
|
|
virtual PChannelDiverterParent*
|
2015-03-21 19:28:04 +03:00
|
|
|
AllocPChannelDiverterParent(const ChannelDiverterArgs& channel) override;
|
2014-03-11 02:04:28 +04:00
|
|
|
virtual bool
|
|
|
|
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;
|
2014-03-11 02:04:28 +04:00
|
|
|
|
2014-06-11 09:44:36 +04:00
|
|
|
virtual bool RecvOnAuthAvailable(const uint64_t& aCallbackId,
|
|
|
|
const nsString& aUser,
|
|
|
|
const nsString& aPassword,
|
2015-03-21 19:28:04 +03:00
|
|
|
const nsString& aDomain) override;
|
2014-06-11 09:44:36 +04:00
|
|
|
virtual bool RecvOnAuthCancelled(const uint64_t& aCallbackId,
|
2015-03-21 19:28:04 +03:00
|
|
|
const bool& aUserCancel) override;
|
2014-06-11 09:44:36 +04:00
|
|
|
|
2015-06-18 12:23:00 +03:00
|
|
|
/* Predictor Messages */
|
|
|
|
virtual bool RecvPredPredict(const ipc::OptionalURIParams& aTargetURI,
|
|
|
|
const ipc::OptionalURIParams& aSourceURI,
|
|
|
|
const PredictorPredictReason& aReason,
|
|
|
|
const IPC::SerializedLoadContext& aLoadContext,
|
|
|
|
const bool& hasVerifier) override;
|
|
|
|
|
|
|
|
virtual bool RecvPredLearn(const ipc::URIParams& aTargetURI,
|
|
|
|
const ipc::OptionalURIParams& aSourceURI,
|
|
|
|
const PredictorPredictReason& aReason,
|
|
|
|
const IPC::SerializedLoadContext& aLoadContext) override;
|
|
|
|
virtual bool RecvPredReset() override;
|
|
|
|
|
2015-07-31 23:50:08 +03:00
|
|
|
virtual bool RecvRemoveSchedulingContext(const nsCString& scid) override;
|
|
|
|
|
2012-12-22 17:56:21 +04:00
|
|
|
private:
|
|
|
|
nsCString mCoreAppsBasePath;
|
|
|
|
nsCString mWebAppsBasePath;
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<OfflineObserver> mObserver;
|
2009-08-18 23:05:15 +04:00
|
|
|
};
|
|
|
|
|
2015-06-18 12:23:00 +03:00
|
|
|
/**
|
|
|
|
* Reference to the PNecko Parent protocol.
|
|
|
|
*/
|
|
|
|
extern PNeckoParent *gNeckoParent;
|
|
|
|
|
2009-08-18 23:05:15 +04:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_net_NeckoParent_h
|