зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1293501 - Add some more crash annotations to dianose bug 1145613. r=mcmanus
MozReview-Commit-ID: 4hsrKYlV0ER --HG-- extra : transplant_source : %0BF%BB%02%B5%C4%D9H%DC%07%FC%BD%BDQ7%5Dr%AD%19%F4
This commit is contained in:
Родитель
fac28ffa34
Коммит
70ba2956d1
|
@ -19,6 +19,34 @@
|
|||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
|
||||
void nsHttpRequestHead::DbgReentrantMonitorAutoEnter::DbgCheck(bool aIn)
|
||||
{
|
||||
nsHttpAtom header;
|
||||
if (!mInstance.mAnnotated && mInstance.mHeaders.Count() &&
|
||||
!mInstance.mHeaders.PeekHeaderAt(0, header)) {
|
||||
nsAutoCString str;
|
||||
str.Append(nsPrintfCString("%s %s", aIn ? "in" : "out", mFunc));
|
||||
// Output the content of the array header and the first nsEntry.
|
||||
const uint8_t* p = reinterpret_cast<uint8_t*>
|
||||
(mInstance.mHeaders.mHeaders.Elements()) - sizeof(nsTArrayHeader);
|
||||
for (int i = 0; i < 28; ++i, ++p) {
|
||||
str.Append(nsPrintfCString(" %02x", *p));
|
||||
}
|
||||
CrashReporter::AnnotateCrashReport(
|
||||
NS_LITERAL_CSTRING("InvalidHttpHeaderArray"), str);
|
||||
// Make sure we annotate only when we found it is invalid at the first
|
||||
// time.
|
||||
mInstance.mAnnotated = true;
|
||||
}
|
||||
}
|
||||
|
||||
#define ReentrantMonitorAutoEnter DbgReentrantMonitorAutoEnter
|
||||
#define mon(x) mon(*this, __func__)
|
||||
|
||||
#endif
|
||||
|
||||
nsHttpRequestHead::nsHttpRequestHead()
|
||||
: mMethod(NS_LITERAL_CSTRING("GET"))
|
||||
, mVersion(NS_HTTP_VERSION_1_1)
|
||||
|
@ -26,6 +54,9 @@ nsHttpRequestHead::nsHttpRequestHead()
|
|||
, mHTTPS(false)
|
||||
, mReentrantMonitor("nsHttpRequestHead.mReentrantMonitor")
|
||||
, mInVisitHeaders(false)
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
, mAnnotated(false)
|
||||
#endif
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsHttpRequestHead);
|
||||
}
|
||||
|
@ -49,22 +80,6 @@ void
|
|||
nsHttpRequestHead::SetHeaders(const nsHttpHeaderArray& aHeaders)
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
nsHttpAtom header;
|
||||
if (mHeaders.Count() && !mHeaders.PeekHeaderAt(0, header)) {
|
||||
nsAutoCString str;
|
||||
const uint8_t* p = reinterpret_cast<uint8_t*>(mHeaders.mHeaders.Elements()) -
|
||||
sizeof(nsTArrayHeader);
|
||||
for (int i = 0; i < 48; ++i, ++p) {
|
||||
str.Append(nsPrintfCString("%02x ", *p));
|
||||
}
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("HttpHeaderArray"), str);
|
||||
if (header._val) {
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("HttpHeaderArray[0].header"),
|
||||
nsDependentCString(header._val));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
mHeaders = aHeaders;
|
||||
}
|
||||
|
||||
|
@ -138,7 +153,7 @@ nsHttpRequestHead::Path(nsACString &aPath)
|
|||
void
|
||||
nsHttpRequestHead::SetHTTPS(bool val)
|
||||
{
|
||||
ReentrantMonitorAutoEnter monk(mReentrantMonitor);
|
||||
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
|
||||
mHTTPS = val;
|
||||
}
|
||||
|
||||
|
@ -384,5 +399,10 @@ nsHttpRequestHead::Flatten(nsACString &buf, bool pruneProxyHeaders)
|
|||
mHeaders.Flatten(buf, pruneProxyHeaders, false);
|
||||
}
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
#undef ReentrantMonitorAutoEnter
|
||||
#undef mon
|
||||
#endif
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -120,6 +120,33 @@ private:
|
|||
|
||||
// During VisitHeader we sould not allow cal to SetHeader.
|
||||
bool mInVisitHeaders;
|
||||
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
class DbgReentrantMonitorAutoEnter : ReentrantMonitorAutoEnter
|
||||
{
|
||||
public:
|
||||
explicit DbgReentrantMonitorAutoEnter(nsHttpRequestHead& aInstance,
|
||||
const char* aFunc)
|
||||
: ReentrantMonitorAutoEnter(aInstance.mReentrantMonitor),
|
||||
mInstance(aInstance),
|
||||
mFunc(aFunc)
|
||||
{
|
||||
DbgCheck(true);
|
||||
}
|
||||
~DbgReentrantMonitorAutoEnter(void)
|
||||
{
|
||||
DbgCheck(false);
|
||||
}
|
||||
|
||||
private:
|
||||
void DbgCheck(bool aIn);
|
||||
|
||||
nsHttpRequestHead& mInstance;
|
||||
const char* mFunc;
|
||||
};
|
||||
|
||||
bool mAnnotated;
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
|
Загрузка…
Ссылка в новой задаче