Bug 1121760 (part 1) - Remove PL_DHashTableSearch(). r=poiru.
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 21 May 2015 00:34:25 -0700
changeset 262707 e37d0c2d053a28f4361a495a4ec20d8488406d64
parent 262706 1444325d48409dac0531e73f2df9d56ac7776557
child 262708 16597175b6f3678f38020fdf4c4a7f4debf38d2e
push id29381
push userkwierso@gmail.com
push dateWed, 16 Sep 2015 17:53:22 +0000
treeherdermozilla-central@3618c94059d8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspoiru
bugs1121760
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1121760 (part 1) - Remove PL_DHashTableSearch(). r=poiru.
dom/base/nsContentUtils.cpp
dom/base/nsDocument.cpp
dom/base/nsPropertyTable.cpp
dom/base/nsScriptNameSpaceManager.cpp
dom/plugins/base/nsJSNPRuntime.cpp
dom/xul/XULDocument.cpp
dom/xul/templates/nsContentSupportMap.h
dom/xul/templates/nsTemplateMap.h
embedding/components/commandhandler/nsCommandParams.cpp
gfx/thebes/gfxFT2FontList.cpp
js/xpconnect/src/XPCMaps.h
layout/base/nsFrameManager.cpp
layout/style/nsCSSRuleProcessor.cpp
modules/libpref/prefapi.cpp
netwerk/base/nsLoadGroup.cpp
netwerk/cache/nsCacheEntry.cpp
netwerk/cache/nsDiskCacheBinding.cpp
netwerk/dns/nsHostResolver.cpp
parser/htmlparser/nsHTMLEntities.cpp
rdf/base/nsInMemoryDataSource.cpp
rdf/base/nsRDFService.cpp
security/manager/ssl/nsSecureBrowserUIImpl.cpp
uriloader/base/nsDocLoader.cpp
xpcom/base/nsCycleCollector.cpp
xpcom/ds/nsPersistentProperties.cpp
xpcom/ds/nsStaticNameTable.cpp
xpcom/glue/nsTHashtable.h
xpcom/glue/pldhash.cpp
xpcom/glue/pldhash.h
xpcom/tests/gtest/TestPLDHash.cpp
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -4117,19 +4117,18 @@ void
 nsContentUtils::TraverseListenerManager(nsINode *aNode,
                                         nsCycleCollectionTraversalCallback &cb)
 {
   if (!sEventListenerManagersHash) {
     // We're already shut down, just return.
     return;
   }
 
-  EventListenerManagerMapEntry *entry =
-    static_cast<EventListenerManagerMapEntry *>
-               (PL_DHashTableSearch(sEventListenerManagersHash, aNode));
+  auto entry = static_cast<EventListenerManagerMapEntry*>
+                          (sEventListenerManagersHash->Search(aNode));
   if (entry) {
     CycleCollectionNoteChild(cb, entry->mListenerManager.get(),
                              "[via hash] mListenerManager");
   }
 }
 
 EventListenerManager*
 nsContentUtils::GetListenerManagerForNode(nsINode *aNode)
@@ -4167,34 +4166,32 @@ nsContentUtils::GetExistingListenerManag
 
   if (!sEventListenerManagersHash) {
     // We're already shut down, don't bother creating an event listener
     // manager.
 
     return nullptr;
   }
 
