Bug 1202526 (part 3) - Avoid PL_DHashTableRawRemove() in nsDocument. r=bz.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 07 Sep 2015 19:20:16 -0700
changeset 294324 59fea40ba28970c091bcf778b710fad768d2098f
parent 294323 19103f4ad55d84eb59faf46e068b864eab59e156
child 294325 438b7e68c23adbf83344f832a09d626a1190c46f
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs1202526
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 1202526 (part 3) - Avoid PL_DHashTableRawRemove() in nsDocument. r=bz. This assumes that it's safe to possibly shrink the table after the removal, i.e. there are no surprising subtleties with how this table is managed.
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -3943,23 +3943,17 @@ nsresult
 nsDocument::SetSubDocumentFor(Element* aElement, nsIDocument* aSubDoc)
 {
   NS_ENSURE_TRUE(aElement, NS_ERROR_UNEXPECTED);
 
   if (!aSubDoc) {
     // aSubDoc is nullptr, remove the mapping
 
     if (mSubDocuments) {
-      SubDocMapEntry *entry =
-        static_cast<SubDocMapEntry*>
-                   (PL_DHashTableSearch(mSubDocuments, aElement));
-
-      if (entry) {
-        PL_DHashTableRawRemove(mSubDocuments, entry);
-      }
+      PL_DHashTableRemove(mSubDocuments, aElement);
     }
   } else {
     if (!mSubDocuments) {
       // Create a new hashtable
 
       static const PLDHashTableOps hash_table_ops =
       {
         PL_DHashVoidPtrKeyStub,