diff --git a/netwerk/ipc/DocumentChannelChild.cpp b/netwerk/ipc/DocumentChannelChild.cpp index 0080228b1403..14b2df69bb3f 100644 --- a/netwerk/ipc/DocumentChannelChild.cpp +++ b/netwerk/ipc/DocumentChannelChild.cpp @@ -31,6 +31,9 @@ using namespace mozilla::dom; using namespace mozilla::ipc; +extern mozilla::LazyLogModule gDocumentChannelLog; +#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt) + namespace mozilla { namespace net { @@ -74,12 +77,18 @@ DocumentChannelChild::DocumentChannelChild( mLoadFlags(aLoadFlags), mURI(aLoadState->URI()), mLoadInfo(aLoadInfo) { + LOG(("DocumentChannelChild ctor [this=%p, uri=%s]", this, + aLoadState->URI()->GetSpecOrDefault().get())); RefPtr handler = nsHttpHandler::GetInstance(); uint64_t channelId; Unused << handler->NewChannelId(channelId); mChannelId = channelId; } +DocumentChannelChild::~DocumentChannelChild() { + LOG(("DocumentChannelChild dtor [this=%p]", this)); +} + NS_IMETHODIMP DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) { nsresult rv = NS_OK; @@ -204,6 +213,8 @@ IPCResult DocumentChannelChild::RecvFailedAsyncOpen( } void DocumentChannelChild::ShutdownListeners(nsresult aStatusCode) { + LOG(("DocumentChannelChild ShutdownListeners [this=%p, status=%" PRIx32 "]", + this, static_cast(aStatusCode))); mStatus = aStatusCode; nsCOMPtr l = mListener; @@ -255,6 +266,9 @@ IPCResult DocumentChannelChild::RecvDeleteSelf() { IPCResult DocumentChannelChild::RecvRedirectToRealChannel( const RedirectToRealChannelArgs& aArgs, RedirectToRealChannelResolver&& aResolve) { + LOG(("DocumentChannelChild RecvRedirectToRealChannel [this=%p, uri=%s]", this, + aArgs.uri()->GetSpecOrDefault().get())); + RefPtr loadingDocument; mLoadInfo->GetLoadingDocument(getter_AddRefs(loadingDocument)); @@ -692,3 +706,5 @@ DocumentChannelChild::SetChannelId(uint64_t aChannelId) { } // namespace net } // namespace mozilla + +#undef LOG diff --git a/netwerk/ipc/DocumentChannelChild.h b/netwerk/ipc/DocumentChannelChild.h index d1beb4aefdc4..cf6ff0494fa1 100644 --- a/netwerk/ipc/DocumentChannelChild.h +++ b/netwerk/ipc/DocumentChannelChild.h @@ -70,7 +70,7 @@ class DocumentChannelChild final : public nsHashPropertyBag, private: void ShutdownListeners(nsresult aStatusCode); - ~DocumentChannelChild() = default; + ~DocumentChannelChild(); nsCOMPtr mRedirectChannel; nsTArray mRedirects; diff --git a/netwerk/ipc/DocumentChannelParent.cpp b/netwerk/ipc/DocumentChannelParent.cpp index a88e49eaa29e..1a37d3418829 100644 --- a/netwerk/ipc/DocumentChannelParent.cpp +++ b/netwerk/ipc/DocumentChannelParent.cpp @@ -7,12 +7,29 @@ #include "DocumentChannelParent.h" +extern mozilla::LazyLogModule gDocumentChannelLog; +#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt) + namespace mozilla { namespace net { +DocumentChannelParent::DocumentChannelParent( + const dom::PBrowserOrId& aIframeEmbedding, nsILoadContext* aLoadContext, + PBOverrideStatus aOverrideStatus) { + LOG(("DocumentChannelParent ctor [this=%p]", this)); + mParent = new DocumentLoadListener(aIframeEmbedding, aLoadContext, + aOverrideStatus, this); +} + +DocumentChannelParent::~DocumentChannelParent() { + LOG(("DocumentChannelParent dtor [this=%p]", this)); +} + bool DocumentChannelParent::Init(const DocumentChannelCreationArgs& aArgs) { RefPtr loadState = new nsDocShellLoadState(aArgs.loadState()); + LOG(("DocumentChannelParent Init [this=%p, uri=%s]", this, + loadState->URI()->GetSpecOrDefault().get())); RefPtr loadInfo; nsresult rv = mozilla::ipc::LoadInfoArgsToLoadInfo(Some(aArgs.loadInfo()), @@ -43,3 +60,5 @@ DocumentChannelParent::RedirectToRealChannel(uint32_t aRedirectFlags, } // namespace net } // namespace mozilla + +#undef LOG diff --git a/netwerk/ipc/DocumentChannelParent.h b/netwerk/ipc/DocumentChannelParent.h index c34932a10030..3098831dd60b 100644 --- a/netwerk/ipc/DocumentChannelParent.h +++ b/netwerk/ipc/DocumentChannelParent.h @@ -25,10 +25,8 @@ class DocumentChannelParent final : public ADocumentChannelBridge, explicit DocumentChannelParent(const dom::PBrowserOrId& aIframeEmbedding, nsILoadContext* aLoadContext, - PBOverrideStatus aOverrideStatus) { - mParent = new DocumentLoadListener(aIframeEmbedding, aLoadContext, - aOverrideStatus, this); - } + PBOverrideStatus aOverrideStatus); + bool Init(const DocumentChannelCreationArgs& aArgs); // PDocumentChannelParent @@ -70,7 +68,7 @@ class DocumentChannelParent final : public ADocumentChannelBridge, RefPtr RedirectToRealChannel(uint32_t aRedirectFlags, uint32_t aLoadFlags) override; - ~DocumentChannelParent() = default; + ~DocumentChannelParent(); RefPtr mParent; }; diff --git a/netwerk/ipc/DocumentLoadListener.cpp b/netwerk/ipc/DocumentLoadListener.cpp index 8a0419a84869..4b91e1a7b94a 100644 --- a/netwerk/ipc/DocumentLoadListener.cpp +++ b/netwerk/ipc/DocumentLoadListener.cpp @@ -27,6 +27,9 @@ #include "nsIPrompt.h" #include "nsIWindowWatcher.h" +mozilla::LazyLogModule gDocumentChannelLog("DocumentChannel"); +#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt) + using namespace mozilla::dom; namespace mozilla { @@ -52,6 +55,7 @@ DocumentLoadListener::DocumentLoadListener(const PBrowserOrId& aIframeEmbedding, PBOverrideStatus aOverrideStatus, ADocumentChannelBridge* aBridge) : mLoadContext(aLoadContext), mPBOverride(aOverrideStatus) { + LOG(("DocumentLoadListener ctor [this=%p]", this)); RefPtr parent; if (aIframeEmbedding.type() == PBrowserOrId::TPBrowserParent) { parent = @@ -61,6 +65,10 @@ DocumentLoadListener::DocumentLoadListener(const PBrowserOrId& aIframeEmbedding, mDocumentChannelBridge = aBridge; } +DocumentLoadListener::~DocumentLoadListener() { + LOG(("DocumentLoadListener dtor [this=%p]", this)); +} + bool DocumentLoadListener::Open( nsDocShellLoadState* aLoadState, class LoadInfo* aLoadInfo, const nsString* aInitiatorType, nsLoadFlags aLoadFlags, uint32_t aLoadType, @@ -69,6 +77,8 @@ bool DocumentLoadListener::Open( const Maybe& aContentBlockingAllowListPrincipal, const nsString& aCustomUserAgent, const uint64_t& aChannelId, const TimeStamp& aAsyncOpenTime, nsresult* aRv) { + LOG(("DocumentLoadListener Open [this=%p, uri=%s]", this, + aLoadState->URI()->GetSpecOrDefault().get())); if (!nsDocShell::CreateChannelForLoadState( aLoadState, aLoadInfo, mParentChannelListener, nullptr, aInitiatorType, aLoadFlags, aLoadType, aCacheKey, aIsActive, @@ -144,6 +154,8 @@ bool DocumentLoadListener::Open( } void DocumentLoadListener::DocumentChannelBridgeDisconnected() { + LOG(("DocumentLoadListener DocumentChannelBridgeDisconnected [this=%p]", + this)); // The nsHttpChannel may have a reference to this parent, release it // to avoid circular references. RefPtr httpChannelImpl = do_QueryObject(mChannel); @@ -172,6 +184,10 @@ void DocumentLoadListener::Resume() { } void DocumentLoadListener::RedirectToRealChannelFinished(nsresult aRv) { + LOG( + ("DocumentLoadListener RedirectToRealChannelFinished [this=%p, " + "aRv=%" PRIx32 " ]", + this, static_cast(aRv))); if (NS_FAILED(aRv)) { FinishReplacementChannelSetup(false); return; @@ -492,6 +508,8 @@ void DocumentLoadListener::TriggerCrossProcessSwitch() { MOZ_ASSERT(!mDoingProcessSwitch, "Already in the middle of switching?"); MOZ_ASSERT(NS_IsMainThread()); + LOG(("DocumentLoadListener TriggerCrossProcessSwitch [this=%p]", this)); + mDoingProcessSwitch = true; RefPtr self = this; @@ -511,6 +529,7 @@ RefPtr DocumentLoadListener::RedirectToRealChannel( uint32_t aRedirectFlags, uint32_t aLoadFlags, const Maybe& aDestinationProcess) { + LOG(("DocumentLoadListener RedirectToRealChannel [this=%p]", this)); if (aDestinationProcess) { dom::ContentParent* cp = dom::ContentProcessManager::GetSingleton()->GetContentProcessById( @@ -607,6 +626,7 @@ void DocumentLoadListener::TriggerRedirectToRealChannel( NS_IMETHODIMP DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) { + LOG(("DocumentLoadListener OnStartRequest [this=%p]", this)); nsCOMPtr channel = do_QueryInterface(aRequest); mChannel = do_QueryInterface(aRequest); MOZ_DIAGNOSTIC_ASSERT(mChannel); @@ -673,6 +693,7 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) { NS_IMETHODIMP DocumentLoadListener::OnStopRequest(nsIRequest* aRequest, nsresult aStatusCode) { + LOG(("DocumentLoadListener OnStopRequest [this=%p]", this)); mStopRequestValue = Some(aStatusCode); return NS_OK; @@ -682,6 +703,7 @@ NS_IMETHODIMP DocumentLoadListener::OnDataAvailable(nsIRequest* aRequest, nsIInputStream* aInputStream, uint64_t aOffset, uint32_t aCount) { + LOG(("DocumentLoadListener OnDataAvailable [this=%p]", this)); // This isn't supposed to happen, since we suspended the channel, but // sometimes Suspend just doesn't work. This can happen when we're routing // through nsUnknownDecoder to sniff the content type, and it doesn't handle @@ -948,3 +970,5 @@ DocumentLoadListener::GetCrossOriginOpenerPolicy( } // namespace net } // namespace mozilla + +#undef LOG diff --git a/netwerk/ipc/DocumentLoadListener.h b/netwerk/ipc/DocumentLoadListener.h index 8f5362e305a9..a3d47cfe558a 100644 --- a/netwerk/ipc/DocumentLoadListener.h +++ b/netwerk/ipc/DocumentLoadListener.h @@ -153,7 +153,7 @@ class DocumentLoadListener : public nsIInterfaceRequestor, uint32_t aLoadFlags); protected: - virtual ~DocumentLoadListener() = default; + virtual ~DocumentLoadListener(); // Initiates the switch from DocumentChannel to the real protocol-specific // channel, and ensures that RedirectToRealChannelFinished is called when