Bug 741223 - MutationObserver cleanup; r=smaug
authorMs2ger <ms2ger@gmail.com>
Tue, 03 Apr 2012 09:25:38 +0200
changeset 94199 dd146b9296f49167b80be92b4449eb645364ebc0
parent 94198 4df84fc7cbf1092c5322f7a094f594f9740a15e3
child 94200 66101542ba093b56f67a2cacfe786e61cb66ce19
push id886
push userlsblakk@mozilla.com
push dateMon, 04 Jun 2012 19:57:52 +0000
treeherdermozilla-beta@bbd8d5efd6d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs741223
milestone14.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 741223 - MutationObserver cleanup; r=smaug
content/base/src/nsDOMMutationObserver.cpp
--- a/content/base/src/nsDOMMutationObserver.cpp
+++ b/content/base/src/nsDOMMutationObserver.cpp
@@ -532,19 +532,16 @@ nsDOMMutationObserver::Observe(nsIDOMNod
 
 NS_IMETHODIMP
 nsDOMMutationObserver::Disconnect()
 {
   for (PRInt32 i = 0; i < mReceivers.Count(); ++i) {
     mReceivers[i]->Disconnect();
   }
   mReceivers.Clear();
-  for (PRUint32 i = 0; i < mCurrentMutations.Length(); ++i) {
-    nsDOMMutationRecord* r = mCurrentMutations[i];
-  }
   mCurrentMutations.Clear();
   mPendingMutations.Clear();
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 nsDOMMutationObserver::Initialize(nsISupports* aOwner, JSContext* cx,
@@ -568,38 +565,21 @@ nsDOMMutationObserver::Initialize(nsISup
                                       NS_GET_IID(nsIMutationObserverCallback),
                                       getter_AddRefs(tmp));
   mCallback = do_QueryInterface(tmp);
   NS_ENSURE_STATE(mCallback);
   
   return NS_OK;
 }
 
-static PLDHashOperator
-TransientReceiverTraverser(nsISupports* aKey,
-                           nsCOMArray<nsMutationReceiver>* aArray,
-                           void* aUserArg)
-{
-  PRInt32 count = aArray->Count();
-  for (PRInt32 i = 0; i < count; ++i) {
-    nsMutationReceiver* r = aArray->ObjectAt(i);
-    nsMutationReceiver* p = r->GetParent();
-    if (p) {
-      p->RemoveClones();
-    }
-    r->Disconnect();
-  }
-  return PL_DHASH_NEXT;
-}
-
 void
 nsDOMMutationObserver::HandleMutation()
 {
   NS_ASSERTION(nsContentUtils::IsSafeToRunScript(), "Whaat!");
-  NS_ASSERTION(mCurrentMutations.Length() == 0,
+  NS_ASSERTION(mCurrentMutations.IsEmpty(),
                "Still generating MutationRecords?");
 
   mWaitingForRun = false;
 
   for (PRInt32 i = 0; i < mReceivers.Count(); ++i) {
     mReceivers[i]->RemoveClones();
   }
   mTransientReceivers.Clear();
@@ -744,17 +724,16 @@ nsDOMMutationObserver::LeaveMutationHand
       sCurrentlyHandlingObservers->Length() == sMutationLevel) {
     nsCOMArray<nsIDOMMozMutationObserver>& obs =
       sCurrentlyHandlingObservers->ElementAt(sMutationLevel - 1);
     for (PRInt32 i = 0; i < obs.Count(); ++i) {
       nsDOMMutationObserver* o =
         static_cast<nsDOMMutationObserver*>(obs[i]);
       if (o->mCurrentMutations.Length() == sMutationLevel) {
         // It is already in pending mutations.
-        nsDOMMutationRecord* r = o->mCurrentMutations[sMutationLevel - 1];
         o->mCurrentMutations.RemoveElementAt(sMutationLevel - 1);
       }
     }
     sCurrentlyHandlingObservers->RemoveElementAt(sMutationLevel - 1);
   }
   --sMutationLevel;
 }