Bug 872678: Mark nsStaticNameTable immutable after initialization to fix assertions r=dbaron

This commit is contained in:
David Zbarsky 2013-05-21 18:22:45 +08:00
parent 4a039e4a6e
commit d2ab636b5e

View File

@ -26,7 +26,7 @@ struct NameTableKey
{
mKeyStr.m1b = aKeyStr;
}
NameTableKey(const nsAFlatString* aKeyStr)
: mIsUnichar(true)
{
@ -56,7 +56,7 @@ matchNameKeysCaseInsensitive(PLDHashTable*, const PLDHashEntryHdr* aHdr,
const NameTableKey *keyValue = static_cast<const NameTableKey*>(key);
const nsAFlatCString* entryKey = entry->mString;
if (keyValue->mIsUnichar) {
return keyValue->mKeyStr.m2b->
LowerCaseEqualsASCII(entryKey->get(), entryKey->Length());
@ -127,7 +127,7 @@ nsStaticCaseInsensitiveNameTable::~nsStaticCaseInsensitiveNameTable()
MOZ_COUNT_DTOR(nsStaticCaseInsensitiveNameTable);
}
bool
bool
nsStaticCaseInsensitiveNameTable::Init(const char* const aNames[], int32_t Count)
{
NS_ASSERTION(!mNameArray, "double Init");
@ -179,6 +179,9 @@ nsStaticCaseInsensitiveNameTable::Init(const char* const aNames[], int32_t Count
entry->mString = strPtr; // not owned!
entry->mIndex = index;
}
#ifdef DEBUG
PL_DHashMarkTableImmutable(&mNameTable);
#endif
return true;
}