зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1445796 - Add logging of a calling JS script to more http channel methods. r=valentin
This commit is contained in:
Родитель
c22fbf595e
Коммит
e5943f18e9
|
@ -2206,6 +2206,7 @@ HttpBaseChannel::RedirectTo(nsIURI *targetURI)
|
|||
nsAutoCString spec;
|
||||
targetURI->GetAsciiSpec(spec);
|
||||
LOG(("HttpBaseChannel::RedirectTo [this=%p, uri=%s]", this, spec.get()));
|
||||
LogCallingScriptLocation(this);
|
||||
|
||||
// We cannot redirect after OnStartRequest of the listener
|
||||
// has been called, since to redirect we have to switch channels
|
||||
|
|
|
@ -2356,6 +2356,8 @@ HttpChannelChild::Cancel(nsresult status)
|
|||
{
|
||||
LOG(("HttpChannelChild::Cancel [this=%p, status=%" PRIx32 "]\n",
|
||||
this, static_cast<uint32_t>(status)));
|
||||
LogCallingScriptLocation(this);
|
||||
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (!mCanceled) {
|
||||
|
@ -2467,18 +2469,7 @@ HttpChannelChild::AsyncOpen(nsIStreamListener *listener, nsISupports *aContext)
|
|||
"security flags in loadInfo but asyncOpen2() not called");
|
||||
|
||||
LOG(("HttpChannelChild::AsyncOpen [this=%p uri=%s]\n", this, mSpec.get()));
|
||||
|
||||
if (LOG4_ENABLED()) {
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (cx) {
|
||||
nsAutoCString fileNameString;
|
||||
uint32_t line = 0, col = 0;
|
||||
if (nsJSUtils::GetCallingLocation(cx, fileNameString, &line, &col)) {
|
||||
LOG(("HttpChannelChild %p source script=%s:%u:%u",
|
||||
this, fileNameString.get(), line, col));
|
||||
}
|
||||
}
|
||||
}
|
||||
LogCallingScriptLocation(this);
|
||||
|
||||
#ifdef DEBUG
|
||||
AssertPrivateBrowsingId();
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
//
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
void LogCallingScriptLocation(void* instance);
|
||||
extern LazyLogModule gHttpLog;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -835,5 +835,25 @@ ParsedHeaderValueListList::ParsedHeaderValueListList(const nsCString &fullHeader
|
|||
Tokenize(mFull.BeginReading(), mFull.Length(), ',', consumer);
|
||||
}
|
||||
|
||||
void LogCallingScriptLocation(void* instance)
|
||||
{
|
||||
if (!LOG4_ENABLED()) {
|
||||
return;
|
||||
}
|
||||
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (!cx) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString fileNameString;
|
||||
uint32_t line = 0, col = 0;
|
||||
if (!nsJSUtils::GetCallingLocation(cx, fileNameString, &line, &col)) {
|
||||
return;
|
||||
}
|
||||
|
||||
LOG(("%p called from script: %s:%u:%u", instance, fileNameString.get(), line, col));
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
Загрузка…
Ссылка в новой задаче