mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 558623 - e10s HTTP: combine PHttpChannel constructor with SendAsyncOpen/SendRedirect1Begin r=jdm
--HG-- rename : netwerk/protocol/http/nsHttp.h => netwerk/protocol/http/HttpLog.h extra : rebase_source : 80cac843f38f2237c9fd932c428e1c1fda781b50
This commit is contained in:
parent
421a649753
commit
118466c301
85
netwerk/ipc/NeckoChannelParams.ipdlh
Normal file
85
netwerk/ipc/NeckoChannelParams.ipdlh
Normal file
@ -0,0 +1,85 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 ft=c: */
|
||||
|
||||
/* 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/. */
|
||||
|
||||
include URIParams;
|
||||
include InputStreamParams;
|
||||
include "mozilla/net/PHttpChannelParams.h";
|
||||
|
||||
using mozilla::void_t;
|
||||
using RequestHeaderTuples;
|
||||
using nsHttpAtom;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// HTTP IPDL structs
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct HttpChannelOpenArgs
|
||||
{
|
||||
URIParams uri;
|
||||
// - TODO: bug 571161: unclear if any HTTP channel clients ever
|
||||
// set originalURI != uri (about:credits?); also not clear if
|
||||
// chrome channel would ever need to know. Get rid of next arg?
|
||||
OptionalURIParams original;
|
||||
OptionalURIParams doc;
|
||||
OptionalURIParams referrer;
|
||||
OptionalURIParams apiRedirectTo;
|
||||
uint32_t loadFlags;
|
||||
RequestHeaderTuples requestHeaders;
|
||||
nsHttpAtom requestMethod;
|
||||
OptionalInputStreamParams uploadStream;
|
||||
bool uploadStreamHasHeaders;
|
||||
uint16_t priority;
|
||||
uint8_t redirectionLimit;
|
||||
bool allowPipelining;
|
||||
bool forceAllowThirdPartyCookie;
|
||||
bool resumeAt;
|
||||
uint64_t startPos;
|
||||
nsCString entityID;
|
||||
bool chooseApplicationCache;
|
||||
nsCString appCacheClientID;
|
||||
bool allowSpdy;
|
||||
};
|
||||
|
||||
struct HttpChannelConnectArgs
|
||||
{
|
||||
uint32_t channelId;
|
||||
};
|
||||
|
||||
union HttpChannelCreationArgs
|
||||
{
|
||||
HttpChannelOpenArgs; // For AsyncOpen: the common case.
|
||||
HttpChannelConnectArgs; // Used for redirected-to channels
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// FTP IPDL structs
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
struct FTPChannelOpenArgs
|
||||
{
|
||||
URIParams uri;
|
||||
uint64_t startPos;
|
||||
nsCString entityID;
|
||||
OptionalInputStreamParams uploadStream;
|
||||
};
|
||||
|
||||
struct FTPChannelConnectArgs
|
||||
{
|
||||
uint32_t channelId;
|
||||
};
|
||||
|
||||
union FTPChannelCreationArgs
|
||||
{
|
||||
FTPChannelOpenArgs; // For AsyncOpen: the common case.
|
||||
FTPChannelConnectArgs; // Used for redirected-to channels
|
||||
};
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
@ -62,7 +62,8 @@ void NeckoChild::DestroyNeckoChild()
|
||||
|
||||
PHttpChannelChild*
|
||||
NeckoChild::AllocPHttpChannel(PBrowserChild* browser,
|
||||
const SerializedLoadContext& loadContext)
|
||||
const SerializedLoadContext& loadContext,
|
||||
const HttpChannelCreationArgs& aOpenArgs)
|
||||
{
|
||||
// We don't allocate here: instead we always use IPDL constructor that takes
|
||||
// an existing HttpChildChannel
|
||||
@ -82,7 +83,8 @@ NeckoChild::DeallocPHttpChannel(PHttpChannelChild* channel)
|
||||
|
||||
PFTPChannelChild*
|
||||
NeckoChild::AllocPFTPChannel(PBrowserChild* aBrowser,
|
||||
const SerializedLoadContext& aSerialized)
|
||||
const SerializedLoadContext& aSerialized,
|
||||
const FTPChannelCreationArgs& aOpenArgs)
|
||||
{
|
||||
// We don't allocate here: see FTPChannelChild::AsyncOpen()
|
||||
NS_RUNTIMEABORT("AllocPFTPChannel should not be called");
|
||||
|
@ -26,15 +26,18 @@ public:
|
||||
static void DestroyNeckoChild();
|
||||
|
||||
protected:
|
||||
virtual PHttpChannelChild* AllocPHttpChannel(PBrowserChild*,
|
||||
const SerializedLoadContext&);
|
||||
virtual PHttpChannelChild*
|
||||
AllocPHttpChannel(PBrowserChild*, const SerializedLoadContext&,
|
||||
const HttpChannelCreationArgs& aOpenArgs);
|
||||
virtual bool DeallocPHttpChannel(PHttpChannelChild*);
|
||||
virtual PCookieServiceChild* AllocPCookieService();
|
||||
virtual bool DeallocPCookieService(PCookieServiceChild*);
|
||||
virtual PWyciwygChannelChild* AllocPWyciwygChannel();
|
||||
virtual bool DeallocPWyciwygChannel(PWyciwygChannelChild*);
|
||||
virtual PFTPChannelChild* AllocPFTPChannel(PBrowserChild* aBrowser,
|
||||
const SerializedLoadContext& aSerialized);
|
||||
virtual PFTPChannelChild*
|
||||
AllocPFTPChannel(PBrowserChild* aBrowser,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
const FTPChannelCreationArgs& aOpenArgs);
|
||||
virtual bool DeallocPFTPChannel(PFTPChannelChild*);
|
||||
virtual PWebSocketChild* AllocPWebSocket(PBrowserChild*, const SerializedLoadContext&);
|
||||
virtual bool DeallocPWebSocket(PWebSocketChild*);
|
||||
|
@ -35,6 +35,12 @@ namespace net {
|
||||
// C++ file contents
|
||||
NeckoParent::NeckoParent()
|
||||
{
|
||||
// Init HTTP protocol handler now since we need atomTable up and running very
|
||||
// early (IPDL argument handling for PHttpChannel constructor needs it) so
|
||||
// normal init (during 1st Http channel request) isn't early enough.
|
||||
nsCOMPtr<nsIProtocolHandler> proto =
|
||||
do_GetService("@mozilla.org/network/protocol;1?name=http");
|
||||
|
||||
if (UsingNeckoIPCSecurity()) {
|
||||
// cache values for core/packaged apps basepaths
|
||||
nsAutoString corePath, webPath;
|
||||
@ -153,7 +159,8 @@ NeckoParent::CreateChannelLoadContext(PBrowserParent* aBrowser,
|
||||
|
||||
PHttpChannelParent*
|
||||
NeckoParent::AllocPHttpChannel(PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized)
|
||||
const SerializedLoadContext& aSerialized,
|
||||
const HttpChannelCreationArgs& aOpenArgs)
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
const char *error = CreateChannelLoadContext(aBrowser, aSerialized,
|
||||
@ -178,9 +185,21 @@ NeckoParent::DeallocPHttpChannel(PHttpChannelParent* channel)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
NeckoParent::RecvPHttpChannelConstructor(
|
||||
PHttpChannelParent* aActor,
|
||||
PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
const HttpChannelCreationArgs& aOpenArgs)
|
||||
{
|
||||
HttpChannelParent* p = static_cast<HttpChannelParent*>(aActor);
|
||||
return p->Init(aOpenArgs);
|
||||
}
|
||||
|
||||
PFTPChannelParent*
|
||||
NeckoParent::AllocPFTPChannel(PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized)
|
||||
const SerializedLoadContext& aSerialized,
|
||||
const FTPChannelCreationArgs& aOpenArgs)
|
||||
{
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
const char *error = CreateChannelLoadContext(aBrowser, aSerialized,
|
||||
@ -205,6 +224,17 @@ NeckoParent::DeallocPFTPChannel(PFTPChannelParent* channel)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
NeckoParent::RecvPFTPChannelConstructor(
|
||||
PFTPChannelParent* aActor,
|
||||
PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
const FTPChannelCreationArgs& aOpenArgs)
|
||||
{
|
||||
FTPChannelParent* p = static_cast<FTPChannelParent*>(aActor);
|
||||
return p->Init(aOpenArgs);
|
||||
}
|
||||
|
||||
PCookieServiceParent*
|
||||
NeckoParent::AllocPCookieService()
|
||||
{
|
||||
|
@ -51,15 +51,30 @@ public:
|
||||
nsCOMPtr<nsILoadContext> &aResult);
|
||||
|
||||
protected:
|
||||
virtual PHttpChannelParent* AllocPHttpChannel(PBrowserParent*,
|
||||
const SerializedLoadContext&);
|
||||
virtual PHttpChannelParent*
|
||||
AllocPHttpChannel(PBrowserParent*, const SerializedLoadContext&,
|
||||
const HttpChannelCreationArgs& aOpenArgs);
|
||||
virtual bool
|
||||
RecvPHttpChannelConstructor(
|
||||
PHttpChannelParent* aActor,
|
||||
PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
const HttpChannelCreationArgs& aOpenArgs);
|
||||
virtual bool DeallocPHttpChannel(PHttpChannelParent*);
|
||||
virtual PCookieServiceParent* AllocPCookieService();
|
||||
virtual bool DeallocPCookieService(PCookieServiceParent*);
|
||||
virtual PWyciwygChannelParent* AllocPWyciwygChannel();
|
||||
virtual bool DeallocPWyciwygChannel(PWyciwygChannelParent*);
|
||||
virtual PFTPChannelParent* AllocPFTPChannel(PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized);
|
||||
virtual PFTPChannelParent*
|
||||
AllocPFTPChannel(PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
const FTPChannelCreationArgs& aOpenArgs);
|
||||
virtual bool
|
||||
RecvPFTPChannelConstructor(
|
||||
PFTPChannelParent* aActor,
|
||||
PBrowserParent* aBrowser,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
const FTPChannelCreationArgs& aOpenArgs);
|
||||
virtual bool DeallocPFTPChannel(PFTPChannelParent*);
|
||||
virtual PWebSocketParent* AllocPWebSocket(PBrowserParent* browser,
|
||||
const SerializedLoadContext& aSerialized);
|
||||
|
@ -14,7 +14,11 @@ include protocol PFTPChannel;
|
||||
include protocol PWebSocket;
|
||||
include protocol PTCPSocket;
|
||||
include protocol PRemoteOpenFile;
|
||||
include protocol PBlob; //FIXME: bug #792908
|
||||
|
||||
include URIParams;
|
||||
include InputStreamParams;
|
||||
include NeckoChannelParams;
|
||||
|
||||
include "SerializedLoadContext.h";
|
||||
|
||||
@ -23,7 +27,6 @@ using IPC::SerializedLoadContext;
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
|
||||
//-------------------------------------------------------------------
|
||||
sync protocol PNecko
|
||||
{
|
||||
@ -41,9 +44,12 @@ parent:
|
||||
|
||||
PCookieService();
|
||||
PHttpChannel(nullable PBrowser browser,
|
||||
SerializedLoadContext loadContext);
|
||||
SerializedLoadContext loadContext,
|
||||
HttpChannelCreationArgs args);
|
||||
PWyciwygChannel();
|
||||
PFTPChannel(PBrowser browser, SerializedLoadContext loadContext);
|
||||
PFTPChannel(PBrowser browser, SerializedLoadContext loadContext,
|
||||
FTPChannelCreationArgs args);
|
||||
|
||||
PWebSocket(PBrowser browser, SerializedLoadContext loadContext);
|
||||
PTCPSocket(nsString host, uint16_t port, bool useSSL, nsString binaryType,
|
||||
nullable PBrowser browser);
|
||||
|
@ -5,5 +5,6 @@
|
||||
IPDLSRCS = \
|
||||
PNecko.ipdl \
|
||||
PRemoteOpenFile.ipdl \
|
||||
NeckoChannelParams.ipdlh \
|
||||
$(NULL)
|
||||
|
||||
|
@ -169,8 +169,6 @@ FTPChannelChild::AsyncOpen(::nsIStreamListener* listener, nsISupports* aContext)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
// FIXME: like bug 558623, merge constructor+SendAsyncOpen into 1 IPC msg
|
||||
gNeckoChild->SendPFTPChannelConstructor(this, tabChild, IPC::SerializedLoadContext(this));
|
||||
mListener = listener;
|
||||
mListenerContext = aContext;
|
||||
|
||||
@ -178,13 +176,18 @@ FTPChannelChild::AsyncOpen(::nsIStreamListener* listener, nsISupports* aContext)
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->AddRequest(this, nullptr);
|
||||
|
||||
URIParams uri;
|
||||
SerializeURI(nsBaseChannel::URI(), uri);
|
||||
|
||||
OptionalInputStreamParams uploadStream;
|
||||
SerializeInputStream(mUploadStream, uploadStream);
|
||||
|
||||
SendAsyncOpen(uri, mStartPos, mEntityID, uploadStream);
|
||||
FTPChannelOpenArgs openArgs;
|
||||
SerializeURI(nsBaseChannel::URI(), openArgs.uri());
|
||||
openArgs.startPos() = mStartPos;
|
||||
openArgs.entityID() = mEntityID;
|
||||
openArgs.uploadStream() = uploadStream;
|
||||
|
||||
gNeckoChild->
|
||||
SendPFTPChannelConstructor(this, tabChild, IPC::SerializedLoadContext(this),
|
||||
openArgs);
|
||||
|
||||
// The socket transport layer in the chrome process now has a logical ref to
|
||||
// us until OnStopRequest is called.
|
||||
@ -517,12 +520,13 @@ FTPChannelChild::ConnectParent(uint32_t id)
|
||||
// until OnStopRequest, or we do a redirect, or we hit an IPDL error.
|
||||
AddIPDLReference();
|
||||
|
||||
if (!gNeckoChild->SendPFTPChannelConstructor(this, tabChild,
|
||||
IPC::SerializedLoadContext(this)))
|
||||
return NS_ERROR_FAILURE;
|
||||
FTPChannelConnectArgs connectArgs(id);
|
||||
|
||||
if (!SendConnectChannel(id))
|
||||
if (!gNeckoChild->SendPFTPChannelConstructor(this, tabChild,
|
||||
IPC::SerializedLoadContext(this),
|
||||
connectArgs)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -60,11 +60,35 @@ NS_IMPL_ISUPPORTS4(FTPChannelParent,
|
||||
// FTPChannelParent::PFTPChannelParent
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// FTPChannelParent methods
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool
|
||||
FTPChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
||||
const uint64_t& aStartPos,
|
||||
const nsCString& aEntityID,
|
||||
const OptionalInputStreamParams& aUploadStream)
|
||||
FTPChannelParent::Init(const FTPChannelCreationArgs& aArgs)
|
||||
{
|
||||
switch (aArgs.type()) {
|
||||
case FTPChannelCreationArgs::TFTPChannelOpenArgs:
|
||||
{
|
||||
const FTPChannelOpenArgs& a = aArgs.get_FTPChannelOpenArgs();
|
||||
return DoAsyncOpen(a.uri(), a.startPos(), a.entityID(), a.uploadStream());
|
||||
}
|
||||
case FTPChannelCreationArgs::TFTPChannelConnectArgs:
|
||||
{
|
||||
const FTPChannelConnectArgs& cArgs = aArgs.get_FTPChannelConnectArgs();
|
||||
return ConnectChannel(cArgs.channelId());
|
||||
}
|
||||
default:
|
||||
NS_NOTREACHED("unknown open type");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
FTPChannelParent::DoAsyncOpen(const URIParams& aURI,
|
||||
const uint64_t& aStartPos,
|
||||
const nsCString& aEntityID,
|
||||
const OptionalInputStreamParams& aUploadStream)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
|
||||
if (!uri)
|
||||
@ -73,7 +97,7 @@ FTPChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
||||
#ifdef DEBUG
|
||||
nsCString uriSpec;
|
||||
uri->GetSpec(uriSpec);
|
||||
LOG(("FTPChannelParent RecvAsyncOpen [this=%p uri=%s]\n",
|
||||
LOG(("FTPChannelParent DoAsyncOpen [this=%p uri=%s]\n",
|
||||
this, uriSpec.get()));
|
||||
#endif
|
||||
|
||||
@ -117,7 +141,7 @@ FTPChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
||||
}
|
||||
|
||||
bool
|
||||
FTPChannelParent::RecvConnectChannel(const uint32_t& channelId)
|
||||
FTPChannelParent::ConnectChannel(const uint32_t& channelId)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -34,12 +34,17 @@ public:
|
||||
FTPChannelParent(nsILoadContext* aLoadContext, PBOverrideStatus aOverrideStatus);
|
||||
virtual ~FTPChannelParent();
|
||||
|
||||
bool Init(const FTPChannelCreationArgs& aOpenArgs);
|
||||
|
||||
protected:
|
||||
virtual bool RecvAsyncOpen(const URIParams& uri,
|
||||
const uint64_t& startPos,
|
||||
const nsCString& entityID,
|
||||
const OptionalInputStreamParams& uploadStream) MOZ_OVERRIDE;
|
||||
virtual bool RecvConnectChannel(const uint32_t& channelId) MOZ_OVERRIDE;
|
||||
bool DoAsyncOpen(const URIParams& aURI, const uint64_t& aStartPos,
|
||||
const nsCString& aEntityID,
|
||||
const OptionalInputStreamParams& aUploadStream);
|
||||
|
||||
// used to connect redirected-to channel in parent with just created
|
||||
// ChildChannel. Used during HTTP->FTP redirects.
|
||||
bool ConnectChannel(const uint32_t& channelId);
|
||||
|
||||
virtual bool RecvCancel(const nsresult& status) MOZ_OVERRIDE;
|
||||
virtual bool RecvSuspend() MOZ_OVERRIDE;
|
||||
virtual bool RecvResume() MOZ_OVERRIDE;
|
||||
|
@ -9,6 +9,8 @@ include protocol PNecko;
|
||||
include InputStreamParams;
|
||||
include URIParams;
|
||||
|
||||
//FIXME: bug #792908 (NeckoChannelParams already included by PNecko)
|
||||
include NeckoChannelParams;
|
||||
include protocol PBlob; //FIXME: bug #792908
|
||||
|
||||
include "SerializedLoadContext.h";
|
||||
@ -23,14 +25,11 @@ async protocol PFTPChannel
|
||||
manager PNecko;
|
||||
|
||||
parent:
|
||||
// Note: channels are opened during construction, so no open method here:
|
||||
// see PNecko.ipdl
|
||||
|
||||
__delete__();
|
||||
|
||||
AsyncOpen(URIParams uri,
|
||||
uint64_t startPos,
|
||||
nsCString entityID,
|
||||
OptionalInputStreamParams uploadStream);
|
||||
|
||||
ConnectChannel(uint32_t channelId);
|
||||
Cancel(nsresult status);
|
||||
Suspend();
|
||||
Resume();
|
||||
|
@ -817,14 +817,14 @@ HttpChannelChild::ConnectParent(uint32_t id)
|
||||
// until OnStopRequest, or we do a redirect, or we hit an IPDL error.
|
||||
AddIPDLReference();
|
||||
|
||||
if (!gNeckoChild->SendPHttpChannelConstructor(
|
||||
this, tabChild, IPC::SerializedLoadContext(this))) {
|
||||
HttpChannelConnectArgs connectArgs(id);
|
||||
if (!gNeckoChild->
|
||||
SendPHttpChannelConstructor(this, tabChild,
|
||||
IPC::SerializedLoadContext(this),
|
||||
connectArgs)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!SendConnectChannel(id))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1048,8 +1048,6 @@ HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
|
||||
// Send request to the chrome process...
|
||||
//
|
||||
|
||||
// FIXME: bug 558623: Combine constructor and SendAsyncOpen into one IPC msg
|
||||
|
||||
mozilla::dom::TabChild* tabChild = nullptr;
|
||||
nsCOMPtr<nsITabChild> iTabChild;
|
||||
GetCallback(iTabChild);
|
||||
@ -1060,31 +1058,37 @@ HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
HttpChannelOpenArgs openArgs;
|
||||
// No access to HttpChannelOpenArgs members, but they each have a
|
||||
// function with the struct name that returns a ref.
|
||||
SerializeURI(mURI, openArgs.uri());
|
||||
SerializeURI(mOriginalURI, openArgs.original());
|
||||
SerializeURI(mDocumentURI, openArgs.doc());
|
||||
SerializeURI(mReferrer, openArgs.referrer());
|
||||
SerializeURI(mAPIRedirectToURI, openArgs.apiRedirectTo());
|
||||
openArgs.loadFlags() = mLoadFlags;
|
||||
openArgs.requestHeaders() = mClientSetRequestHeaders;
|
||||
openArgs.requestMethod() = mRequestHead.Method();
|
||||
SerializeInputStream(mUploadStream, openArgs.uploadStream());
|
||||
openArgs.uploadStreamHasHeaders() = mUploadStreamHasHeaders;
|
||||
openArgs.priority() = mPriority;
|
||||
openArgs.redirectionLimit() = mRedirectionLimit;
|
||||
openArgs.allowPipelining() = mAllowPipelining;
|
||||
openArgs.forceAllowThirdPartyCookie() = mForceAllowThirdPartyCookie;
|
||||
openArgs.resumeAt() = mSendResumeAt;
|
||||
openArgs.startPos() = mStartPos;
|
||||
openArgs.entityID() = mEntityID;
|
||||
openArgs.chooseApplicationCache() = mChooseApplicationCache;
|
||||
openArgs.appCacheClientID() = appCacheClientId;
|
||||
openArgs.allowSpdy() = mAllowSpdy;
|
||||
|
||||
// The socket transport in the chrome process now holds a logical ref to us
|
||||
// until OnStopRequest, or we do a redirect, or we hit an IPDL error.
|
||||
AddIPDLReference();
|
||||
|
||||
gNeckoChild->SendPHttpChannelConstructor(this, tabChild,
|
||||
IPC::SerializedLoadContext(this));
|
||||
|
||||
URIParams uri;
|
||||
SerializeURI(mURI, uri);
|
||||
|
||||
OptionalURIParams originalURI, documentURI, referrer, redirectURI;
|
||||
SerializeURI(mOriginalURI, originalURI);
|
||||
SerializeURI(mDocumentURI, documentURI);
|
||||
SerializeURI(mReferrer, referrer);
|
||||
SerializeURI(mAPIRedirectToURI, redirectURI);
|
||||
|
||||
OptionalInputStreamParams uploadStream;
|
||||
SerializeInputStream(mUploadStream, uploadStream);
|
||||
|
||||
SendAsyncOpen(uri, originalURI, documentURI, referrer, redirectURI, mLoadFlags,
|
||||
mClientSetRequestHeaders, mRequestHead.Method(), uploadStream,
|
||||
mUploadStreamHasHeaders, mPriority, mRedirectionLimit,
|
||||
mAllowPipelining, mForceAllowThirdPartyCookie, mSendResumeAt,
|
||||
mStartPos, mEntityID, mChooseApplicationCache,
|
||||
appCacheClientId, mAllowSpdy);
|
||||
IPC::SerializedLoadContext(this),
|
||||
openArgs);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -69,6 +69,33 @@ HttpChannelParent::ActorDestroy(ActorDestroyReason why)
|
||||
mIPCClosed = true;
|
||||
}
|
||||
|
||||
bool
|
||||
HttpChannelParent::Init(const HttpChannelCreationArgs& aArgs)
|
||||
{
|
||||
switch (aArgs.type()) {
|
||||
case HttpChannelCreationArgs::THttpChannelOpenArgs:
|
||||
{
|
||||
const HttpChannelOpenArgs& a = aArgs.get_HttpChannelOpenArgs();
|
||||
return DoAsyncOpen(a.uri(), a.original(), a.doc(), a.referrer(),
|
||||
a.apiRedirectTo(), a.loadFlags(), a.requestHeaders(),
|
||||
a.requestMethod(), a.uploadStream(),
|
||||
a.uploadStreamHasHeaders(), a.priority(),
|
||||
a.redirectionLimit(), a.allowPipelining(),
|
||||
a.forceAllowThirdPartyCookie(), a.resumeAt(),
|
||||
a.startPos(), a.entityID(), a.chooseApplicationCache(),
|
||||
a.appCacheClientID(), a.allowSpdy());
|
||||
}
|
||||
case HttpChannelCreationArgs::THttpChannelConnectArgs:
|
||||
{
|
||||
const HttpChannelConnectArgs& cArgs = aArgs.get_HttpChannelConnectArgs();
|
||||
return ConnectChannel(cArgs.channelId());
|
||||
}
|
||||
default:
|
||||
NS_NOTREACHED("unknown open type");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// HttpChannelParent::nsISupports
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -111,7 +138,7 @@ HttpChannelParent::GetInterface(const nsIID& aIID, void **result)
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
bool
|
||||
HttpChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
||||
HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
const OptionalURIParams& aOriginalURI,
|
||||
const OptionalURIParams& aDocURI,
|
||||
const OptionalURIParams& aReferrerURI,
|
||||
@ -240,7 +267,7 @@ HttpChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
||||
}
|
||||
|
||||
bool
|
||||
HttpChannelParent::RecvConnectChannel(const uint32_t& channelId)
|
||||
HttpChannelParent::ConnectChannel(const uint32_t& channelId)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -49,29 +49,34 @@ public:
|
||||
PBOverrideStatus aStatus);
|
||||
virtual ~HttpChannelParent();
|
||||
|
||||
protected:
|
||||
virtual bool RecvAsyncOpen(const URIParams& uri,
|
||||
const OptionalURIParams& originalUri,
|
||||
const OptionalURIParams& docUri,
|
||||
const OptionalURIParams& referrerUri,
|
||||
const OptionalURIParams& internalRedirectUri,
|
||||
const uint32_t& loadFlags,
|
||||
const RequestHeaderTuples& requestHeaders,
|
||||
const nsHttpAtom& requestMethod,
|
||||
const OptionalInputStreamParams& uploadStream,
|
||||
const bool& uploadStreamHasHeaders,
|
||||
const uint16_t& priority,
|
||||
const uint8_t& redirectionLimit,
|
||||
const bool& allowPipelining,
|
||||
const bool& forceAllowThirdPartyCookie,
|
||||
const bool& doResumeAt,
|
||||
const uint64_t& startPos,
|
||||
const nsCString& entityID,
|
||||
const bool& chooseApplicationCache,
|
||||
const nsCString& appCacheClientID,
|
||||
const bool& allowSpdy) MOZ_OVERRIDE;
|
||||
bool Init(const HttpChannelCreationArgs& aOpenArgs);
|
||||
|
||||
protected:
|
||||
// used to connect redirected-to channel in parent with just created
|
||||
// ChildChannel. Used during redirects.
|
||||
bool ConnectChannel(const uint32_t& channelId);
|
||||
|
||||
bool DoAsyncOpen(const URIParams& uri,
|
||||
const OptionalURIParams& originalUri,
|
||||
const OptionalURIParams& docUri,
|
||||
const OptionalURIParams& referrerUri,
|
||||
const OptionalURIParams& internalRedirectUri,
|
||||
const uint32_t& loadFlags,
|
||||
const RequestHeaderTuples& requestHeaders,
|
||||
const nsHttpAtom& requestMethod,
|
||||
const OptionalInputStreamParams& uploadStream,
|
||||
const bool& uploadStreamHasHeaders,
|
||||
const uint16_t& priority,
|
||||
const uint8_t& redirectionLimit,
|
||||
const bool& allowPipelining,
|
||||
const bool& forceAllowThirdPartyCookie,
|
||||
const bool& doResumeAt,
|
||||
const uint64_t& startPos,
|
||||
const nsCString& entityID,
|
||||
const bool& chooseApplicationCache,
|
||||
const nsCString& appCacheClientID,
|
||||
const bool& allowSpdy);
|
||||
|
||||
virtual bool RecvConnectChannel(const uint32_t& channelId);
|
||||
virtual bool RecvSetPriority(const uint16_t& priority);
|
||||
virtual bool RecvSetCacheTokenCachedCharset(const nsCString& charset);
|
||||
virtual bool RecvSuspend();
|
||||
|
@ -31,33 +31,8 @@ protocol PHttpChannel
|
||||
manager PNecko;
|
||||
|
||||
parent:
|
||||
AsyncOpen(URIParams uri,
|
||||
// - TODO: bug 571161: unclear if any HTTP channel clients ever
|
||||
// set originalURI != uri (about:credits?); also not clear if
|
||||
// chrome channel would ever need to know. Get rid of next arg?
|
||||
OptionalURIParams original,
|
||||
OptionalURIParams doc,
|
||||
OptionalURIParams referrer,
|
||||
OptionalURIParams apiRedirectTo,
|
||||
uint32_t loadFlags,
|
||||
RequestHeaderTuples requestHeaders,
|
||||
nsHttpAtom requestMethod,
|
||||
OptionalInputStreamParams uploadStream,
|
||||
bool uploadStreamHasHeaders,
|
||||
uint16_t priority,
|
||||
uint8_t redirectionLimit,
|
||||
bool allowPipelining,
|
||||
bool forceAllowThirdPartyCookie,
|
||||
bool resumeAt,
|
||||
uint64_t startPos,
|
||||
nsCString entityID,
|
||||
bool chooseApplicationCache,
|
||||
nsCString appCacheClientID,
|
||||
bool allowSpdy);
|
||||
|
||||
// Used to connect redirected-to channel on the parent with redirected-to
|
||||
// channel on the child.
|
||||
ConnectChannel(uint32_t channelId);
|
||||
// Note: channels are opened during construction, so no open method here:
|
||||
// see PNecko.ipdl
|
||||
|
||||
SetPriority(uint16_t priority);
|
||||
|
||||
|
@ -25,6 +25,12 @@ struct RequestHeaderTuple {
|
||||
nsCString mHeader;
|
||||
nsCString mValue;
|
||||
bool mMerge;
|
||||
|
||||
bool operator ==(const RequestHeaderTuple &other) const {
|
||||
return mHeader.Equals(other.mHeader) &&
|
||||
mValue.Equals(other.mValue) &&
|
||||
mMerge == other.mMerge;
|
||||
}
|
||||
};
|
||||
|
||||
typedef nsTArray<RequestHeaderTuple> RequestHeaderTuples;
|
||||
|
@ -28,6 +28,8 @@ public:
|
||||
const nsHttpHeaderArray & Headers() const { return mHeaders; }
|
||||
nsHttpHeaderArray &Headers() { return mHeaders; }
|
||||
nsHttpVersion Version() const { return mVersion; }
|
||||
// X11's Xlib.h #defines 'Status' to 'int' on some systems!
|
||||
#undef Status
|
||||
uint16_t Status() const { return mStatus; }
|
||||
const nsAFlatCString &StatusText() const { return mStatusText; }
|
||||
int64_t ContentLength() const { return mContentLength; }
|
||||
|
Loading…
Reference in New Issue
Block a user