From f1604cee10edacd5bbfc4f36dc54c1fd8cc7a002 Mon Sep 17 00:00:00 2001 From: Honza Bambas Date: Tue, 30 Jun 2020 07:15:33 +0000 Subject: [PATCH] Bug 1649003 - Log JS stacks from inside HTTP channel suspend() and resume() methods, r=valentin,necko-reviewers Differential Revision: https://phabricator.services.mozilla.com/D81570 --- netwerk/protocol/http/HttpChannelChild.cpp | 4 ++++ netwerk/protocol/http/nsHttpChannel.cpp | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp index f38d17193a3f..e74c7004a431 100644 --- a/netwerk/protocol/http/HttpChannelChild.cpp +++ b/netwerk/protocol/http/HttpChannelChild.cpp @@ -2305,6 +2305,8 @@ HttpChannelChild::Suspend() { NS_ENSURE_TRUE(RemoteChannelExists() || mInterceptListener, NS_ERROR_NOT_AVAILABLE); + LogCallingScriptLocation(this); + // SendSuspend only once, when suspend goes from 0 to 1. // Don't SendSuspend at all if we're diverting callbacks to the parent; // suspend will be called at the correct time in the parent itself. @@ -2332,6 +2334,8 @@ HttpChannelChild::Resume() { NS_ERROR_NOT_AVAILABLE); NS_ENSURE_TRUE(mSuspendCount > 0, NS_ERROR_UNEXPECTED); + LogCallingScriptLocation(this); + nsresult rv = NS_OK; // SendResume only once, when suspend count drops to 0. diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 2863c62acc3c..7351f41927fc 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -6301,6 +6301,8 @@ nsHttpChannel::Cancel(nsresult status) { return NS_OK; } + LogCallingScriptLocation(this); + if (mWaitingForRedirectCallback) { LOG(("channel canceled during wait for redirect callback")); } @@ -6484,6 +6486,7 @@ nsHttpChannel::AsyncOpen(nsIStreamListener* aListener) { "security flags in loadInfo but doContentSecurityCheck() not called"); LOG(("nsHttpChannel::AsyncOpen [this=%p]\n", this)); + LogCallingScriptLocation(this); #ifdef MOZ_TASK_TRACER if (tasktracer::IsStartLogging()) { @@ -9394,6 +9397,7 @@ nsHttpChannel::SuspendInternal() { NS_ENSURE_TRUE(mIsPending, NS_ERROR_NOT_AVAILABLE); LOG(("nsHttpChannel::SuspendInternal [this=%p]\n", this)); + LogCallingScriptLocation(this); ++mSuspendCount; @@ -9435,6 +9439,7 @@ nsHttpChannel::ResumeInternal() { NS_ENSURE_TRUE(mSuspendCount > 0, NS_ERROR_UNEXPECTED); LOG(("nsHttpChannel::ResumeInternal [this=%p]\n", this)); + LogCallingScriptLocation(this); if (--mSuspendCount == 0) { mSuspendTotalTime +=