Bug 1124973 (part 6) - Delete some incorrect comments about PL_DHashTableLookup. r=froydnj.
The comments about PL_DHashTableLookup in nsContentList.cpp aren't quite
correct -- Add() can OOM even if the looked-for key is already in the table.
More generally, they don't seem worth correcting, so I just removed them.
--- a/dom/base/nsContentList.cpp
+++ b/dom/base/nsContentList.cpp
@@ -218,19 +218,16 @@ NS_GetContentList(nsINode* aRootNode,
if (!gContentListHashTable.IsInitialized()) {
PL_DHashTableInit(&gContentListHashTable, &hash_table_ops,
sizeof(ContentListHashEntry));
}
ContentListHashEntry *entry = nullptr;
// First we look in our hashtable. Then we create a content list if needed
if (gContentListHashTable.IsInitialized()) {
-
- // A PL_DHashTableAdd is equivalent to a PL_DHashTableLookup for cases
- // when the entry is already in the hashtable.
entry = static_cast<ContentListHashEntry *>
(PL_DHashTableAdd(&gContentListHashTable, &hashKey));
if (entry)
list = entry->mContentList;
}
if (!list) {
// We need to create a ContentList and add it to our new entry, if
@@ -239,18 +236,17 @@ NS_GetContentList(nsINode* aRootNode,
nsCOMPtr<nsIAtom> htmlAtom;
if (aMatchNameSpaceId == kNameSpaceID_Unknown) {
nsAutoString lowercaseName;
nsContentUtils::ASCIIToLower(aTagname, lowercaseName);
htmlAtom = do_GetAtom(lowercaseName);
} else {
htmlAtom = xmlAtom;
}
- list = new nsContentList(aRootNode, aMatchNameSpaceId,
- htmlAtom, xmlAtom);
+ list = new nsContentList(aRootNode, aMatchNameSpaceId, htmlAtom, xmlAtom);
if (entry) {
entry->mContentList = list;
}
}
sRecentlyUsedContentLists[recentlyUsedCacheIndex] = list;
return list.forget();
}
@@ -330,18 +326,16 @@ GetFuncStringContentList(nsINode* aRootN
sizeof(FuncStringContentListHashEntry));
}
FuncStringContentListHashEntry *entry = nullptr;
// First we look in our hashtable. Then we create a content list if needed
if (gFuncStringContentListHashTable.IsInitialized()) {
nsFuncStringCacheKey hashKey(aRootNode, aFunc, aString);
- // A PL_DHashTableAdd is equivalent to a PL_DHashTableLookup for cases
- // when the entry is already in the hashtable.
entry = static_cast<FuncStringContentListHashEntry *>
(PL_DHashTableAdd(&gFuncStringContentListHashTable,
&hashKey));
if (entry) {
list = entry->mContentList;
#ifdef DEBUG
MOZ_ASSERT_IF(list, list->mType == ListType::sType);
#endif