From f592edc9478dece7ac1b522e75f3fdb0b5e1904a Mon Sep 17 00:00:00 2001 From: "rusty.lynch%intel.com" Date: Fri, 2 Jun 2000 15:50:36 +0000 Subject: [PATCH] Fix for bug #40997. a=warren --- netwerk/protocol/about/src/nsAboutBloat.cpp | 10 +++++++--- xpcom/base/nsTraceRefcnt.cpp | 10 ++++++---- xpcom/base/nsTraceRefcntImpl.cpp | 10 ++++++---- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/netwerk/protocol/about/src/nsAboutBloat.cpp b/netwerk/protocol/about/src/nsAboutBloat.cpp index d59ed2f28ef3..468b108b2cc2 100644 --- a/netwerk/protocol/about/src/nsAboutBloat.cpp +++ b/netwerk/protocol/about/src/nsAboutBloat.cpp @@ -97,9 +97,10 @@ nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result) } else { nsCOMPtr file; - rv = NS_GetSpecialDirectory("xpcom.currentProcess.componentRegistry", - getter_AddRefs(file)); + rv = NS_GetSpecialDirectory("xpcom.currentProcess.componentDirectory", + getter_AddRefs(file)); if (NS_FAILED(rv)) return rv; + rv = file->Append("bloatlogs"); if (NS_FAILED(rv)) return rv; @@ -108,7 +109,10 @@ nsAboutBloat::NewChannel(nsIURI *aURI, nsIChannel **result) if (NS_FAILED(rv)) return rv; if (!exists) { - rv = file->Create(nsIFile::DIRECTORY_TYPE, 0664); + // On all the platforms that I know use permissions, + // directories need to have the executable flag set + // if you want to do anything inside the directory. + rv = file->Create(nsIFile::DIRECTORY_TYPE, 0755); if (NS_FAILED(rv)) return rv; } diff --git a/xpcom/base/nsTraceRefcnt.cpp b/xpcom/base/nsTraceRefcnt.cpp index 04bfe5f95c31..46b2df92168b 100644 --- a/xpcom/base/nsTraceRefcnt.cpp +++ b/xpcom/base/nsTraceRefcnt.cpp @@ -348,16 +348,18 @@ GetBloatEntry(const char* aTypeName, PRUint32 aInstanceSize) BloatEntry* entry = NULL; if (gBloatView) { entry = (BloatEntry*)PL_HashTableLookup(gBloatView, aTypeName); - if (entry == NULL) { + if (entry == NULL && aInstanceSize > 0) { + entry = new BloatEntry(aTypeName, aInstanceSize); PLHashEntry* e = PL_HashTableAdd(gBloatView, aTypeName, entry); if (e == NULL) { delete entry; entry = NULL; } - } - else { - NS_ASSERTION(aInstanceSize == 0 || entry->GetClassSize() == aInstanceSize, "bad size recorded"); + } else { + NS_ASSERTION(aInstanceSize == 0 || + entry->GetClassSize() == aInstanceSize, + "bad size recorded"); } } return entry; diff --git a/xpcom/base/nsTraceRefcntImpl.cpp b/xpcom/base/nsTraceRefcntImpl.cpp index 04bfe5f95c31..46b2df92168b 100644 --- a/xpcom/base/nsTraceRefcntImpl.cpp +++ b/xpcom/base/nsTraceRefcntImpl.cpp @@ -348,16 +348,18 @@ GetBloatEntry(const char* aTypeName, PRUint32 aInstanceSize) BloatEntry* entry = NULL; if (gBloatView) { entry = (BloatEntry*)PL_HashTableLookup(gBloatView, aTypeName); - if (entry == NULL) { + if (entry == NULL && aInstanceSize > 0) { + entry = new BloatEntry(aTypeName, aInstanceSize); PLHashEntry* e = PL_HashTableAdd(gBloatView, aTypeName, entry); if (e == NULL) { delete entry; entry = NULL; } - } - else { - NS_ASSERTION(aInstanceSize == 0 || entry->GetClassSize() == aInstanceSize, "bad size recorded"); + } else { + NS_ASSERTION(aInstanceSize == 0 || + entry->GetClassSize() == aInstanceSize, + "bad size recorded"); } } return entry;