-  EventListenerManagerMapEntry *entry =
-    static_cast<EventListenerManagerMapEntry *>
-               (PL_DHashTableSearch(sEventListenerManagersHash, aNode));
+  auto entry = static_cast<EventListenerManagerMapEntry*>
+                          (sEventListenerManagersHash->Search(aNode));
   if (entry) {
     return entry->mListenerManager;
   }
 
   return nullptr;
 }
 
 /* static */
 void
 nsContentUtils::RemoveListenerManager(nsINode *aNode)
 {
   if (sEventListenerManagersHash) {
-    EventListenerManagerMapEntry *entry =
-      static_cast<EventListenerManagerMapEntry *>
-                 (PL_DHashTableSearch(sEventListenerManagersHash, aNode));
+    auto entry = static_cast<EventListenerManagerMapEntry*>
+                            (sEventListenerManagersHash->Search(aNode));
     if (entry) {
       nsRefPtr<EventListenerManager> listenerManager;
       listenerManager.swap(entry->mListenerManager);
       // Remove the entry and *then* do operations that could cause further
       // modification of sEventListenerManagersHash.  See bug 334177.
       PL_DHashTableRawRemove(sEventListenerManagersHash, entry);
       if (listenerManager) {
         listenerManager->Disconnect();
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -3989,19 +3989,18 @@ nsDocument::SetSubDocumentFor(Element* a
 
   return NS_OK;
 }
 
 nsIDocument*
 nsDocument::GetSubDocumentFor(nsIContent *aContent) const
 {
   if (mSubDocuments && aContent->IsElement()) {
-    SubDocMapEntry *entry =
-      static_cast<SubDocMapEntry*>
-                 (PL_DHashTableSearch(mSubDocuments, aContent->AsElement()));
+    auto entry = static_cast<SubDocMapEntry*>
+                            (mSubDocuments->Search(aContent->AsElement()));
 
     if (entry) {
       return entry->mSubDocument;
     }
   }
 
   return nullptr;
 }
--- a/dom/base/nsPropertyTable.cpp
+++ b/dom/base/nsPropertyTable.cpp
@@ -88,19 +88,18 @@ nsPropertyTable::DeleteAllPropertiesFor(
 
 nsresult
 nsPropertyTable::TransferOrDeleteAllPropertiesFor(nsPropertyOwner aObject,
                                                   nsPropertyTable *aOtherTable)
 {
   nsresult rv = NS_OK;
   for (PropertyList* prop = mPropertyList; prop; prop = prop->mNext) {
     if (prop->mTransfer) {
-      PropertyListMapEntry *entry =
-          static_cast<PropertyListMapEntry*>
-                     (PL_DHashTableSearch(&prop->mObjectValueMap, aObject));
+      auto entry = static_cast<PropertyListMapEntry*>
+                              (prop->mObjectValueMap.Search(aObject));
       if (entry) {
         rv = aOtherTable->SetProperty(aObject, prop->mName,
                                       entry->value, prop->mDtorFunc,
                                       prop->mDtorData, prop->mTransfer);
         if (NS_FAILED(rv)) {
           DeleteAllPropertiesFor(aObject);
           aOtherTable->DeleteAllPropertiesFor(aObject);
 
@@ -119,18 +118,18 @@ nsPropertyTable::TransferOrDeleteAllProp
 }
 
 void
 nsPropertyTable::Enumerate(nsPropertyOwner aObject,
                            NSPropertyFunc aCallback, void *aData)
 {
   PropertyList* prop;
   for (prop = mPropertyList; prop; prop = prop->mNext) {
-    PropertyListMapEntry *entry = static_cast<PropertyListMapEntry*>
-      (PL_DHashTableSearch(&prop->mObjectValueMap, aObject));
+    auto entry = static_cast<PropertyListMapEntry*>
+                            (prop->mObjectValueMap.Search(aObject));
     if (entry) {
       aCallback(const_cast<void*>(aObject.get()), prop->mName, entry->value,
                 aData);
     }
   }
 }
 
 void
@@ -152,19 +151,18 @@ nsPropertyTable::GetPropertyInternal(nsP
                                      nsresult   *aResult)
 {
   NS_PRECONDITION(aPropertyName && aObject, "unexpected null param");
   nsresult rv = NS_PROPTABLE_PROP_NOT_THERE;
   void *propValue = nullptr;
 
   PropertyList* propertyList = GetPropertyListFor(aPropertyName);
   if (propertyList) {
-    PropertyListMapEntry *entry =
-        static_cast<PropertyListMapEntry*>
-                   (PL_DHashTableSearch(&propertyList->mObjectValueMap, aObject));
+    auto entry = static_cast<PropertyListMapEntry*>
+                            (propertyList->mObjectValueMap.Search(aObject));
     if (entry) {
       propValue = entry->value;
       if (aRemove) {
         // don't call propertyList->mDtorFunc.  That's the caller's job now.
         propertyList->mObjectValueMap.RemoveEntry(entry);
       }
       rv = NS_OK;
     }
@@ -289,19 +287,18 @@ nsPropertyTable::PropertyList::Destroy()
       mDtorFunc(const_cast<void*>(entry->key), mName, entry->value, mDtorData);
     }
   }
 }
 
 bool
 nsPropertyTable::PropertyList::DeletePropertyFor(nsPropertyOwner aObject)
 {
-  PropertyListMapEntry *entry =
-      static_cast<PropertyListMapEntry*>
-                 (PL_DHashTableSearch(&mObjectValueMap, aObject));
+  auto entry =
+    static_cast<PropertyListMapEntry*>(mObjectValueMap.Search(aObject));
   if (!entry)
     return false;
 
   void* value = entry->value;
   mObjectValueMap.RemoveEntry(entry);
 
   if (mDtorFunc)
     mDtorFunc(const_cast<void*>(aObject.get()), mName, value, mDtorData);
--- a/dom/base/nsScriptNameSpaceManager.cpp
+++ b/dom/base/nsScriptNameSpaceManager.cpp
@@ -154,20 +154,18 @@ nsScriptNameSpaceManager::RemoveFromHash
 }
 
 nsGlobalNameStruct*
 nsScriptNameSpaceManager::GetConstructorProto(const nsGlobalNameStruct* aStruct)
 {
   NS_ASSERTION(aStruct->mType == nsGlobalNameStruct::eTypeExternalConstructorAlias,
                "This function only works on constructor aliases!");
   if (!aStruct->mAlias->mProto) {
-    GlobalNameMapEntry *proto =
-      static_cast<GlobalNameMapEntry *>
-                 (PL_DHashTableSearch(&mGlobalNames,
-                                      &aStruct->mAlias->mProtoName));
+    auto proto = static_cast<GlobalNameMapEntry*>
+                            (mGlobalNames.Search(&aStruct->mAlias->mProtoName));
     if (proto) {
       aStruct->mAlias->mProto = &proto->mGlobalName;
     }
   }
   return aStruct->mAlias->mProto;
 }
 
 nsresult
@@ -339,19 +337,17 @@ nsScriptNameSpaceManager::Init()
 
   return NS_OK;
 }
 
 nsGlobalNameStruct*
 nsScriptNameSpaceManager::LookupNameInternal(const nsAString& aName,
                                              const char16_t **aClassName)
 {
-  GlobalNameMapEntry *entry =
-    static_cast<GlobalNameMapEntry *>
-               (PL_DHashTableSearch(&mGlobalNames, &aName));
+  auto entry = static_cast<GlobalNameMapEntry*>(mGlobalNames.Search(&aName));
 
   if (entry) {
     if (aClassName) {
       *aClassName = entry->mKey.get();
     }
     return &entry->mGlobalName;
   }
 
@@ -359,19 +355,17 @@ nsScriptNameSpaceManager::LookupNameInte
     *aClassName = nullptr;
   }
   return nullptr;
 }
 
 const nsGlobalNameStruct*
 nsScriptNameSpaceManager::LookupNavigatorName(const nsAString& aName)
 {
-  GlobalNameMapEntry *entry =
-    static_cast<GlobalNameMapEntry *>
-               (PL_DHashTableSearch(&mNavigatorNames, &aName));
+  auto entry = static_cast<GlobalNameMapEntry*>(mNavigatorNames.Search(&aName));
 
   return entry ? &entry->mGlobalName : nullptr;
 }
 
 nsresult
 nsScriptNameSpaceManager::RegisterClassName(const char *aClassName,
                                             int32_t aDOMClassInfoID,
                                             bool aPrivileged,
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -1774,21 +1774,21 @@ NPObjWrapper_ObjectMoved(JSObject *obj, 
     return;
   }
 
   NPObject *npobj = (NPObject *)::JS_GetPrivate(obj);
   if (!npobj) {
     return;
   }
 
-  // Calling PL_DHashTableSearch() will not result in GC.
+  // Calling PLDHashTable::Search() will not result in GC.
   JS::AutoSuppressGCAnalysis nogc;
 
-  NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
-    (PL_DHashTableSearch(sNPObjWrappers, npobj));
+  auto entry =
+    static_cast<NPObjWrapperHashEntry*>(sNPObjWrappers->Search(npobj));
   MOZ_ASSERT(entry && entry->mJSObj);
   MOZ_ASSERT(entry->mJSObj == old);
   entry->mJSObj = obj;
 }
 
 static bool
 NPObjWrapper_Call(JSContext *cx, unsigned argc, JS::Value *vp)
 {
@@ -1830,18 +1830,18 @@ nsNPObjWrapper::OnDestroy(NPObject *npob
   }
 
   if (!sNPObjWrappers) {
     // No hash yet (or any more), no used wrappers available.
 
     return;
   }
 
-  NPObjWrapperHashEntry *entry = static_cast<NPObjWrapperHashEntry *>
-    (PL_DHashTableSearch(sNPObjWrappers, npobj));
+  auto entry =
+    static_cast<NPObjWrapperHashEntry*>(sNPObjWrappers->Search(npobj));
 
   if (entry && entry->mJSObj) {
     // Found a live NPObject wrapper, null out its JSObjects' private
     // data.
 
     ::JS_SetPrivate(entry->mJSObj, nullptr);
 
     // Remove the npobj from the hash now that it went away.
@@ -1914,17 +1914,17 @@ nsNPObjWrapper::GetNewOrUsed(NPP npp, JS
   // No existing JSObject, create one.
 
   JS::Rooted<JSObject*> obj(cx, ::JS_NewObject(cx, js::Jsvalify(&sNPObjectJSWrapperClass)));
 
   if (generation != sNPObjWrappers->Generation()) {
       // Reload entry if the JS_NewObject call caused a GC and reallocated
       // the table (see bug 445229). This is guaranteed to succeed.
 
-      NS_ASSERTION(PL_DHashTableSearch(sNPObjWrappers, npobj),
+      NS_ASSERTION(sNPObjWrappers->Search(npobj),
                    "Hashtable didn't find what we just added?");
   }
 
   if (!obj) {
     // OOM? Remove the stale entry from the hash.
 
     PL_DHashTableRawRemove(sNPObjWrappers, entry);
 
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -758,20 +758,18 @@ XULDocument::AddBroadcastListenerFor(Ele
         ClearBroadcasterMapEntry,
         nullptr
     };
 
     if (! mBroadcasterMap) {
         mBroadcasterMap = new PLDHashTable(&gOps, sizeof(BroadcasterMapEntry));
     }
 
-    BroadcasterMapEntry* entry =
-        static_cast<BroadcasterMapEntry*>
-                   (PL_DHashTableSearch(mBroadcasterMap, &aBroadcaster));
-
+    auto entry = static_cast<BroadcasterMapEntry*>
+                            (mBroadcasterMap->Search(&aBroadcaster));
     if (!entry) {
         entry = static_cast<BroadcasterMapEntry*>
             (PL_DHashTableAdd(mBroadcasterMap, &aBroadcaster, fallible));
 
         if (! entry) {
             aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
             return;
         }
@@ -819,20 +817,18 @@ XULDocument::RemoveBroadcastListenerFor(
                                         Element& aListener,
                                         const nsAString& aAttr)
 {
     // If we haven't added any broadcast listeners, then there sure
     // aren't any to remove.
     if (! mBroadcasterMap)
         return;
 
-    BroadcasterMapEntry* entry =
-        static_cast<BroadcasterMapEntry*>
-                   (PL_DHashTableSearch(mBroadcasterMap, &aBroadcaster));
-
+    auto entry = static_cast<BroadcasterMapEntry*>
+                            (mBroadcasterMap->Search(&aBroadcaster));
     if (entry) {
         nsCOMPtr<nsIAtom> attr = do_GetAtom(aAttr);
         for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
             BroadcastListener* bl = entry->mListeners[i];
             nsCOMPtr<Element> blListener = do_QueryReferent(bl->mListener);
 
             if (blListener == &aListener && bl->mAttribute == attr) {
                 entry->mListeners.RemoveElementAt(i);
@@ -939,19 +935,18 @@ XULDocument::AttributeChanged(nsIDocumen
     // See if we need to update our ref map.
     if (aAttribute == nsGkAtoms::ref) {
         AddElementToRefMap(aElement);
     }
 
     // Synchronize broadcast listeners
     if (mBroadcasterMap &&
         CanBroadcast(aNameSpaceID, aAttribute)) {
-        BroadcasterMapEntry* entry =
-            static_cast<BroadcasterMapEntry*>
-                       (PL_DHashTableSearch(mBroadcasterMap, aElement));
+        auto entry = static_cast<BroadcasterMapEntry*>
+                                (mBroadcasterMap->Search(aElement));
 
         if (entry) {
             // We've got listeners: push the value.
             nsAutoString value;
             bool attrSet = aElement->GetAttr(kNameSpaceID_None, aAttribute, value);
 
             for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
                 BroadcastListener* bl = entry->mListeners[i];
@@ -4101,18 +4096,18 @@ XULDocument::BroadcastAttributeChangeFro
     nsresult rv = NS_OK;
 
     if (!mBroadcasterMap || !CanBroadcast(aNameSpaceID, aAttribute))
         return rv;
 
     if (!aNode->IsElement())
         return rv;
 
-    BroadcasterMapEntry* entry = static_cast<BroadcasterMapEntry*>
-        (PL_DHashTableSearch(mBroadcasterMap, aNode->AsElement()));
+    auto entry = static_cast<BroadcasterMapEntry*>
+                            (mBroadcasterMap->Search(aNode->AsElement()));
     if (!entry)
         return rv;
 
     // We've got listeners: push the value.
     for (size_t i = entry->mListeners.Length() - 1; i != (size_t)-1; --i) {
         BroadcastListener* bl = entry->mListeners[i];
 
         if ((bl->mAttribute != aAttribute) &&
--- a/dom/xul/templates/nsContentSupportMap.h
+++ b/dom/xul/templates/nsContentSupportMap.h
@@ -33,17 +33,17 @@ public:
         Entry* entry = static_cast<Entry*>(hdr);
         NS_ASSERTION(entry->mMatch == nullptr, "over-writing entry");
         entry->mContent = aElement;
         entry->mMatch   = aMatch;
         return NS_OK;
     }
 
     bool Get(nsIContent* aElement, nsTemplateMatch** aMatch) {
-        PLDHashEntryHdr* hdr = PL_DHashTableSearch(&mMap, aElement);
+        PLDHashEntryHdr* hdr = mMap.Search(aElement);
         if (!hdr)
             return false;
 
         Entry* entry = static_cast<Entry*>(hdr);
         *aMatch = entry->mMatch;
         return true;
     }
 
--- a/dom/xul/templates/nsTemplateMap.h
+++ b/dom/xul/templates/nsTemplateMap.h
@@ -20,18 +20,17 @@ protected:
 
 public:
     nsTemplateMap() : mTable(PL_DHashGetStubOps(), sizeof(Entry)) { }
 
     ~nsTemplateMap() { }
 
     void
     Put(nsIContent* aContent, nsIContent* aTemplate) {
-        NS_ASSERTION(!PL_DHashTableSearch(&mTable, aContent),
-                     "aContent already in map");
+        NS_ASSERTION(!mTable.Search(aContent), "aContent already in map");
 
         Entry* entry = static_cast<Entry*>
             (PL_DHashTableAdd(&mTable, aContent, fallible));
 
         if (entry) {
             entry->mContent = aContent;
             entry->mTemplate = aTemplate;
         }
@@ -46,19 +45,17 @@ public:
              child = child->GetNextSibling()) {
             Remove(child);
         }
     }
 
 
     void
     GetTemplateFor(nsIContent* aContent, nsIContent** aResult) {
-        Entry* entry =
-            static_cast<Entry*>(PL_DHashTableSearch(&mTable, aContent));
-
+        auto entry = static_cast<Entry*>(mTable.Search(aContent));
         if (entry)
             NS_IF_ADDREF(*aResult = entry->mTemplate);
         else
             *aResult = nullptr;
     }
 
     void
     Clear() { mTable.Clear(); }
--- a/embedding/components/commandhandler/nsCommandParams.cpp
+++ b/embedding/components/commandhandler/nsCommandParams.cpp
@@ -202,24 +202,23 @@ nsCommandParams::RemoveValue(const char*
 {
   PL_DHashTableRemove(&mValuesHash, (void*)aName);
   return NS_OK;
 }
 
 nsCommandParams::HashEntry*
 nsCommandParams::GetNamedEntry(const char* aName)
 {
-  return (HashEntry*)PL_DHashTableSearch(&mValuesHash, (void*)aName);
+  return static_cast<HashEntry*>(mValuesHash.Search((void*)aName));
 }
 
 nsCommandParams::HashEntry*
 nsCommandParams::GetOrMakeEntry(const char* aName, uint8_t aEntryType)
 {
-  HashEntry* foundEntry =
-    (HashEntry*)PL_DHashTableSearch(&mValuesHash, (void*)aName);
+  auto foundEntry = static_cast<HashEntry*>(mValuesHash.Search((void*)aName));
   if (foundEntry) { // reuse existing entry
     foundEntry->Reset(aEntryType);
     return foundEntry;
   }
 
   foundEntry = static_cast<HashEntry*>(
     PL_DHashTableAdd(&mValuesHash, (void*)aName, fallible));
   if (!foundEntry) {
--- a/gfx/thebes/gfxFT2FontList.cpp
+++ b/gfx/thebes/gfxFT2FontList.cpp
@@ -719,19 +719,17 @@ public:
         // Should we use free() or delete[] here? See bug 684700.
         free(buf);
     }
 
     virtual void
     GetInfoForFile(const nsCString& aFileName, nsCString& aFaceList,
                    uint32_t *aTimestamp, uint32_t *aFilesize)
     {
-        FNCMapEntry *entry =
-            static_cast<FNCMapEntry*>(PL_DHashTableSearch(&mMap,
-                                                          aFileName.get()));
+        auto entry = static_cast<FNCMapEntry*>(mMap.Search(aFileName.get()));
         if (entry) {
             *aTimestamp = entry->mTimestamp;
             *aFilesize = entry->mFilesize;
             aFaceList.Assign(entry->mFaces);
             // this entry does correspond to an existing file
             // (although it might not be up-to-date, in which case
             // it will get overwritten via CacheFileInfo)
             entry->mFileExists = true;
--- a/js/xpconnect/src/XPCMaps.h
+++ b/js/xpconnect/src/XPCMaps.h
@@ -109,17 +109,17 @@ public:
         XPCWrappedNative* value;
     };
 
     static Native2WrappedNativeMap* newMap(int length);
 
     inline XPCWrappedNative* Find(nsISupports* Obj)
     {
         NS_PRECONDITION(Obj,"bad param");
-        Entry* entry = (Entry*) PL_DHashTableSearch(mTable, Obj);
+        auto entry = static_cast<Entry*>(mTable->Search(Obj));
         return entry ? entry->value : nullptr;
     }
 
     inline XPCWrappedNative* Add(XPCWrappedNative* wrapper)
     {
         NS_PRECONDITION(wrapper,"bad param");
         nsISupports* obj = wrapper->GetIdentityObject();
         MOZ_ASSERT(!Find(obj), "wrapper already in new scope!");
@@ -173,17 +173,17 @@ public:
 
         static const struct PLDHashTableOps sOps;
     };
 
     static IID2WrappedJSClassMap* newMap(int length);
 
     inline nsXPCWrappedJSClass* Find(REFNSIID iid)
     {
-        Entry* entry = (Entry*) PL_DHashTableSearch(mTable, &iid);
+        auto entry = static_cast<Entry*>(mTable->Search(&iid));
         return entry ? entry->value : nullptr;
     }
 
     inline nsXPCWrappedJSClass* Add(nsXPCWrappedJSClass* clazz)
     {
         NS_PRECONDITION(clazz,"bad param");
         const nsIID* iid = &clazz->GetIID();
         Entry* entry = static_cast<Entry*>
@@ -227,17 +227,17 @@ public:
 
         static const struct PLDHashTableOps sOps;
     };
 
     static IID2NativeInterfaceMap* newMap(int length);
 
     inline XPCNativeInterface* Find(REFNSIID iid)
     {
-        Entry* entry = (Entry*) PL_DHashTableSearch(mTable, &iid);
+        auto entry = static_cast<Entry*>(mTable->Search(&iid));
         return entry ? entry->value : nullptr;
     }
 
     inline XPCNativeInterface* Add(XPCNativeInterface* iface)
     {
         NS_PRECONDITION(iface,"bad param");
         const nsIID* iid = iface->GetIID();
         Entry* entry = static_cast<Entry*>
@@ -282,17 +282,17 @@ public:
         nsIClassInfo* key;
         XPCNativeSet* value;
     };
 
     static ClassInfo2NativeSetMap* newMap(int length);
 
     inline XPCNativeSet* Find(nsIClassInfo* info)
     {
-        Entry* entry = (Entry*) PL_DHashTableSearch(mTable, info);
+        auto entry = static_cast<Entry*>(mTable->Search(info));
         return entry ? entry->value : nullptr;
     }
 
     inline XPCNativeSet* Add(nsIClassInfo* info, XPCNativeSet* set)
     {
         NS_PRECONDITION(info,"bad param");
         Entry* entry = static_cast<Entry*>
             (PL_DHashTableAdd(mTable, info, mozilla::fallible));
@@ -339,17 +339,17 @@ public:
         nsIClassInfo*          key;
         XPCWrappedNativeProto* value;
     };
 
     static ClassInfo2WrappedNativeProtoMap* newMap(int length);
 
     inline XPCWrappedNativeProto* Find(nsIClassInfo* info)
     {
-        Entry* entry = (Entry*) PL_DHashTableSearch(mTable, info);
+        auto entry = static_cast<Entry*>(mTable->Search(info));
         return entry ? entry->value : nullptr;
     }
 
     inline XPCWrappedNativeProto* Add(nsIClassInfo* info, XPCWrappedNativeProto* proto)
     {
         NS_PRECONDITION(info,"bad param");
         Entry* entry = static_cast<Entry*>
             (PL_DHashTableAdd(mTable, info, mozilla::fallible));
@@ -400,17 +400,17 @@ public:
 
         static const struct PLDHashTableOps sOps;
     };
 
     static NativeSetMap* newMap(int length);
 
     inline XPCNativeSet* Find(XPCNativeSetKey* key)
     {
-        Entry* entry = (Entry*) PL_DHashTableSearch(mTable, key);
+        auto entry = static_cast<Entry*>(mTable->Search(key));
         return entry ? entry->key_value : nullptr;
     }
 
     inline XPCNativeSet* Add(const XPCNativeSetKey* key, XPCNativeSet* set)
     {
         NS_PRECONDITION(key,"bad param");
         NS_PRECONDITION(set,"bad param");
         Entry* entry = static_cast<Entry*>
@@ -473,17 +473,17 @@ public:
 
         static const struct PLDHashTableOps sOps;
     };
 
     static IID2ThisTranslatorMap* newMap(int length);
 
     inline nsIXPCFunctionThisTranslator* Find(REFNSIID iid)
     {
-        Entry* entry = (Entry*) PL_DHashTableSearch(mTable, &iid);
+        auto entry = static_cast<Entry*>(mTable->Search(&iid));
         return entry ? entry->value : nullptr;
     }
 
     inline nsIXPCFunctionThisTranslator* Add(REFNSIID iid,
                                              nsIXPCFunctionThisTranslator* obj)
     {
         Entry* entry = static_cast<Entry*>
             (PL_DHashTableAdd(mTable, &iid, mozilla::fallible));
--- a/layout/base/nsFrameManager.cpp
+++ b/layout/base/nsFrameManager.cpp
@@ -159,19 +159,18 @@ nsFrameManager::Destroy()
 //----------------------------------------------------------------------
 
 // Placeholder frame functions
 nsPlaceholderFrame*
 nsFrameManager::GetPlaceholderFrameFor(const nsIFrame* aFrame)
 {
   NS_PRECONDITION(aFrame, "null param unexpected");
 
-  PlaceholderMapEntry *entry = static_cast<PlaceholderMapEntry*>
-                                          (PL_DHashTableSearch(const_cast<PLDHashTable*>(&mPlaceholderMap),
-                              aFrame));
+  auto entry = static_cast<PlaceholderMapEntry*>
+    (const_cast<PLDHashTable*>(&mPlaceholderMap)->Search(aFrame));
   if (entry) {
     return entry->placeholderFrame;
   }
 
   return nullptr;
 }
 
 nsresult
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -667,43 +667,41 @@ void RuleHash::EnumerateAllRules(Element
   RULE_HASH_STAT_INCREMENT(mElementsMatched);
 
   if (mUniversalRules.Length() != 0) { // universal rules
     mEnumList[valueCount++] = ToEnumData(mUniversalRules);
     RULE_HASH_STAT_INCREMENT_LIST_COUNT(mUniversalRules, mElementUniversalCalls);
   }
   // universal rules within the namespace
   if (kNameSpaceID_Unknown != nameSpace && mNameSpaceTable.EntryCount() > 0) {
-    RuleHashTableEntry *entry = static_cast<RuleHashTableEntry*>
-                                           (PL_DHashTableSearch(&mNameSpaceTable, NS_INT32_TO_PTR(nameSpace)));
+    auto entry = static_cast<RuleHashTableEntry*>
+      (mNameSpaceTable.Search(NS_INT32_TO_PTR(nameSpace)));
     if (entry) {
       mEnumList[valueCount++] = ToEnumData(entry->mRules);
       RULE_HASH_STAT_INCREMENT_LIST_COUNT(entry->mRules, mElementNameSpaceCalls);
     }
   }
   if (mTagTable.EntryCount() > 0) {
-    RuleHashTableEntry *entry = static_cast<RuleHashTableEntry*>
-                                           (PL_DHashTableSearch(&mTagTable, tag));
+    auto entry = static_cast<RuleHashTableEntry*>(mTagTable.Search(tag));
     if (entry) {
       mEnumList[valueCount++] = ToEnumData(entry->mRules);
       RULE_HASH_STAT_INCREMENT_LIST_COUNT(entry->mRules, mElementTagCalls);
     }
   }
   if (id && mIdTable.EntryCount() > 0) {
-    RuleHashTableEntry *entry = static_cast<RuleHashTableEntry*>
-                                           (PL_DHashTableSearch(&mIdTable, id));
+    auto entry = static_cast<RuleHashTableEntry*>(mIdTable.Search(id));
     if (entry) {
       mEnumList[valueCount++] = ToEnumData(entry->mRules);
       RULE_HASH_STAT_INCREMENT_LIST_COUNT(entry->mRules, mElementIdCalls);
     }
   }
   if (mClassTable.EntryCount() > 0) {
     for (int32_t index = 0; index < classCount; ++index) {
-      RuleHashTableEntry *entry = static_cast<RuleHashTableEntry*>
-                                             (PL_DHashTableSearch(&mClassTable, classList->AtomAt(index)));
+      auto entry = static_cast<RuleHashTableEntry*>
+        (mClassTable.Search(classList->AtomAt(index)));
       if (entry) {
         mEnumList[valueCount++] = ToEnumData(entry->mRules);
         RULE_HASH_STAT_INCREMENT_LIST_COUNT(entry->mRules, mElementClassCalls);
       }
     }
   }
   NS_ASSERTION(valueCount <= testCount, "values exceeded list size");
 
@@ -2639,18 +2637,18 @@ nsCSSRuleProcessor::RulesMatching(Pseudo
 }
 
 /* virtual */ void
 nsCSSRuleProcessor::RulesMatching(AnonBoxRuleProcessorData* aData)
 {
   RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
 
   if (cascade && cascade->mAnonBoxRules.EntryCount()) {
-    RuleHashTagTableEntry* entry = static_cast<RuleHashTagTableEntry*>
-      (PL_DHashTableSearch(&cascade->mAnonBoxRules, aData->mPseudoTag));
+    auto entry = static_cast<RuleHashTagTableEntry*>
+                            (cascade->mAnonBoxRules.Search(aData->mPseudoTag));
     if (entry) {
       nsTArray<RuleValue>& rules = entry->mRules;
       for (RuleValue *value = rules.Elements(), *end = value + rules.Length();
            value != end; ++value) {
         value->mRule->RuleMatched();
         aData->mRuleWalker->Forward(value->mRule);
       }
     }
@@ -2659,18 +2657,18 @@ nsCSSRuleProcessor::RulesMatching(AnonBo
 
 #ifdef MOZ_XUL
 /* virtual */ void
 nsCSSRuleProcessor::RulesMatching(XULTreeRuleProcessorData* aData)
 {
   RuleCascadeData* cascade = GetRuleCascade(aData->mPresContext);
 
   if (cascade && cascade->mXULTreeRules.EntryCount()) {
-    RuleHashTagTableEntry* entry = static_cast<RuleHashTagTableEntry*>
-      (PL_DHashTableSearch(&cascade->mXULTreeRules, aData->mPseudoTag));
+    auto entry = static_cast<RuleHashTagTableEntry*>
+                            (cascade->mXULTreeRules.Search(aData->mPseudoTag));
     if (entry) {
       NodeMatchContext nodeContext(EventStates(),
                                    nsCSSRuleProcessor::IsLink(aData->mElement));
       nsTArray<RuleValue>& rules = entry->mRules;
       for (RuleValue *value = rules.Elements(), *end = value + rules.Length();
            value != end; ++value) {
         if (aData->mComparator->PseudoMatches(value->mSelector)) {
           ContentEnumFunc(*value, value->mSelector->mNext, aData, nodeContext,
@@ -2979,19 +2977,18 @@ nsCSSRuleProcessor::HasAttributeDependen
   // whether we have selectors relevant to aData->mAttribute that we
   // match.  If this is the before change notification, that will catch
   // rules we might stop matching; if the after change notification, the
   // ones we might have started matching.
   if (cascade) {
     if (aData->mAttribute == nsGkAtoms::id) {
       nsIAtom* id = aData->mElement->GetID();
       if (id) {
-        AtomSelectorEntry *entry =
-          static_cast<AtomSelectorEntry*>
-                     (PL_DHashTableSearch(&cascade->mIdSelectors, id));
+        auto entry =
+          static_cast<AtomSelectorEntry*>(cascade->mIdSelectors.Search(id));
         if (entry) {
           EnumerateSelectors(entry->mSelectors, &data);
         }
       }
 
       EnumerateSelectors(cascade->mPossiblyNegatedIDSelectors, &data);
     }
 
@@ -3016,35 +3013,33 @@ nsCSSRuleProcessor::HasAttributeDependen
             int32_t otherClassesCount = otherClasses->GetAtomCount();
             for (int32_t i = 0; i < otherClassesCount; ++i) {
               otherClassesTable.PutEntry(otherClasses->AtomAt(i));
             }
           }
           for (int32_t i = 0; i < atomCount; ++i) {
             nsIAtom* curClass = elementClasses->AtomAt(i);
             if (!otherClassesTable.Contains(curClass)) {
-              AtomSelectorEntry *entry =
+              auto entry =
                 static_cast<AtomSelectorEntry*>
-                           (PL_DHashTableSearch(&cascade->mClassSelectors,
-                                                curClass));
+                           (cascade->mClassSelectors.Search(curClass));
               if (entry) {
                 EnumerateSelectors(entry->mSelectors, &data);
               }
             }
           }
         }
       }
 
       EnumerateSelectors(cascade->mPossiblyNegatedClassSelectors, &data);
     }
 
-    AtomSelectorEntry *entry =
+    auto entry =
       static_cast<AtomSelectorEntry*>
-                 (PL_DHashTableSearch(&cascade->mAttributeSelectors,
-                                      aData->mAttribute));
+                 (cascade->mAttributeSelectors.Search(aData->mAttribute));
     if (entry) {
       EnumerateSelectors(entry->mSelectors, &data);
     }
   }
 
   return data.change;
 }
 
--- a/modules/libpref/prefapi.cpp
+++ b/modules/libpref/prefapi.cpp
@@ -693,17 +693,17 @@ static void pref_SetValue(PrefValue* exi
 }
 
 PrefHashEntry* pref_HashTableLookup(const char *key)
 {
 #ifndef MOZ_B2G
     MOZ_ASSERT(NS_IsMainThread());
 #endif
 
-    return static_cast<PrefHashEntry*>(PL_DHashTableSearch(gHashTable, key));
+    return static_cast<PrefHashEntry*>(gHashTable->Search(key));
 }
 
 nsresult pref_HashPref(const char *key, PrefValue value, PrefType type, uint32_t flags)
 {
 #ifndef MOZ_B2G
     MOZ_ASSERT(NS_IsMainThread());
 #endif
 
--- a/netwerk/base/nsLoadGroup.cpp
+++ b/netwerk/base/nsLoadGroup.cpp
@@ -250,17 +250,17 @@ nsLoadGroup::Cancel(nsresult status)
 
     nsresult firstError = NS_OK;
 
     while (count > 0) {
         nsIRequest* request = requests.ElementAt(--count);
 
         NS_ASSERTION(request, "NULL request found in list.");
 
-        if (!PL_DHashTableSearch(&mRequests, request)) {
+        if (!mRequests.Search(request)) {
             // |request| was removed already
             NS_RELEASE(request);
             continue;
         }
 
         if (MOZ_LOG_TEST(gLoadGroupLog, LogLevel::Debug)) {
             nsAutoCString nameStr;
             request->GetName(nameStr);
@@ -458,17 +458,17 @@ nsLoadGroup::AddRequest(nsIRequest *requ
 
     if (MOZ_LOG_TEST(gLoadGroupLog, LogLevel::Debug)) {
         nsAutoCString nameStr;
         request->GetName(nameStr);
         LOG(("LOADGROUP [%x]: Adding request %x %s (count=%d).\n",
              this, request, nameStr.get(), mRequests.EntryCount()));
     }
 
-    NS_ASSERTION(!PL_DHashTableSearch(&mRequests, request),
+    NS_ASSERTION(!mRequests.Search(request),
                  "Entry added to loadgroup twice, don't do that");
 
     //
     // Do not add the channel, if the loadgroup is being canceled...
     //
     if (mIsCanceling) {
         LOG(("LOADGROUP [%x]: AddChannel() ABORTED because LoadGroup is"
              " being canceled!!\n", this));
@@ -566,19 +566,17 @@ nsLoadGroup::RemoveRequest(nsIRequest *r
 
     nsCOMPtr<nsIRequest> kungFuDeathGrip(request);
 
     //
     // Remove the request from the group.  If this fails, it means that
     // the request was *not* in the group so do not update the foreground
     // count or it will get messed up...
     //
-    RequestMapEntry *entry =
-        static_cast<RequestMapEntry *>
-                   (PL_DHashTableSearch(&mRequests, request));
+    auto entry = static_cast<RequestMapEntry*>(mRequests.Search(request));
 
     if (!entry) {
         LOG(("LOADGROUP [%x]: Unable to remove request %x. Not in group!\n",
             this, request));
 
         return NS_ERROR_FAILURE;
     }
 
--- a/netwerk/cache/nsCacheEntry.cpp
+++ b/netwerk/cache/nsCacheEntry.cpp
@@ -415,17 +415,17 @@ nsCacheEntryHashTable::Shutdown()
 
 
 nsCacheEntry *
 nsCacheEntryHashTable::GetEntry( const nsCString * key)
 {
     NS_ASSERTION(initialized, "nsCacheEntryHashTable not initialized");
     if (!initialized)  return nullptr;
 
-    PLDHashEntryHdr *hashEntry = PL_DHashTableSearch(&table, key);
+    PLDHashEntryHdr *hashEntry = table.Search(key);
     return hashEntry ? ((nsCacheEntryHashTableEntry *)hashEntry)->cacheEntry
                      : nullptr;
 }
 
 
 nsresult
 nsCacheEntryHashTable::AddEntry( nsCacheEntry *cacheEntry)
 {
--- a/netwerk/cache/nsDiskCacheBinding.cpp
+++ b/netwerk/cache/nsDiskCacheBinding.cpp
@@ -192,20 +192,18 @@ nsDiskCacheBindery::CreateBinding(nsCach
 /**
  *  FindActiveEntry :  to find active colliding entry so we can doom it
  */
 nsDiskCacheBinding *
 nsDiskCacheBindery::FindActiveBinding(uint32_t  hashNumber)
 {
     NS_ASSERTION(initialized, "nsDiskCacheBindery not initialized");
     // find hash entry for key
-    HashTableEntry * hashEntry;
-    hashEntry =
-      (HashTableEntry *) PL_DHashTableSearch(&table,
-                                             (void*)(uintptr_t) hashNumber);
+    auto hashEntry = static_cast<HashTableEntry*>
+        (table.Search((void*)(uintptr_t)hashNumber));
     if (!hashEntry) return nullptr;
 
     // walk list looking for active entry
     NS_ASSERTION(hashEntry->mBinding, "hash entry left with no binding");
     nsDiskCacheBinding * binding = hashEntry->mBinding;
     while (binding->mCacheEntry->IsDoomed()) {
         binding = (nsDiskCacheBinding *)PR_NEXT_LINK(binding);
         if (binding == hashEntry->mBinding)  return nullptr;
@@ -289,21 +287,19 @@ nsDiskCacheBindery::AddBinding(nsDiskCac
  *  RemoveBinding :  remove binding from collision detection on deactivation
  */
 void
 nsDiskCacheBindery::RemoveBinding(nsDiskCacheBinding * binding)
 {
     NS_ASSERTION(initialized, "nsDiskCacheBindery not initialized");
     if (!initialized)   return;
     
-    HashTableEntry * hashEntry;
-    void           * key = (void *)(uintptr_t)binding->mRecord.HashNumber();
-
-    hashEntry = (HashTableEntry*) PL_DHashTableSearch(&table,
-                                                      (void*)(uintptr_t) key);
+    void* key = (void *)(uintptr_t)binding->mRecord.HashNumber();
+    auto hashEntry =
+        static_cast<HashTableEntry*>(table.Search((void*)(uintptr_t) key));
     if (!hashEntry) {
         NS_WARNING("### disk cache: binding not in hashtable!");
         return;
     }
     
     if (binding == hashEntry->mBinding) {
         if (PR_CLIST_IS_EMPTY(binding)) {
             // remove this hash entry
--- a/netwerk/dns/nsHostResolver.cpp
+++ b/netwerk/dns/nsHostResolver.cpp
@@ -833,18 +833,18 @@ nsHostResolver::ResolveHost(const char  
             // If this is an IPV4 or IPV6 specific request, check if there is
             // an AF_UNSPEC entry we can use. Otherwise, hit the resolver...
             else if (!he->rec->resolving) {
                 if (!(flags & RES_BYPASS_CACHE) &&
                     ((af == PR_AF_INET) || (af == PR_AF_INET6))) {
                     // First, search for an entry with AF_UNSPEC
                     const nsHostKey unspecKey = { host, flags, PR_AF_UNSPEC,
                                                   netInterface };
-                    nsHostDBEnt *unspecHe = static_cast<nsHostDBEnt *>
-                        (PL_DHashTableSearch(&mDB, &unspecKey));
+                    auto unspecHe =
+                        static_cast<nsHostDBEnt*>(mDB.Search(&unspecKey));
                     NS_ASSERTION(!unspecHe ||
                                  (unspecHe && unspecHe->rec),
                                 "Valid host entries should contain a record");
                     TimeStamp now = TimeStamp::NowLoRes();
                     if (unspecHe &&
                         unspecHe->rec->HasUsableResult(now, flags)) {
 
                         MOZ_ASSERT(unspecHe->rec->addr_info || unspecHe->rec->negative,
@@ -972,18 +972,17 @@ nsHostResolver::DetachCallback(const cha
                                nsResolveHostCallback *callback,
                                nsresult               status)
 {
     nsRefPtr<nsHostRecord> rec;
     {
         MutexAutoLock lock(mLock);
 
         nsHostKey key = { host, flags, af, netInterface };
-        nsHostDBEnt *he = static_cast<nsHostDBEnt *>
-                                     (PL_DHashTableSearch(&mDB, &key));
+        auto he = static_cast<nsHostDBEnt*>(mDB.Search(&key));
         if (he) {
             // walk list looking for |callback|... we cannot assume
             // that it will be there!
             PRCList *node = he->rec->callbacks.next;
             while (node != &he->rec->callbacks) {
                 if (static_cast<nsResolveHostCallback *>(node) == callback) {
                     PR_REMOVE_LINK(callback);
                     rec = he->rec;
@@ -1318,18 +1317,17 @@ nsHostResolver::CancelAsyncRequest(const
                                    nsIDNSListener        *aListener,
                                    nsresult               status)
 
 {
     MutexAutoLock lock(mLock);
 
     // Lookup the host record associated with host, flags & address family
     nsHostKey key = { host, flags, af, netInterface };
-    nsHostDBEnt *he = static_cast<nsHostDBEnt *>
-                      (PL_DHashTableSearch(&mDB, &key));
+    auto he = static_cast<nsHostDBEnt*>(mDB.Search(&key));
     if (he) {
         nsHostRecord* recPtr = nullptr;
         PRCList *node = he->rec->callbacks.next;
         // Remove the first nsDNSAsyncRequest callback which matches the
         // supplied listener object
         while (node != &he->rec->callbacks) {
             nsResolveHostCallback *callback
                 = static_cast<nsResolveHostCallback *>(node);
--- a/parser/htmlparser/nsHTMLEntities.cpp
+++ b/parser/htmlparser/nsHTMLEntities.cpp
@@ -142,19 +142,18 @@ nsHTMLEntities::EntityToUnicode(const ns
     //if we see it, strip if off for this test...
 
     if(';'==aEntity.Last()) {
       nsAutoCString temp(aEntity);
       temp.Truncate(aEntity.Length()-1);
       return EntityToUnicode(temp);
     }
 
-  EntityNodeEntry* entry =
-    static_cast<EntityNodeEntry*>
-               (PL_DHashTableSearch(gEntityToUnicode, aEntity.get()));
+  auto entry =
+    static_cast<EntityNodeEntry*>(gEntityToUnicode->Search(aEntity.get()));
 
   return entry ? entry->node->mUnicode : -1;
 }
 
 
 int32_t 
 nsHTMLEntities::EntityToUnicode(const nsAString& aEntity) {
   nsAutoCString theEntity; theEntity.AssignWithConversion(aEntity);
@@ -165,19 +164,19 @@ nsHTMLEntities::EntityToUnicode(const ns
   return EntityToUnicode(theEntity);
 }
 
 
 const char*
 nsHTMLEntities::UnicodeToEntity(int32_t aUnicode)
 {
   NS_ASSERTION(gUnicodeToEntity, "no lookup table, needs addref");
-  EntityNodeEntry* entry =
+  auto entry =
     static_cast<EntityNodeEntry*>
-               (PL_DHashTableSearch(gUnicodeToEntity, NS_INT32_TO_PTR(aUnicode)));
+               (gUnicodeToEntity->Search(NS_INT32_TO_PTR(aUnicode)));
 
   return entry ? entry->node->mStr : nullptr;
 }
 
 #ifdef DEBUG
 #include <stdio.h>
 
 class nsTestEntityTable {
--- a/rdf/base/nsInMemoryDataSource.cpp
+++ b/rdf/base/nsInMemoryDataSource.cpp
@@ -297,23 +297,23 @@ protected:
 
     static void
     SweepForwardArcsEntries(PLDHashTable* aTable, SweepInfo* aArg);
 
 public:
     // Implementation methods
     Assertion*
     GetForwardArcs(nsIRDFResource* u) {
-        PLDHashEntryHdr* hdr = PL_DHashTableSearch(&mForwardArcs, u);
+        PLDHashEntryHdr* hdr = mForwardArcs.Search(u);
         return hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
     }
 
     Assertion*
     GetReverseArcs(nsIRDFNode* v) {
-        PLDHashEntryHdr* hdr = PL_DHashTableSearch(&mReverseArcs, v);
+        PLDHashEntryHdr* hdr = mReverseArcs.Search(v);
         return hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
     }
 
     void
     SetForwardArcs(nsIRDFResource* u, Assertion* as) {
         if (as) {
             Entry* entry = static_cast<Entry*>
                 (PL_DHashTableAdd(&mForwardArcs, u, mozilla::fallible));
@@ -416,18 +416,17 @@ InMemoryAssertionEnumeratorImpl::InMemor
     NS_IF_ADDREF(mTarget);
 
     if (mSource) {
         mNextAssertion = mDataSource->GetForwardArcs(mSource);
 
         if (mNextAssertion && mNextAssertion->mHashEntry) {
             // its our magical HASH_ENTRY forward hash for assertions
             PLDHashEntryHdr* hdr =
-                PL_DHashTableSearch(mNextAssertion->u.hash.mPropertyHash,
-                                    aProperty);
+                mNextAssertion->u.hash.mPropertyHash->Search(aProperty);
             mNextAssertion =
                 hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
         }
     }
     else {
         mNextAssertion = mDataSource->GetReverseArcs(mTarget);
     }
 
@@ -912,18 +911,17 @@ InMemoryDataSource::GetTarget(nsIRDFReso
         return NS_ERROR_NULL_POINTER;
 
     NS_PRECONDITION(target != nullptr, "null ptr");
     if (! target)
         return NS_ERROR_NULL_POINTER;
 
     Assertion *as = GetForwardArcs(source);
     if (as && as->mHashEntry) {
-        PLDHashEntryHdr* hdr =
-            PL_DHashTableSearch(as->u.hash.mPropertyHash, property);
+        PLDHashEntryHdr* hdr = as->u.hash.mPropertyHash->Search(property);
         Assertion* val = hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
         while (val) {
             if (tv == val->u.as.mTruthValue) {
                 *target = val->u.as.mTarget;
                 NS_IF_ADDREF(*target);
                 return NS_OK;
             }
             val = val->mNext;
@@ -957,18 +955,17 @@ InMemoryDataSource::HasAssertion(nsIRDFR
     if (! property)
         return NS_ERROR_NULL_POINTER;
 
     if (! target)
         return NS_ERROR_NULL_POINTER;
 
     Assertion *as = GetForwardArcs(source);
     if (as && as->mHashEntry) {
-        PLDHashEntryHdr* hdr =
-            PL_DHashTableSearch(as->u.hash.mPropertyHash, property);
+        PLDHashEntryHdr* hdr = as->u.hash.mPropertyHash->Search(property);
         Assertion* val = hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
         while (val) {
             if ((val->u.as.mTarget == target) && (tv == (val->u.as.mTruthValue))) {
                 *hasAssertion = true;
                 return NS_OK;
             }
             val = val->mNext;
         }
@@ -1067,18 +1064,17 @@ InMemoryDataSource::LockedAssert(nsIRDFR
     LogOperation("ASSERT", aSource, aProperty, aTarget, aTruthValue);
 
     Assertion* next = GetForwardArcs(aSource);
     Assertion* prev = next;
     Assertion* as = nullptr;
 
     bool    haveHash = (next) ? next->mHashEntry : false;
     if (haveHash) {
-        PLDHashEntryHdr* hdr =
-            PL_DHashTableSearch(next->u.hash.mPropertyHash, aProperty);
+        PLDHashEntryHdr* hdr = next->u.hash.mPropertyHash->Search(aProperty);
         Assertion* val = hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
         while (val) {
             if (val->u.as.mTarget == aTarget) {
                 // Wow, we already had the assertion. Make sure that the
                 // truth values are correct and bail.
                 val->u.as.mTruthValue = aTruthValue;
                 return NS_OK;
             }
@@ -1107,18 +1103,17 @@ InMemoryDataSource::LockedAssert(nsIRDFR
     if (! as)
         return NS_ERROR_OUT_OF_MEMORY;
 
     // Add the datasource's owning reference.
     as->AddRef();
 
     if (haveHash)
     {
-        PLDHashEntryHdr* hdr =
-            PL_DHashTableSearch(next->u.hash.mPropertyHash, aProperty);
+        PLDHashEntryHdr* hdr = next->u.hash.mPropertyHash->Search(aProperty);
         Assertion *asRef =
             hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
         if (asRef)
         {
             as->mNext = asRef->mNext;
             asRef->mNext = as;
         }
         else
@@ -1206,18 +1201,17 @@ InMemoryDataSource::LockedUnassert(nsIRD
 
     Assertion* next = GetForwardArcs(aSource);
     Assertion* prev = next;
     Assertion* root = next;
     Assertion* as = nullptr;
 
     bool    haveHash = (next) ? next->mHashEntry : false;
     if (haveHash) {
-        PLDHashEntryHdr* hdr =
-            PL_DHashTableSearch(next->u.hash.mPropertyHash, aProperty);
+        PLDHashEntryHdr* hdr = next->u.hash.mPropertyHash->Search(aProperty);
         prev = next = hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
         bool first = true;
         while (next) {
             if (aTarget == next->u.as.mTarget) {
                 break;
             }
             first = false;
             prev = next;
@@ -1508,18 +1502,17 @@ InMemoryDataSource::HasArcIn(nsIRDFNode 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 InMemoryDataSource::HasArcOut(nsIRDFResource *aSource, nsIRDFResource *aArc, bool *result)
 {
     Assertion* ass = GetForwardArcs(aSource);
     if (ass && ass->mHashEntry) {
-        PLDHashEntryHdr* hdr =
-            PL_DHashTableSearch(ass->u.hash.mPropertyHash, aArc);
+        PLDHashEntryHdr* hdr = ass->u.hash.mPropertyHash->Search(aArc);
         Assertion* val = hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
         if (val) {
             *result = true;
             return NS_OK;
         }
         ass = ass->mNext;
     }
     while (ass) {
@@ -1659,17 +1652,17 @@ InMemoryDataSource::EnsureFastContainmen
 
     // mutate references of existing forward assertions into this hash
     PLDHashTable *table = hashAssertion->u.hash.mPropertyHash;
     Assertion *nextRef;
     while(first) {
         nextRef = first->mNext;
         nsIRDFResource *prop = first->u.as.mProperty;
 
-        PLDHashEntryHdr* hdr = PL_DHashTableSearch(table, prop);
+        PLDHashEntryHdr* hdr = table->Search(prop);
         Assertion* val = hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
         if (val) {
             first->mNext = val->mNext;
             val->mNext = first;
         }
         else {
             PLDHashEntryHdr* hdr = PL_DHashTableAdd(table, prop,
                                                     mozilla::fallible);
@@ -1722,18 +1715,17 @@ InMemoryDataSource::Mark(nsIRDFResource*
         return NS_ERROR_NULL_POINTER;
 
     NS_PRECONDITION(aTarget != nullptr, "null ptr");
     if (! aTarget)
         return NS_ERROR_NULL_POINTER;
 
     Assertion *as = GetForwardArcs(aSource);
     if (as && as->mHashEntry) {
-        PLDHashEntryHdr* hdr =
-            PL_DHashTableSearch(as->u.hash.mPropertyHash, aProperty);
+        PLDHashEntryHdr* hdr = as->u.hash.mPropertyHash->Search(aProperty);
         Assertion* val = hdr ? static_cast<Entry*>(hdr)->mAssertions : nullptr;
         while (val) {
             if ((val->u.as.mTarget == aTarget) &&
                 (aTruthValue == (val->u.as.mTruthValue))) {
 
                 // found it! so mark it.
                 as->Mark();
                 *aDidMark = true;
@@ -1839,17 +1831,17 @@ InMemoryDataSource::SweepForwardArcsEntr
                 }
                 else {
                     // it's the first one. update the hashtable entry.
                     entry->mAssertions = next;
                 }
 
                 // remove from the reverse arcs
                 PLDHashEntryHdr* hdr =
-                    PL_DHashTableSearch(aInfo->mReverseArcs, as->u.as.mTarget);
+                    aInfo->mReverseArcs->Search(as->u.as.mTarget);
                 NS_ASSERTION(hdr, "no assertion in reverse arcs");
 
                 Entry* rentry = static_cast<Entry*>(hdr);
                 Assertion* ras = rentry->mAssertions;
                 Assertion* rprev = nullptr;
                 while (ras) {
                     if (ras == as) {
                         if (rprev) {
--- a/rdf/base/nsRDFService.cpp
+++ b/rdf/base/nsRDFService.cpp
@@ -834,17 +834,17 @@ RDFServiceImpl::GetResource(const nsACSt
     if (aURI.IsEmpty())
         return NS_ERROR_INVALID_ARG;
 
     const nsAFlatCString& flatURI = PromiseFlatCString(aURI);
     MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv get-resource %s", flatURI.get()));
 
     // First, check the cache to see if we've already created and
     // registered this thing.
-    PLDHashEntryHdr *hdr = PL_DHashTableSearch(&mResources, flatURI.get());
+    PLDHashEntryHdr *hdr = mResources.Search(flatURI.get());
     if (hdr) {
         ResourceHashEntry *entry = static_cast<ResourceHashEntry *>(hdr);
         NS_ADDREF(*aResource = entry->mResource);
         return NS_OK;
     }
 
     // Nope. So go to the repository to create it.
 
@@ -1002,32 +1002,32 @@ RDFServiceImpl::GetLiteral(const char16_
     if (! aValue)
         return NS_ERROR_NULL_POINTER;
 
     NS_PRECONDITION(aLiteral != nullptr, "null ptr");
     if (! aLiteral)
         return NS_ERROR_NULL_POINTER;
 
     // See if we have one already cached
-    PLDHashEntryHdr *hdr = PL_DHashTableSearch(&mLiterals, aValue);
+    PLDHashEntryHdr *hdr = mLiterals.Search(aValue);
     if (hdr) {
         LiteralHashEntry *entry = static_cast<LiteralHashEntry *>(hdr);
         NS_ADDREF(*aLiteral = entry->mLiteral);
         return NS_OK;
     }
 
     // Nope. Create a new one
     return LiteralImpl::Create(aValue, aLiteral);
 }
 
 NS_IMETHODIMP
 RDFServiceImpl::GetDateLiteral(PRTime aTime, nsIRDFDate** aResult)
 {
     // See if we have one already cached
-    PLDHashEntryHdr *hdr = PL_DHashTableSearch(&mDates, &aTime);
+    PLDHashEntryHdr *hdr = mDates.Search(&aTime);
     if (hdr) {
         DateHashEntry *entry = static_cast<DateHashEntry *>(hdr);
         NS_ADDREF(*aResult = entry->mDate);
         return NS_OK;
     }
 
     DateImpl* result = new DateImpl(aTime);
     if (! result)
@@ -1036,17 +1036,17 @@ RDFServiceImpl::GetDateLiteral(PRTime aT
     NS_ADDREF(*aResult = result);
     return NS_OK;
 }
 
 NS_IMETHODIMP
 RDFServiceImpl::GetIntLiteral(int32_t aInt, nsIRDFInt** aResult)
 {
     // See if we have one already cached
-    PLDHashEntryHdr *hdr = PL_DHashTableSearch(&mInts, &aInt);
+    PLDHashEntryHdr *hdr = mInts.Search(&aInt);
     if (hdr) {
         IntHashEntry *entry = static_cast<IntHashEntry *>(hdr);
         NS_ADDREF(*aResult = entry->mInt);
         return NS_OK;
     }
 
     IntImpl* result = new IntImpl(aInt);
     if (! result)
@@ -1057,17 +1057,17 @@ RDFServiceImpl::GetIntLiteral(int32_t aI
 }
 
 NS_IMETHODIMP
 RDFServiceImpl::GetBlobLiteral(const uint8_t *aBytes, int32_t aLength,
                                nsIRDFBlob **aResult)
 {
     BlobImpl::Data key = { aLength, const_cast<uint8_t *>(aBytes) };
 
-    PLDHashEntryHdr *hdr = PL_DHashTableSearch(&mBlobs, &key);
+    PLDHashEntryHdr *hdr = mBlobs.Search(&key);
     if (hdr) {
         BlobHashEntry *entry = static_cast<BlobHashEntry *>(hdr);
         NS_ADDREF(*aResult = entry->mBlob);
         return NS_OK;
     }
 
     BlobImpl *result = new BlobImpl(aBytes, aLength);
     if (! result)
@@ -1118,17 +1118,17 @@ RDFServiceImpl::RegisterResource(nsIRDFR
     rv = aResource->GetValueConst(&uri);
     NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get URI from resource");
     if (NS_FAILED(rv)) return rv;
 
     NS_ASSERTION(uri != nullptr, "resource has no URI");
     if (! uri)
         return NS_ERROR_NULL_POINTER;
 
-    PLDHashEntryHdr *hdr = PL_DHashTableSearch(&mResources, uri);
+    PLDHashEntryHdr *hdr = mResources.Search(uri);
     if (hdr) {
         if (!aReplace) {
             NS_WARNING("resource already registered, and replace not specified");
             return NS_ERROR_FAILURE;    // already registered
         }
 
         // N.B., we do _not_ release the original resource because we
         // only ever held a weak reference to it. We simply replace
@@ -1177,17 +1177,17 @@ RDFServiceImpl::UnregisterResource(nsIRD
     if (! uri)
         return NS_ERROR_UNEXPECTED;
 
     MOZ_LOG(gLog, LogLevel::Debug,
            ("rdfserv unregister-resource [%p] %s",
             aResource, (const char*) uri));
 
 #ifdef DEBUG
-    if (!PL_DHashTableSearch(&mResources, uri))
+    if (!mResources.Search(uri))
         NS_WARNING("resource was never registered");
 #endif
 
     PL_DHashTableRemove(&mResources, uri);
     return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -1369,18 +1369,17 @@ RDFServiceImpl::GetDataSource(const char
 ////////////////////////////////////////////////////////////////////////
 
 nsresult
 RDFServiceImpl::RegisterLiteral(nsIRDFLiteral* aLiteral)
 {
     const char16_t* value;
     aLiteral->GetValueConst(&value);
 
-    NS_ASSERTION(!PL_DHashTableSearch(&mLiterals, value),
-                 "literal already registered");
+    NS_ASSERTION(!mLiterals.Search(value), "literal already registered");
 
     PLDHashEntryHdr *hdr = PL_DHashTableAdd(&mLiterals, value, fallible);
     if (! hdr)
         return NS_ERROR_OUT_OF_MEMORY;
 
     LiteralHashEntry *entry = static_cast<LiteralHashEntry *>(hdr);
 
     // N.B., we only hold a weak reference to the literal: that
@@ -1399,18 +1398,17 @@ RDFServiceImpl::RegisterLiteral(nsIRDFLi
 
 
 nsresult
 RDFServiceImpl::UnregisterLiteral(nsIRDFLiteral* aLiteral)
 {
     const char16_t* value;
     aLiteral->GetValueConst(&value);
 
-    NS_ASSERTION(PL_DHashTableSearch(&mLiterals, value),
-                 "literal was never registered");
+    NS_ASSERTION(mLiterals.Search(value), "literal was never registered");
 
     PL_DHashTableRemove(&mLiterals, value);
 
     // N.B. that we _don't_ release the literal: we only held a weak
     // reference to it in the hashtable.
     MOZ_LOG(gLog, LogLevel::Debug,
            ("rdfserv unregister-literal [%p] %s",
             aLiteral, (const char16_t*) value));
@@ -1421,18 +1419,17 @@ RDFServiceImpl::UnregisterLiteral(nsIRDF
 //----------------------------------------------------------------------
 
 nsresult
 RDFServiceImpl::RegisterInt(nsIRDFInt* aInt)
 {
     int32_t value;
     aInt->GetValue(&value);
 
-    NS_ASSERTION(!PL_DHashTableSearch(&mInts, &value),
-                 "int already registered");
+    NS_ASSERTION(!mInts.Search(&value), "int already registered");
 
     PLDHashEntryHdr *hdr = PL_DHashTableAdd(&mInts, &value, fallible);
     if (! hdr)
         return NS_ERROR_OUT_OF_MEMORY;
 
     IntHashEntry *entry = static_cast<IntHashEntry *>(hdr);
 
     // N.B., we only hold a weak reference to the literal: that
@@ -1451,18 +1448,17 @@ RDFServiceImpl::RegisterInt(nsIRDFInt* a
 
 
 nsresult
 RDFServiceImpl::UnregisterInt(nsIRDFInt* aInt)
 {
     int32_t value;
     aInt->GetValue(&value);
 
-    NS_ASSERTION(PL_DHashTableSearch(&mInts, &value),
-                 "int was never registered");
+    NS_ASSERTION(mInts.Search(&value), "int was never registered");
 
     PL_DHashTableRemove(&mInts, &value);
 
     // N.B. that we _don't_ release the literal: we only held a weak
     // reference to it in the hashtable.
     MOZ_LOG(gLog, LogLevel::Debug,
            ("rdfserv unregister-int [%p] %d",
             aInt, value));
@@ -1473,18 +1469,17 @@ RDFServiceImpl::UnregisterInt(nsIRDFInt*
 //----------------------------------------------------------------------
 
 nsresult
 RDFServiceImpl::RegisterDate(nsIRDFDate* aDate)
 {
     PRTime value;
     aDate->GetValue(&value);
 
-    NS_ASSERTION(!PL_DHashTableSearch(&mDates, &value),
-                 "date already registered");
+    NS_ASSERTION(!mDates.Search(&value), "date already registered");
 
     PLDHashEntryHdr *hdr = PL_DHashTableAdd(&mDates, &value, fallible);
     if (! hdr)
         return NS_ERROR_OUT_OF_MEMORY;
 
     DateHashEntry *entry = static_cast<DateHashEntry *>(hdr);
 
     // N.B., we only hold a weak reference to the literal: that
@@ -1503,35 +1498,33 @@ RDFServiceImpl::RegisterDate(nsIRDFDate*
 
 
 nsresult
 RDFServiceImpl::UnregisterDate(nsIRDFDate* aDate)
 {
     PRTime value;
     aDate->GetValue(&value);
 
-    NS_ASSERTION(PL_DHashTableSearch(&mDates, &value),
-                 "date was never registered");
+    NS_ASSERTION(mDates.Search(&value), "date was never registered");
 
     PL_DHashTableRemove(&mDates, &value);
 
     // N.B. that we _don't_ release the literal: we only held a weak
     // reference to it in the hashtable.
     MOZ_LOG(gLog, LogLevel::Debug,
            ("rdfserv unregister-date [%p] %ld",
             aDate, value));
 
     return NS_OK;
 }
 
 nsresult
 RDFServiceImpl::RegisterBlob(BlobImpl *aBlob)
 {
-    NS_ASSERTION(!PL_DHashTableSearch(&mBlobs, &aBlob->mData),
-                 "blob already registered");
+    NS_ASSERTION(!mBlobs.Search(&aBlob->mData), "blob already registered");
 
     PLDHashEntryHdr *hdr = PL_DHashTableAdd(&mBlobs, &aBlob->mData, fallible);
     if (! hdr)
         return NS_ERROR_OUT_OF_MEMORY;
 
     BlobHashEntry *entry = static_cast<BlobHashEntry *>(hdr);
 
     // N.B., we only hold a weak reference to the literal: that
@@ -1545,18 +1538,17 @@ RDFServiceImpl::RegisterBlob(BlobImpl *a
             aBlob, aBlob->mData.mBytes));
 
     return NS_OK;
 }
 
 nsresult
 RDFServiceImpl::UnregisterBlob(BlobImpl *aBlob)
 {
-    NS_ASSERTION(PL_DHashTableSearch(&mBlobs, &aBlob->mData),
-                 "blob was never registered");
+    NS_ASSERTION(mBlobs.Search(&aBlob->mData), "blob was never registered");
 
     PL_DHashTableRemove(&mBlobs, &aBlob->mData);
 
      // N.B. that we _don't_ release the literal: we only held a weak
      // reference to it in the hashtable.
     MOZ_LOG(gLog, LogLevel::Debug,
            ("rdfserv unregister-blob [%p] %s",
             aBlob, aBlob->mData.mBytes));
--- a/security/manager/ssl/nsSecureBrowserUIImpl.cpp
+++ b/security/manager/ssl/nsSecureBrowserUIImpl.cpp
@@ -867,18 +867,17 @@ nsSecureBrowserUIImpl::OnStateChange(nsI
   bool requestHasTransferedData = false;
 
   if (aProgressStateFlags & STATE_STOP
       &&
       aProgressStateFlags & STATE_IS_REQUEST)
   {
     { /* scope for the ReentrantMonitorAutoEnter */
       ReentrantMonitorAutoEnter lock(mReentrantMonitor);
-      PLDHashEntryHdr* entry =
-        PL_DHashTableSearch(&mTransferringRequests, aRequest);
+      PLDHashEntryHdr* entry = mTransferringRequests.Search(aRequest);
       if (entry) {
         mTransferringRequests.RemoveEntry(entry);
         requestHasTransferedData = true;
       }
     }
 
     if (!requestHasTransferedData) {
       // Because image loads doesn't support any TRANSFERRING notifications but
--- a/uriloader/base/nsDocLoader.cpp
+++ b/uriloader/base/nsDocLoader.cpp
@@ -1334,18 +1334,17 @@ nsresult nsDocLoader::AddRequestInfo(nsI
 
 void nsDocLoader::RemoveRequestInfo(nsIRequest *aRequest)
 {
   PL_DHashTableRemove(&mRequestInfoHash, aRequest);
 }
 
 nsDocLoader::nsRequestInfo* nsDocLoader::GetRequestInfo(nsIRequest* aRequest)
 {
-  return static_cast<nsRequestInfo*>
-                    (PL_DHashTableSearch(&mRequestInfoHash, aRequest));
+  return static_cast<nsRequestInfo*>(mRequestInfoHash.Search(aRequest));
 }
 
 void nsDocLoader::ClearRequestInfoHash(void)
 {
   mRequestInfoHash.Clear();
 }
 
 int64_t nsDocLoader::CalculateMaxProgress()
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -894,17 +894,17 @@ public:
     return n;
   }
 };
 
 PtrToNodeEntry*
 CCGraph::FindNodeEntry(void* aPtr)
 {
   return
-    static_cast<PtrToNodeEntry*>(PL_DHashTableSearch(&mPtrToNodeMap, aPtr));
+    static_cast<PtrToNodeEntry*>(mPtrToNodeMap.Search(aPtr));
 }
 
 PtrInfo*
 CCGraph::FindNode(void* aPtr)
 {
   PtrToNodeEntry* e = FindNodeEntry(aPtr);
   return e ? e->mNode : nullptr;
 }
--- a/xpcom/ds/nsPersistentProperties.cpp
+++ b/xpcom/ds/nsPersistentProperties.cpp
@@ -547,19 +547,17 @@ nsPersistentProperties::Save(nsIOutputSt
 }
 
 NS_IMETHODIMP
 nsPersistentProperties::GetStringProperty(const nsACString& aKey,
                                           nsAString& aValue)
 {
   const nsAFlatCString&  flatKey = PromiseFlatCString(aKey);
 
-  PropertyTableEntry* entry = static_cast<PropertyTableEntry*>(
-    PL_DHashTableSearch(&mTable, flatKey.get()));
-
+  auto entry = static_cast<PropertyTableEntry*>(mTable.Search(flatKey.get()));
   if (!entry) {
     return NS_ERROR_FAILURE;
   }
 
   aValue = entry->mValue;
   return NS_OK;
 }
 
@@ -607,17 +605,17 @@ NS_IMETHODIMP
 nsPersistentProperties::Undefine(const char* aProp)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
 nsPersistentProperties::Has(const char* aProp, bool* aResult)
 {
-  *aResult = !!PL_DHashTableSearch(&mTable, aProp);
+  *aResult = !!mTable.Search(aProp);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsPersistentProperties::GetKeys(uint32_t* aCount, char*** aKeys)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/xpcom/ds/nsStaticNameTable.cpp
+++ b/xpcom/ds/nsStaticNameTable.cpp
@@ -165,32 +165,30 @@ nsStaticCaseInsensitiveNameTable::~nsSta
 int32_t
 nsStaticCaseInsensitiveNameTable::Lookup(const nsACString& aName)
 {
   NS_ASSERTION(mNameArray, "not inited");
 
   const nsAFlatCString& str = PromiseFlatCString(aName);
 
   NameTableKey key(&str);
-  NameTableEntry* entry =
-    static_cast<NameTableEntry*>(PL_DHashTableSearch(&mNameTable, &key));
+  auto entry = static_cast<NameTableEntry*>(mNameTable.Search(&key));
 
   return entry ? entry->mIndex : nsStaticCaseInsensitiveNameTable::NOT_FOUND;
 }
 
 int32_t
 nsStaticCaseInsensitiveNameTable::Lookup(const nsAString& aName)
 {
   NS_ASSERTION(mNameArray, "not inited");
 
   const nsAFlatString& str = PromiseFlatString(aName);
 
   NameTableKey key(&str);
-  NameTableEntry* entry =
-    static_cast<NameTableEntry*>(PL_DHashTableSearch(&mNameTable, &key));
+  auto entry = static_cast<NameTableEntry*>(mNameTable.Search(&key));
 
   return entry ? entry->mIndex : nsStaticCaseInsensitiveNameTable::NOT_FOUND;
 }
 
 const nsAFlatCString&
 nsStaticCaseInsensitiveNameTable::GetStringValue(int32_t aIndex)
 {
   NS_ASSERTION(mNameArray, "not inited");
--- a/xpcom/glue/nsTHashtable.h
+++ b/xpcom/glue/nsTHashtable.h
@@ -120,18 +120,17 @@ public:
    * Get the entry associated with a key.
    * @param     aKey the key to retrieve
    * @return    pointer to the entry class, if the key exists; nullptr if the
    *            key doesn't exist
    */
   EntryType* GetEntry(KeyType aKey) const
   {
     return static_cast<EntryType*>(
-      PL_DHashTableSearch(const_cast<PLDHashTable*>(&mTable),
-                          EntryType::KeyToPointer(aKey)));
+      const_cast<PLDHashTable*>(&mTable)->Search(EntryType::KeyToPointer(aKey)));
   }
 
   /**
    * Return true if an entry for the given key exists, false otherwise.
    * @param     aKey the key to retrieve
    * @return    true if the key exists, false if the key doesn't exist
    */
   bool Contains(KeyType aKey) const { return !!GetEntry(aKey); }
--- a/xpcom/glue/pldhash.cpp
+++ b/xpcom/glue/pldhash.cpp
@@ -549,17 +549,17 @@ PLDHashTable::ComputeKeyHash(const void*
   if (keyHash < 2) {
     keyHash -= 2;
   }
   keyHash &= ~kCollisionFlag;
 
   return keyHash;
 }
 
-MOZ_ALWAYS_INLINE PLDHashEntryHdr*
+PLDHashEntryHdr*
 PLDHashTable::Search(const void* aKey)
 {
 #ifdef DEBUG
   AutoReadOp op(mChecker);
 #endif
 
   PLDHashEntryHdr* entry = mEntryStore.Get()
                          ? SearchTable<ForSearchOrRemove>(aKey,
@@ -674,22 +674,16 @@ PLDHashTable::RemoveEntry(PLDHashEntryHd
   AutoWriteOp op(mChecker);
 #endif
 
   RawRemove(aEntry);
   ShrinkIfAppropriate();
 }
 
 PLDHashEntryHdr* PL_DHASH_FASTCALL
-PL_DHashTableSearch(PLDHashTable* aTable, const void* aKey)
-{
-  return aTable->Search(aKey);
-}
-
-PLDHashEntryHdr* PL_DHASH_FASTCALL
 PL_DHashTableAdd(PLDHashTable* aTable, const void* aKey,
                  const fallible_t& aFallible)
 {
   return aTable->Add(aKey, aFallible);
 }
 
 PLDHashEntryHdr* PL_DHASH_FASTCALL
 PL_DHashTableAdd(PLDHashTable* aTable, const void* aKey)
--- a/xpcom/glue/pldhash.h
+++ b/xpcom/glue/pldhash.h
@@ -615,22 +615,16 @@ void
 PL_DHashClearEntryStub(PLDHashTable* aTable, PLDHashEntryHdr* aEntry);
 
 // If you use PLDHashEntryStub or a subclass of it as your entry struct, and
 // if your entries move via memcpy and clear via memset(0), you can use these
 // stub operations.
 const PLDHashTableOps*
 PL_DHashGetStubOps(void);
 
-// The following function are deprecated. Use the equivalent class methods
-// instead: PLDHashTable::Search() instead of PL_DHashTableSearch(), etc.
-
-PLDHashEntryHdr* PL_DHASH_FASTCALL
-PL_DHashTableSearch(PLDHashTable* aTable, const void* aKey);
-
 PLDHashEntryHdr* PL_DHASH_FASTCALL
 PL_DHashTableAdd(PLDHashTable* aTable, const void* aKey,
                  const mozilla::fallible_t&);
 
 PLDHashEntryHdr* PL_DHASH_FASTCALL
 PL_DHashTableAdd(PLDHashTable* aTable, const void* aKey);
 
 void PL_DHASH_FASTCALL
--- a/xpcom/tests/gtest/TestPLDHash.cpp
+++ b/xpcom/tests/gtest/TestPLDHash.cpp
@@ -123,17 +123,17 @@ TEST(PLDHashTableTest, LazyStorage)
   // operations work appropriately when the table is empty and the storage
   // hasn't yet been allocated.
 
   ASSERT_EQ(t.Capacity(), 0u);
   ASSERT_EQ(t.EntrySize(), sizeof(PLDHashEntryStub));
   ASSERT_EQ(t.EntryCount(), 0u);
   ASSERT_EQ(t.Generation(), 0u);
 
-  ASSERT_TRUE(!PL_DHashTableSearch(&t, (const void*)1));
+  ASSERT_TRUE(!t.Search((const void*)1));
 
   // No result to check here, but call it to make sure it doesn't crash.
   PL_DHashTableRemove(&t, (const void*)2);
 
   for (auto iter = t.Iter(); !iter.Done(); iter.Next()) {
     ASSERT_TRUE(false); // shouldn't hit this on an empty table
   }