mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1598516 - Add DocumentChannel MOZ_LOGs. r=jya
Differential Revision: https://phabricator.services.mozilla.com/D54250 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
9631fb7196
commit
e6d9c278a0
@ -31,6 +31,9 @@
|
|||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
using namespace mozilla::ipc;
|
using namespace mozilla::ipc;
|
||||||
|
|
||||||
|
extern mozilla::LazyLogModule gDocumentChannelLog;
|
||||||
|
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace net {
|
namespace net {
|
||||||
|
|
||||||
@ -74,12 +77,18 @@ DocumentChannelChild::DocumentChannelChild(
|
|||||||
mLoadFlags(aLoadFlags),
|
mLoadFlags(aLoadFlags),
|
||||||
mURI(aLoadState->URI()),
|
mURI(aLoadState->URI()),
|
||||||
mLoadInfo(aLoadInfo) {
|
mLoadInfo(aLoadInfo) {
|
||||||
|
LOG(("DocumentChannelChild ctor [this=%p, uri=%s]", this,
|
||||||
|
aLoadState->URI()->GetSpecOrDefault().get()));
|
||||||
RefPtr<nsHttpHandler> handler = nsHttpHandler::GetInstance();
|
RefPtr<nsHttpHandler> handler = nsHttpHandler::GetInstance();
|
||||||
uint64_t channelId;
|
uint64_t channelId;
|
||||||
Unused << handler->NewChannelId(channelId);
|
Unused << handler->NewChannelId(channelId);
|
||||||
mChannelId = channelId;
|
mChannelId = channelId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DocumentChannelChild::~DocumentChannelChild() {
|
||||||
|
LOG(("DocumentChannelChild dtor [this=%p]", this));
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) {
|
DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) {
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
@ -204,6 +213,8 @@ IPCResult DocumentChannelChild::RecvFailedAsyncOpen(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DocumentChannelChild::ShutdownListeners(nsresult aStatusCode) {
|
void DocumentChannelChild::ShutdownListeners(nsresult aStatusCode) {
|
||||||
|
LOG(("DocumentChannelChild ShutdownListeners [this=%p, status=%" PRIx32 "]",
|
||||||
|
this, static_cast<uint32_t>(aStatusCode)));
|
||||||
mStatus = aStatusCode;
|
mStatus = aStatusCode;
|
||||||
|
|
||||||
nsCOMPtr<nsIStreamListener> l = mListener;
|
nsCOMPtr<nsIStreamListener> l = mListener;
|
||||||
@ -255,6 +266,9 @@ IPCResult DocumentChannelChild::RecvDeleteSelf() {
|
|||||||
IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
|
IPCResult DocumentChannelChild::RecvRedirectToRealChannel(
|
||||||
const RedirectToRealChannelArgs& aArgs,
|
const RedirectToRealChannelArgs& aArgs,
|
||||||
RedirectToRealChannelResolver&& aResolve) {
|
RedirectToRealChannelResolver&& aResolve) {
|
||||||
|
LOG(("DocumentChannelChild RecvRedirectToRealChannel [this=%p, uri=%s]", this,
|
||||||
|
aArgs.uri()->GetSpecOrDefault().get()));
|
||||||
|
|
||||||
RefPtr<dom::Document> loadingDocument;
|
RefPtr<dom::Document> loadingDocument;
|
||||||
mLoadInfo->GetLoadingDocument(getter_AddRefs(loadingDocument));
|
mLoadInfo->GetLoadingDocument(getter_AddRefs(loadingDocument));
|
||||||
|
|
||||||
@ -692,3 +706,5 @@ DocumentChannelChild::SetChannelId(uint64_t aChannelId) {
|
|||||||
|
|
||||||
} // namespace net
|
} // namespace net
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#undef LOG
|
||||||
|
@ -70,7 +70,7 @@ class DocumentChannelChild final : public nsHashPropertyBag,
|
|||||||
private:
|
private:
|
||||||
void ShutdownListeners(nsresult aStatusCode);
|
void ShutdownListeners(nsresult aStatusCode);
|
||||||
|
|
||||||
~DocumentChannelChild() = default;
|
~DocumentChannelChild();
|
||||||
|
|
||||||
nsCOMPtr<nsIChannel> mRedirectChannel;
|
nsCOMPtr<nsIChannel> mRedirectChannel;
|
||||||
nsTArray<DocumentChannelRedirect> mRedirects;
|
nsTArray<DocumentChannelRedirect> mRedirects;
|
||||||
|
@ -7,12 +7,29 @@
|
|||||||
|
|
||||||
#include "DocumentChannelParent.h"
|
#include "DocumentChannelParent.h"
|
||||||
|
|
||||||
|
extern mozilla::LazyLogModule gDocumentChannelLog;
|
||||||
|
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace net {
|
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) {
|
bool DocumentChannelParent::Init(const DocumentChannelCreationArgs& aArgs) {
|
||||||
RefPtr<nsDocShellLoadState> loadState =
|
RefPtr<nsDocShellLoadState> loadState =
|
||||||
new nsDocShellLoadState(aArgs.loadState());
|
new nsDocShellLoadState(aArgs.loadState());
|
||||||
|
LOG(("DocumentChannelParent Init [this=%p, uri=%s]", this,
|
||||||
|
loadState->URI()->GetSpecOrDefault().get()));
|
||||||
|
|
||||||
RefPtr<class LoadInfo> loadInfo;
|
RefPtr<class LoadInfo> loadInfo;
|
||||||
nsresult rv = mozilla::ipc::LoadInfoArgsToLoadInfo(Some(aArgs.loadInfo()),
|
nsresult rv = mozilla::ipc::LoadInfoArgsToLoadInfo(Some(aArgs.loadInfo()),
|
||||||
@ -43,3 +60,5 @@ DocumentChannelParent::RedirectToRealChannel(uint32_t aRedirectFlags,
|
|||||||
|
|
||||||
} // namespace net
|
} // namespace net
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#undef LOG
|
||||||
|
@ -25,10 +25,8 @@ class DocumentChannelParent final : public ADocumentChannelBridge,
|
|||||||
|
|
||||||
explicit DocumentChannelParent(const dom::PBrowserOrId& aIframeEmbedding,
|
explicit DocumentChannelParent(const dom::PBrowserOrId& aIframeEmbedding,
|
||||||
nsILoadContext* aLoadContext,
|
nsILoadContext* aLoadContext,
|
||||||
PBOverrideStatus aOverrideStatus) {
|
PBOverrideStatus aOverrideStatus);
|
||||||
mParent = new DocumentLoadListener(aIframeEmbedding, aLoadContext,
|
|
||||||
aOverrideStatus, this);
|
|
||||||
}
|
|
||||||
bool Init(const DocumentChannelCreationArgs& aArgs);
|
bool Init(const DocumentChannelCreationArgs& aArgs);
|
||||||
|
|
||||||
// PDocumentChannelParent
|
// PDocumentChannelParent
|
||||||
@ -70,7 +68,7 @@ class DocumentChannelParent final : public ADocumentChannelBridge,
|
|||||||
RefPtr<PDocumentChannelParent::RedirectToRealChannelPromise>
|
RefPtr<PDocumentChannelParent::RedirectToRealChannelPromise>
|
||||||
RedirectToRealChannel(uint32_t aRedirectFlags, uint32_t aLoadFlags) override;
|
RedirectToRealChannel(uint32_t aRedirectFlags, uint32_t aLoadFlags) override;
|
||||||
|
|
||||||
~DocumentChannelParent() = default;
|
~DocumentChannelParent();
|
||||||
|
|
||||||
RefPtr<DocumentLoadListener> mParent;
|
RefPtr<DocumentLoadListener> mParent;
|
||||||
};
|
};
|
||||||
|
@ -27,6 +27,9 @@
|
|||||||
#include "nsIPrompt.h"
|
#include "nsIPrompt.h"
|
||||||
#include "nsIWindowWatcher.h"
|
#include "nsIWindowWatcher.h"
|
||||||
|
|
||||||
|
mozilla::LazyLogModule gDocumentChannelLog("DocumentChannel");
|
||||||
|
#define LOG(fmt) MOZ_LOG(gDocumentChannelLog, mozilla::LogLevel::Verbose, fmt)
|
||||||
|
|
||||||
using namespace mozilla::dom;
|
using namespace mozilla::dom;
|
||||||
|
|
||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
@ -52,6 +55,7 @@ DocumentLoadListener::DocumentLoadListener(const PBrowserOrId& aIframeEmbedding,
|
|||||||
PBOverrideStatus aOverrideStatus,
|
PBOverrideStatus aOverrideStatus,
|
||||||
ADocumentChannelBridge* aBridge)
|
ADocumentChannelBridge* aBridge)
|
||||||
: mLoadContext(aLoadContext), mPBOverride(aOverrideStatus) {
|
: mLoadContext(aLoadContext), mPBOverride(aOverrideStatus) {
|
||||||
|
LOG(("DocumentLoadListener ctor [this=%p]", this));
|
||||||
RefPtr<dom::BrowserParent> parent;
|
RefPtr<dom::BrowserParent> parent;
|
||||||
if (aIframeEmbedding.type() == PBrowserOrId::TPBrowserParent) {
|
if (aIframeEmbedding.type() == PBrowserOrId::TPBrowserParent) {
|
||||||
parent =
|
parent =
|
||||||
@ -61,6 +65,10 @@ DocumentLoadListener::DocumentLoadListener(const PBrowserOrId& aIframeEmbedding,
|
|||||||
mDocumentChannelBridge = aBridge;
|
mDocumentChannelBridge = aBridge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DocumentLoadListener::~DocumentLoadListener() {
|
||||||
|
LOG(("DocumentLoadListener dtor [this=%p]", this));
|
||||||
|
}
|
||||||
|
|
||||||
bool DocumentLoadListener::Open(
|
bool DocumentLoadListener::Open(
|
||||||
nsDocShellLoadState* aLoadState, class LoadInfo* aLoadInfo,
|
nsDocShellLoadState* aLoadState, class LoadInfo* aLoadInfo,
|
||||||
const nsString* aInitiatorType, nsLoadFlags aLoadFlags, uint32_t aLoadType,
|
const nsString* aInitiatorType, nsLoadFlags aLoadFlags, uint32_t aLoadType,
|
||||||
@ -69,6 +77,8 @@ bool DocumentLoadListener::Open(
|
|||||||
const Maybe<PrincipalInfo>& aContentBlockingAllowListPrincipal,
|
const Maybe<PrincipalInfo>& aContentBlockingAllowListPrincipal,
|
||||||
const nsString& aCustomUserAgent, const uint64_t& aChannelId,
|
const nsString& aCustomUserAgent, const uint64_t& aChannelId,
|
||||||
const TimeStamp& aAsyncOpenTime, nsresult* aRv) {
|
const TimeStamp& aAsyncOpenTime, nsresult* aRv) {
|
||||||
|
LOG(("DocumentLoadListener Open [this=%p, uri=%s]", this,
|
||||||
|
aLoadState->URI()->GetSpecOrDefault().get()));
|
||||||
if (!nsDocShell::CreateChannelForLoadState(
|
if (!nsDocShell::CreateChannelForLoadState(
|
||||||
aLoadState, aLoadInfo, mParentChannelListener, nullptr,
|
aLoadState, aLoadInfo, mParentChannelListener, nullptr,
|
||||||
aInitiatorType, aLoadFlags, aLoadType, aCacheKey, aIsActive,
|
aInitiatorType, aLoadFlags, aLoadType, aCacheKey, aIsActive,
|
||||||
@ -144,6 +154,8 @@ bool DocumentLoadListener::Open(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DocumentLoadListener::DocumentChannelBridgeDisconnected() {
|
void DocumentLoadListener::DocumentChannelBridgeDisconnected() {
|
||||||
|
LOG(("DocumentLoadListener DocumentChannelBridgeDisconnected [this=%p]",
|
||||||
|
this));
|
||||||
// The nsHttpChannel may have a reference to this parent, release it
|
// The nsHttpChannel may have a reference to this parent, release it
|
||||||
// to avoid circular references.
|
// to avoid circular references.
|
||||||
RefPtr<nsHttpChannel> httpChannelImpl = do_QueryObject(mChannel);
|
RefPtr<nsHttpChannel> httpChannelImpl = do_QueryObject(mChannel);
|
||||||
@ -172,6 +184,10 @@ void DocumentLoadListener::Resume() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DocumentLoadListener::RedirectToRealChannelFinished(nsresult aRv) {
|
void DocumentLoadListener::RedirectToRealChannelFinished(nsresult aRv) {
|
||||||
|
LOG(
|
||||||
|
("DocumentLoadListener RedirectToRealChannelFinished [this=%p, "
|
||||||
|
"aRv=%" PRIx32 " ]",
|
||||||
|
this, static_cast<uint32_t>(aRv)));
|
||||||
if (NS_FAILED(aRv)) {
|
if (NS_FAILED(aRv)) {
|
||||||
FinishReplacementChannelSetup(false);
|
FinishReplacementChannelSetup(false);
|
||||||
return;
|
return;
|
||||||
@ -492,6 +508,8 @@ void DocumentLoadListener::TriggerCrossProcessSwitch() {
|
|||||||
MOZ_ASSERT(!mDoingProcessSwitch, "Already in the middle of switching?");
|
MOZ_ASSERT(!mDoingProcessSwitch, "Already in the middle of switching?");
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
|
|
||||||
|
LOG(("DocumentLoadListener TriggerCrossProcessSwitch [this=%p]", this));
|
||||||
|
|
||||||
mDoingProcessSwitch = true;
|
mDoingProcessSwitch = true;
|
||||||
|
|
||||||
RefPtr<DocumentLoadListener> self = this;
|
RefPtr<DocumentLoadListener> self = this;
|
||||||
@ -511,6 +529,7 @@ RefPtr<PDocumentChannelParent::RedirectToRealChannelPromise>
|
|||||||
DocumentLoadListener::RedirectToRealChannel(
|
DocumentLoadListener::RedirectToRealChannel(
|
||||||
uint32_t aRedirectFlags, uint32_t aLoadFlags,
|
uint32_t aRedirectFlags, uint32_t aLoadFlags,
|
||||||
const Maybe<uint64_t>& aDestinationProcess) {
|
const Maybe<uint64_t>& aDestinationProcess) {
|
||||||
|
LOG(("DocumentLoadListener RedirectToRealChannel [this=%p]", this));
|
||||||
if (aDestinationProcess) {
|
if (aDestinationProcess) {
|
||||||
dom::ContentParent* cp =
|
dom::ContentParent* cp =
|
||||||
dom::ContentProcessManager::GetSingleton()->GetContentProcessById(
|
dom::ContentProcessManager::GetSingleton()->GetContentProcessById(
|
||||||
@ -607,6 +626,7 @@ void DocumentLoadListener::TriggerRedirectToRealChannel(
|
|||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
||||||
|
LOG(("DocumentLoadListener OnStartRequest [this=%p]", this));
|
||||||
nsCOMPtr<nsHttpChannel> channel = do_QueryInterface(aRequest);
|
nsCOMPtr<nsHttpChannel> channel = do_QueryInterface(aRequest);
|
||||||
mChannel = do_QueryInterface(aRequest);
|
mChannel = do_QueryInterface(aRequest);
|
||||||
MOZ_DIAGNOSTIC_ASSERT(mChannel);
|
MOZ_DIAGNOSTIC_ASSERT(mChannel);
|
||||||
@ -673,6 +693,7 @@ DocumentLoadListener::OnStartRequest(nsIRequest* aRequest) {
|
|||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DocumentLoadListener::OnStopRequest(nsIRequest* aRequest,
|
DocumentLoadListener::OnStopRequest(nsIRequest* aRequest,
|
||||||
nsresult aStatusCode) {
|
nsresult aStatusCode) {
|
||||||
|
LOG(("DocumentLoadListener OnStopRequest [this=%p]", this));
|
||||||
mStopRequestValue = Some(aStatusCode);
|
mStopRequestValue = Some(aStatusCode);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -682,6 +703,7 @@ NS_IMETHODIMP
|
|||||||
DocumentLoadListener::OnDataAvailable(nsIRequest* aRequest,
|
DocumentLoadListener::OnDataAvailable(nsIRequest* aRequest,
|
||||||
nsIInputStream* aInputStream,
|
nsIInputStream* aInputStream,
|
||||||
uint64_t aOffset, uint32_t aCount) {
|
uint64_t aOffset, uint32_t aCount) {
|
||||||
|
LOG(("DocumentLoadListener OnDataAvailable [this=%p]", this));
|
||||||
// This isn't supposed to happen, since we suspended the channel, but
|
// 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
|
// 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
|
// through nsUnknownDecoder to sniff the content type, and it doesn't handle
|
||||||
@ -948,3 +970,5 @@ DocumentLoadListener::GetCrossOriginOpenerPolicy(
|
|||||||
|
|
||||||
} // namespace net
|
} // namespace net
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
|
#undef LOG
|
||||||
|
@ -153,7 +153,7 @@ class DocumentLoadListener : public nsIInterfaceRequestor,
|
|||||||
uint32_t aLoadFlags);
|
uint32_t aLoadFlags);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual ~DocumentLoadListener() = default;
|
virtual ~DocumentLoadListener();
|
||||||
|
|
||||||
// Initiates the switch from DocumentChannel to the real protocol-specific
|
// Initiates the switch from DocumentChannel to the real protocol-specific
|
||||||
// channel, and ensures that RedirectToRealChannelFinished is called when
|
// channel, and ensures that RedirectToRealChannelFinished is called when
|
||||||
|
Loading…
Reference in New Issue
Block a user