☠☠ backed out by d8f4a23e6db2 ☠ ☠ | |
author | Steve Workman <sworkman@mozilla.com> |
Mon, 10 Mar 2014 18:31:05 +0100 | |
changeset 191057 | 97858e5c1f13d4c9602e436008f0ef01d3638870 |
parent 191056 | ce8ed7a0dfeffa2f6b01ae923c609273306b257c |
child 191058 | 1b4b0a30945324346ca62ea30e7f9bc5dd4127e8 |
push id | 474 |
push user | asasaki@mozilla.com |
push date | Mon, 02 Jun 2014 21:01:02 +0000 |
treeherder | mozilla-release@967f4cf1b31c [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jduell |
bugs | 975338 |
milestone | 30.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
new file mode 100644 --- /dev/null +++ b/netwerk/base/src/ChannelDiverterChild.cpp @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 "mozilla/net/ChannelDiverterChild.h" +#include "mozilla/net/NeckoChannelParams.h" +#include "mozilla/net/HttpChannelChild.h" +#include "mozilla/net/FTPChannelChild.h" +#include "mozilla/net/PHttpChannelChild.h" +#include "mozilla/net/PFTPChannelChild.h" +#include "nsIDivertableChannel.h" + +namespace mozilla { +namespace net { + +ChannelDiverterChild::ChannelDiverterChild() +{ +} + +ChannelDiverterChild::~ChannelDiverterChild() +{ +} + +} // namespace net +} // namespace mozilla
new file mode 100644 --- /dev/null +++ b/netwerk/base/src/ChannelDiverterChild.h @@ -0,0 +1,30 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef _channeldiverterchild_h_ +#define _channeldiverterchild_h_ + +#include "mozilla/net/PChannelDiverterChild.h" + +class nsIDivertableChannel; + +namespace mozilla { +namespace net { + +class ChannelDiverterArgs; + +class ChannelDiverterChild : + public PChannelDiverterChild +{ +public: + ChannelDiverterChild(); + virtual ~ChannelDiverterChild(); +}; + +} // namespace net +} // namespace mozilla + +#endif /* _channeldiverterchild_h_ */
new file mode 100644 --- /dev/null +++ b/netwerk/base/src/ChannelDiverterParent.cpp @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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 "mozilla/net/ChannelDiverterParent.h" +#include "mozilla/net/NeckoChannelParams.h" +#include "mozilla/net/HttpChannelParent.h" +#include "mozilla/net/FTPChannelParent.h" +#include "mozilla/net/PHttpChannelParent.h" +#include "mozilla/net/PFTPChannelParent.h" +#include "ADivertableParentChannel.h" + +namespace mozilla { +namespace net { + +ChannelDiverterParent::ChannelDiverterParent() +{ +} + +ChannelDiverterParent::~ChannelDiverterParent() +{ +} + +bool +ChannelDiverterParent::Init(const ChannelDiverterArgs& aChannel) +{ + switch (aChannel.type()) { + case ChannelDiverterArgs::TPHttpChannelParent: + { + mDivertableChannelParent = static_cast<ADivertableParentChannel*>( + static_cast<HttpChannelParent*>(aChannel.get_PHttpChannelParent())); + break; + } + case ChannelDiverterArgs::TPFTPChannelParent: + { + mDivertableChannelParent = static_cast<ADivertableParentChannel*>( + static_cast<FTPChannelParent*>(aChannel.get_PFTPChannelParent())); + break; + } + default: + NS_NOTREACHED("unknown ChannelDiverterArgs type"); + return false; + } + MOZ_ASSERT(mDivertableChannelParent); + + nsresult rv = mDivertableChannelParent->SuspendForDiversion(); + if (NS_WARN_IF(NS_FAILED(rv))) { + return false; + } + return true; +} + +void +ChannelDiverterParent::DivertTo(nsIStreamListener* newListener) +{ + MOZ_ASSERT(newListener); + MOZ_ASSERT(mDivertableChannelParent); + + mDivertableChannelParent->DivertTo(newListener); +} + +} // namespace net +} // namespace mozilla
new file mode 100644 --- /dev/null +++ b/netwerk/base/src/ChannelDiverterParent.h @@ -0,0 +1,37 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* 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/. */ + +#ifndef _channeldiverterparent_h_ +#define _channeldiverterparent_h_ + +#include "mozilla/net/PChannelDiverterParent.h" + +class nsIStreamListener; + +namespace mozilla { +namespace net { + +class ChannelDiverterArgs; +class ADivertableParentChannel; + +class ChannelDiverterParent : + public PChannelDiverterParent +{ +public: + ChannelDiverterParent(); + virtual ~ChannelDiverterParent(); + + bool Init(const ChannelDiverterArgs& aChannel); + + void DivertTo(nsIStreamListener* newListener); +private: + nsRefPtr<ADivertableParentChannel> mDivertableChannelParent; +}; + +} // namespace net +} // namespace mozilla + +#endif /* _channeldiverterparent_h_ */
--- a/netwerk/base/src/moz.build +++ b/netwerk/base/src/moz.build @@ -7,23 +7,27 @@ EXPORTS += [ 'nsFileStreams.h', 'nsMIMEInputStream.h', 'nsTemporaryFileInputStream.h', 'nsURLHelper.h', ] EXPORTS.mozilla.net += [ + 'ChannelDiverterChild.h', + 'ChannelDiverterParent.h', 'Dashboard.h', 'DashboardTypes.h', ] UNIFIED_SOURCES += [ 'ArrayBufferInputStream.cpp', 'BackgroundFileSaver.cpp', + 'ChannelDiverterChild.cpp', + 'ChannelDiverterParent.cpp', 'Dashboard.cpp', 'EventTokenBucket.cpp', 'LoadContextInfo.cpp', 'NetworkActivityMonitor.cpp', 'nsAsyncStreamCopier.cpp', 'nsAuthInformationHolder.cpp', 'nsBase64Encoder.cpp', 'nsBaseChannel.cpp', @@ -108,16 +112,17 @@ FAIL_ON_WARNINGS = True MSVC_ENABLE_PGO = True include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'necko' LOCAL_INCLUDES += [ '/dom/base', + '/netwerk/protocol/http' ] if 'rtsp' in CONFIG['NECKO_PROTOCOLS']: LOCAL_INCLUDES += [ '/netwerk/protocol/rtsp/controller', '/netwerk/protocol/rtsp/rtsp', ]
--- a/netwerk/ipc/NeckoChannelParams.ipdlh +++ b/netwerk/ipc/NeckoChannelParams.ipdlh @@ -1,15 +1,17 @@ /* -*- 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 protocol PHttpChannel; +include protocol PFTPChannel; include URIParams; include InputStreamParams; using struct mozilla::void_t from "ipc/IPCMessageUtils.h"; using RequestHeaderTuples from "mozilla/net/PHttpChannelParams.h"; using struct nsHttpAtom from "nsHttp.h"; namespace mozilla { @@ -75,10 +77,16 @@ struct FTPChannelConnectArgs }; union FTPChannelCreationArgs { FTPChannelOpenArgs; // For AsyncOpen: the common case. FTPChannelConnectArgs; // Used for redirected-to channels }; +union ChannelDiverterArgs +{ + PHttpChannel; + PFTPChannel; +}; + } // namespace ipc } // namespace mozilla
--- a/netwerk/ipc/NeckoChild.cpp +++ b/netwerk/ipc/NeckoChild.cpp @@ -11,16 +11,17 @@ #include "mozilla/dom/ContentChild.h" #include "mozilla/net/HttpChannelChild.h" #include "mozilla/net/CookieServiceChild.h" #include "mozilla/net/WyciwygChannelChild.h" #include "mozilla/net/FTPChannelChild.h" #include "mozilla/net/WebSocketChannelChild.h" #include "mozilla/net/DNSRequestChild.h" #include "mozilla/net/RemoteOpenFileChild.h" +#include "mozilla/net/ChannelDiverterChild.h" #include "mozilla/dom/network/TCPSocketChild.h" #include "mozilla/dom/network/TCPServerSocketChild.h" #include "mozilla/dom/network/UDPSocketChild.h" #ifdef NECKO_PROTOCOL_rtsp #include "mozilla/net/RtspControllerChild.h" #endif #include "SerializedLoadContext.h" @@ -261,10 +262,23 @@ NeckoChild::AllocPRemoteOpenFileChild(co bool NeckoChild::DeallocPRemoteOpenFileChild(PRemoteOpenFileChild* aChild) { RemoteOpenFileChild *p = static_cast<RemoteOpenFileChild*>(aChild); p->ReleaseIPDLReference(); return true; } +PChannelDiverterChild* +NeckoChild::AllocPChannelDiverterChild(const ChannelDiverterArgs& channel) +{ + return new ChannelDiverterChild();; +} + +bool +NeckoChild::DeallocPChannelDiverterChild(PChannelDiverterChild* child) +{ + delete static_cast<ChannelDiverterChild*>(child); + return true; +} + }} // mozilla::net
--- a/netwerk/ipc/NeckoChild.h +++ b/netwerk/ipc/NeckoChild.h @@ -57,16 +57,20 @@ protected: const uint32_t& aFlags) MOZ_OVERRIDE; virtual bool DeallocPDNSRequestChild(PDNSRequestChild*) MOZ_OVERRIDE; virtual PRemoteOpenFileChild* AllocPRemoteOpenFileChild(const URIParams&, const OptionalURIParams&) MOZ_OVERRIDE; virtual bool DeallocPRemoteOpenFileChild(PRemoteOpenFileChild*) MOZ_OVERRIDE; virtual PRtspControllerChild* AllocPRtspControllerChild() MOZ_OVERRIDE; virtual bool DeallocPRtspControllerChild(PRtspControllerChild*) MOZ_OVERRIDE; + virtual PChannelDiverterChild* + AllocPChannelDiverterChild(const ChannelDiverterArgs& channel) MOZ_OVERRIDE; + virtual bool + DeallocPChannelDiverterChild(PChannelDiverterChild* actor) MOZ_OVERRIDE; }; /** * Reference to the PNecko Child protocol. * Null if this is not a content process. */ extern PNeckoChild *gNeckoChild;
--- a/netwerk/ipc/NeckoParent.cpp +++ b/netwerk/ipc/NeckoParent.cpp @@ -13,16 +13,17 @@ #include "mozilla/net/WyciwygChannelParent.h" #include "mozilla/net/FTPChannelParent.h" #include "mozilla/net/WebSocketChannelParent.h" #ifdef NECKO_PROTOCOL_rtsp #include "mozilla/net/RtspControllerParent.h" #endif #include "mozilla/net/DNSRequestParent.h" #include "mozilla/net/RemoteOpenFileParent.h" +#include "mozilla/net/ChannelDiverterParent.h" #include "mozilla/dom/ContentParent.h" #include "mozilla/dom/TabParent.h" #include "mozilla/dom/network/TCPSocketParent.h" #include "mozilla/dom/network/TCPServerSocketParent.h" #include "mozilla/dom/network/UDPSocketParent.h" #include "mozilla/ipc/URIUtils.h" #include "mozilla/LoadContext.h" #include "mozilla/AppProcessChecker.h" @@ -603,16 +604,38 @@ bool NeckoParent::RecvCancelHTMLDNSPrefetch(const nsString& hostname, const uint16_t& flags, const nsresult& reason) { nsHTMLDNSPrefetch::CancelPrefetch(hostname, flags, reason); return true; } +PChannelDiverterParent* +NeckoParent::AllocPChannelDiverterParent(const ChannelDiverterArgs& channel) +{ + return new ChannelDiverterParent(); +} + +bool +NeckoParent::RecvPChannelDiverterConstructor(PChannelDiverterParent* actor, + const ChannelDiverterArgs& channel) +{ + auto parent = static_cast<ChannelDiverterParent*>(actor); + parent->Init(channel); + return true; +} + +bool +NeckoParent::DeallocPChannelDiverterParent(PChannelDiverterParent* parent) +{ + delete static_cast<ChannelDiverterParent*>(parent); + return true; +} + void NeckoParent::CloneManagees(ProtocolBase* aSource, mozilla::ipc::ProtocolCloneContext* aCtx) { aCtx->SetNeckoParent(this); // For cloning protocols managed by this. PNeckoParent::CloneManagees(aSource, aCtx); }
--- a/netwerk/ipc/NeckoParent.h +++ b/netwerk/ipc/NeckoParent.h @@ -139,16 +139,24 @@ protected: const nsresult& reason) MOZ_OVERRIDE; virtual mozilla::ipc::IProtocol* CloneProtocol(Channel* aChannel, mozilla::ipc::ProtocolCloneContext* aCtx) MOZ_OVERRIDE; virtual PRtspControllerParent* AllocPRtspControllerParent() MOZ_OVERRIDE; virtual bool DeallocPRtspControllerParent(PRtspControllerParent*) MOZ_OVERRIDE; + virtual PChannelDiverterParent* + AllocPChannelDiverterParent(const ChannelDiverterArgs& channel) MOZ_OVERRIDE; + virtual bool + RecvPChannelDiverterConstructor(PChannelDiverterParent* actor, + const ChannelDiverterArgs& channel) MOZ_OVERRIDE; + virtual bool DeallocPChannelDiverterParent(PChannelDiverterParent* actor) + MOZ_OVERRIDE; + private: nsCString mCoreAppsBasePath; nsCString mWebAppsBasePath; }; } // namespace net } // namespace mozilla
new file mode 100644 --- /dev/null +++ b/netwerk/ipc/PChannelDiverter.ipdl @@ -0,0 +1,25 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80 ft=cpp: */ +/* 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 protocol PFTPChannel; +include protocol PHttpChannel; +include protocol PNecko; + +namespace mozilla { +namespace net { + +// Used when diverting necko channels from child back to the parent. +// See nsIDivertableChannel. +async protocol PChannelDiverter +{ + manager PNecko; + +child: + __delete__(); +}; + +}// namespace net +}// namespace mozilla
--- a/netwerk/ipc/PNecko.ipdl +++ b/netwerk/ipc/PNecko.ipdl @@ -12,16 +12,17 @@ include protocol PBrowser; include protocol PWyciwygChannel; include protocol PFTPChannel; include protocol PWebSocket; include protocol PTCPSocket; include protocol PTCPServerSocket; include protocol PUDPSocket; include protocol PRemoteOpenFile; include protocol PDNSRequest; +include protocol PChannelDiverter; include protocol PBlob; //FIXME: bug #792908 include protocol PRtspController; include URIParams; include InputStreamParams; include NeckoChannelParams; @@ -40,16 +41,17 @@ sync protocol PNecko manages PFTPChannel; manages PWebSocket; manages PTCPSocket; manages PTCPServerSocket; manages PUDPSocket; manages PDNSRequest; manages PRemoteOpenFile; manages PRtspController; + manages PChannelDiverter; parent: __delete__(); PCookieService(); PHttpChannel(nullable PBrowser browser, SerializedLoadContext loadContext, HttpChannelCreationArgs args); @@ -63,16 +65,17 @@ parent: PDNSRequest(nsCString hostName, uint32_t flags); PRemoteOpenFile(URIParams fileuri, OptionalURIParams appuri); HTMLDNSPrefetch(nsString hostname, uint16_t flags); CancelHTMLDNSPrefetch(nsString hostname, uint16_t flags, nsresult reason); PRtspController(); + PChannelDiverter(ChannelDiverterArgs channel); both: PTCPSocket(); }; } // namespace net } // namespace mozilla
--- a/netwerk/ipc/moz.build +++ b/netwerk/ipc/moz.build @@ -26,16 +26,17 @@ UNIFIED_SOURCES += [ 'NeckoCommon.cpp', 'NeckoParent.cpp', 'RemoteOpenFileChild.cpp', 'RemoteOpenFileParent.cpp', ] IPDL_SOURCES = [ 'NeckoChannelParams.ipdlh', + 'PChannelDiverter.ipdl', 'PNecko.ipdl', 'PRemoteOpenFile.ipdl', 'PRtspController.ipdl', ] FAIL_ON_WARNINGS = True include('/ipc/chromium/chromium-config.mozbuild')
--- a/netwerk/protocol/ftp/FTPChannelChild.cpp +++ b/netwerk/protocol/ftp/FTPChannelChild.cpp @@ -425,16 +425,28 @@ FTPChannelChild::DoFailedAsyncOpen(const mListener = nullptr; mListenerContext = nullptr; if (mIPCOpen) Send__delete__(this); } +bool +FTPChannelChild::RecvFlushedForDiversion() +{ + return false; +} + +bool +FTPChannelChild::RecvDivertMessages() +{ + return false; +} + class FTPDeleteSelfEvent : public ChannelEvent { public: FTPDeleteSelfEvent(FTPChannelChild* aChild) : mChild(aChild) {} void Run() { mChild->DoDeleteSelf(); } private: FTPChannelChild* mChild;
--- a/netwerk/protocol/ftp/FTPChannelChild.h +++ b/netwerk/protocol/ftp/FTPChannelChild.h @@ -74,16 +74,18 @@ protected: const PRTime& aLastModified, const nsCString& aEntityID, const URIParams& aURI) MOZ_OVERRIDE; bool RecvOnDataAvailable(const nsCString& data, const uint64_t& offset, const uint32_t& count) MOZ_OVERRIDE; bool RecvOnStopRequest(const nsresult& statusCode) MOZ_OVERRIDE; bool RecvFailedAsyncOpen(const nsresult& statusCode) MOZ_OVERRIDE; + bool RecvFlushedForDiversion() MOZ_OVERRIDE; + bool RecvDivertMessages() MOZ_OVERRIDE; bool RecvDeleteSelf() MOZ_OVERRIDE; void DoOnStartRequest(const int64_t& aContentLength, const nsCString& aContentType, const PRTime& aLastModified, const nsCString& aEntityID, const URIParams& aURI); void DoOnDataAvailable(const nsCString& data,
--- a/netwerk/protocol/ftp/FTPChannelParent.cpp +++ b/netwerk/protocol/ftp/FTPChannelParent.cpp @@ -174,16 +174,36 @@ FTPChannelParent::RecvSuspend() bool FTPChannelParent::RecvResume() { if (mChannel) mChannel->Resume(); return true; } +bool +FTPChannelParent::RecvDivertOnDataAvailable(const nsCString& data, + const uint64_t& offset, + const uint32_t& count) +{ + return false; +} + +bool +FTPChannelParent::RecvDivertOnStopRequest(const nsresult& statusCode) +{ + return false; +} + +bool +FTPChannelParent::RecvDivertComplete() +{ + return false; +} + //----------------------------------------------------------------------------- // FTPChannelParent::nsIRequestObserver //----------------------------------------------------------------------------- NS_IMETHODIMP FTPChannelParent::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext) { LOG(("FTPChannelParent::OnStartRequest [this=%p]\n", this));
--- a/netwerk/protocol/ftp/FTPChannelParent.h +++ b/netwerk/protocol/ftp/FTPChannelParent.h @@ -42,16 +42,21 @@ protected: // 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; + virtual bool RecvDivertOnDataAvailable(const nsCString& data, + const uint64_t& offset, + const uint32_t& count) MOZ_OVERRIDE; + virtual bool RecvDivertOnStopRequest(const nsresult& statusCode) MOZ_OVERRIDE; + virtual bool RecvDivertComplete() MOZ_OVERRIDE; virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; nsRefPtr<nsFtpChannel> mChannel; bool mIPCClosed; nsCOMPtr<nsILoadContext> mLoadContext;
--- a/netwerk/protocol/ftp/PFTPChannel.ipdl +++ b/netwerk/protocol/ftp/PFTPChannel.ipdl @@ -27,20 +27,39 @@ parent: // see PNecko.ipdl __delete__(); Cancel(nsresult status); Suspend(); Resume(); + // Divert OnDataAvailable to the parent. + DivertOnDataAvailable(nsCString data, + uint64_t offset, + uint32_t count); + + // Divert OnStopRequest to the parent. + DivertOnStopRequest(nsresult statusCode); + + // Child has no more events/messages to divert to the parent. + DivertComplete(); + child: OnStartRequest(int64_t aContentLength, nsCString aContentType, PRTime aLastModified, nsCString aEntityID, URIParams aURI); OnDataAvailable(nsCString data, uint64_t offset, uint32_t count); OnStopRequest(nsresult statusCode); FailedAsyncOpen(nsresult statusCode); + + // Parent has been suspended for diversion; no more events to be enqueued. + FlushedForDiversion(); + + // Child should resume processing the ChannelEventQueue, i.e. diverting any + // OnDataAvailable and OnStopRequest messages in the queue back to the parent. + DivertMessages(); + DeleteSelf(); }; } // namespace net } // namespace mozilla
--- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -772,16 +772,28 @@ HttpChannelChild::RecvRedirect3Complete( if (mEventQ->ShouldEnqueue()) { mEventQ->Enqueue(new Redirect3Event(this)); } else { Redirect3Complete(); } return true; } +bool +HttpChannelChild::RecvFlushedForDiversion() +{ + return false; +} + +bool +HttpChannelChild::RecvDivertMessages() +{ + return false; +} + void HttpChannelChild::Redirect3Complete() { nsresult rv = NS_OK; // Chrome channel has been AsyncOpen'd. Reflect this in child. if (mRedirectChannelChild) rv = mRedirectChannelChild->CompleteRedirectSetup(mListener,
--- a/netwerk/protocol/http/HttpChannelChild.h +++ b/netwerk/protocol/http/HttpChannelChild.h @@ -113,16 +113,18 @@ protected: bool RecvFailedAsyncOpen(const nsresult& status) MOZ_OVERRIDE; bool RecvRedirect1Begin(const uint32_t& newChannel, const URIParams& newURI, const uint32_t& redirectFlags, const nsHttpResponseHead& responseHead) MOZ_OVERRIDE; bool RecvRedirect3Complete() MOZ_OVERRIDE; bool RecvAssociateApplicationCache(const nsCString& groupID, const nsCString& clientID) MOZ_OVERRIDE; + bool RecvFlushedForDiversion() MOZ_OVERRIDE; + bool RecvDivertMessages() MOZ_OVERRIDE; bool RecvDeleteSelf() MOZ_OVERRIDE; bool GetAssociatedContentSecurity(nsIAssociatedContentSecurity** res = nullptr); virtual void DoNotifyListenerCleanup(); private: RequestHeaderTuples mClientSetRequestHeaders; nsCOMPtr<nsIChildChannel> mRedirectChannelChild;
--- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -430,16 +430,36 @@ HttpChannelParent::RecvMarkOfflineCacheE if (mOfflineForeignMarker) { mOfflineForeignMarker->MarkAsForeign(); mOfflineForeignMarker = 0; } return true; } +bool +HttpChannelParent::RecvDivertOnDataAvailable(const nsCString& data, + const uint64_t& offset, + const uint32_t& count) +{ + return false; +} + +bool +HttpChannelParent::RecvDivertOnStopRequest(const nsresult& statusCode) +{ + return false; +} + +bool +HttpChannelParent::RecvDivertComplete() +{ + return false; +} + //----------------------------------------------------------------------------- // HttpChannelParent::nsIRequestObserver //----------------------------------------------------------------------------- NS_IMETHODIMP HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext) { LOG(("HttpChannelParent::OnStartRequest [this=%p]\n", this));
--- a/netwerk/protocol/http/HttpChannelParent.h +++ b/netwerk/protocol/http/HttpChannelParent.h @@ -84,17 +84,21 @@ protected: virtual bool RecvCancel(const nsresult& status) MOZ_OVERRIDE; virtual bool RecvRedirect2Verify(const nsresult& result, const RequestHeaderTuples& changedHeaders, const OptionalURIParams& apiRedirectUri) MOZ_OVERRIDE; virtual bool RecvUpdateAssociatedContentSecurity(const int32_t& broken, const int32_t& no) MOZ_OVERRIDE; virtual bool RecvDocumentChannelCleanup() MOZ_OVERRIDE; virtual bool RecvMarkOfflineCacheEntryAsForeign() MOZ_OVERRIDE; - + virtual bool RecvDivertOnDataAvailable(const nsCString& data, + const uint64_t& offset, + const uint32_t& count) MOZ_OVERRIDE; + virtual bool RecvDivertOnStopRequest(const nsresult& statusCode) MOZ_OVERRIDE; + virtual bool RecvDivertComplete() MOZ_OVERRIDE; virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; protected: friend class HttpChannelParentListener; nsRefPtr<mozilla::dom::TabParent> mTabParent; private: nsCOMPtr<nsIChannel> mChannel;
--- a/netwerk/protocol/http/PHttpChannel.ipdl +++ b/netwerk/protocol/http/PHttpChannel.ipdl @@ -61,16 +61,27 @@ parent: // load this document from the offline cache group it was just loaded from. // Marking the cache entry as foreign in its cache group will prevent // the document to load from the bad offline cache group. After it is marked, // we reload the document to take the effect. If we fail to mark the entry // as foreign, we will end up in the same situation and reload again and // again, indefinitely. MarkOfflineCacheEntryAsForeign(); + // Divert OnDataAvailable to the parent. + DivertOnDataAvailable(nsCString data, + uint64_t offset, + uint32_t count); + + // Divert OnStopRequest to the parent. + DivertOnStopRequest(nsresult statusCode); + + // Child has no more events/messages to divert to the parent. + DivertComplete(); + __delete__(); child: OnStartRequest(nsHttpResponseHead responseHead, bool useResponseHead, nsHttpHeaderArray requestHeaders, bool isFromCache, bool cacheEntryAvailable, @@ -108,16 +119,23 @@ child: // Called if redirect successful so that child can complete setup. Redirect3Complete(); // Associte the child with an application ids AssociateApplicationCache(nsCString groupID, nsCString clientID); + // Parent has been suspended for diversion; no more events to be enqueued. + FlushedForDiversion(); + + // Child should resume processing the ChannelEventQueue, i.e. diverting any + // OnDataAvailable and OnStopRequest messages in the queue back to the parent. + DivertMessages(); + // Tell child to delete channel (all IPDL deletes must be done from child to // avoid races: see bug 591708). DeleteSelf(); }; } // namespace net } // namespace mozilla