Bug 1263188 - more assertions, part3, r=yzen
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 14 Apr 2016 07:39:44 -0400
changeset 331130 97c95a625a6fe8a160409ef3f603b783565c262c
parent 331129 55b6f17f513ceadf145c8b0600ab06a68c55cf34
child 331131 6500ef91810315bd2a4103b0b9ada0207c2b3686
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs1263188
milestone48.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 1263188 - more assertions, part3, r=yzen
accessible/base/EventTree.cpp
--- a/accessible/base/EventTree.cpp
+++ b/accessible/base/EventTree.cpp
@@ -184,58 +184,62 @@ void
 EventTree::Process()
 {
   EventTree* node = mFirst;
   while (node) {
     node->Process();
     node = node->mNext;
   }
 
+  MOZ_ASSERT(mContainer || mDependentEvents.IsEmpty(),
+             "No container, no events");
+  MOZ_ASSERT(!mContainer || !mContainer->IsDefunct(),
+             "Processing events for defunct container");
+
   // Fire mutation events.
-  if (mContainer) {
-    uint32_t eventsCount = mDependentEvents.Length();
-    for (uint32_t jdx = 0; jdx < eventsCount; jdx++) {
-      AccMutationEvent* mtEvent = mDependentEvents[jdx];
-      MOZ_ASSERT(mtEvent->mEventRule != AccEvent::eDoNotEmit,
-                 "The event shouldn't be presented in the tree");
+  uint32_t eventsCount = mDependentEvents.Length();
+  for (uint32_t jdx = 0; jdx < eventsCount; jdx++) {
+    AccMutationEvent* mtEvent = mDependentEvents[jdx];
+    MOZ_ASSERT(mtEvent->mEventRule != AccEvent::eDoNotEmit,
+               "The event shouldn't be presented in the tree");
+
+    nsEventShell::FireEvent(mtEvent);
+    if (mtEvent->mTextChangeEvent) {
+      nsEventShell::FireEvent(mtEvent->mTextChangeEvent);
+    }
 
-      nsEventShell::FireEvent(mtEvent);
-      if (mtEvent->mTextChangeEvent) {
-        nsEventShell::FireEvent(mtEvent->mTextChangeEvent);
+    if (mtEvent->IsHide()) {
+      // Fire menupopup end event before a hide event if a menu goes away.
+
+      // XXX: We don't look into children of hidden subtree to find hiding
+      // menupopup (as we did prior bug 570275) because we don't do that when
+      // menu is showing (and that's impossible until bug 606924 is fixed).
+      // Nevertheless we should do this at least because layout coalesces
+      // the changes before our processing and we may miss some menupopup
+      // events. Now we just want to be consistent in content insertion/removal
+      // handling.
+      if (mtEvent->mAccessible->ARIARole() == roles::MENUPOPUP) {
+        nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
+                                mtEvent->mAccessible);
       }
 
-      if (mtEvent->IsHide()) {
-        // Fire menupopup end event before a hide event if a menu goes away.
-
-        // XXX: We don't look into children of hidden subtree to find hiding
-        // menupopup (as we did prior bug 570275) because we don't do that when
-        // menu is showing (and that's impossible until bug 606924 is fixed).
-        // Nevertheless we should do this at least because layout coalesces
-        // the changes before our processing and we may miss some menupopup
-        // events. Now we just want to be consistent in content insertion/removal
-        // handling.
-        if (mtEvent->mAccessible->ARIARole() == roles::MENUPOPUP) {
-          nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
-                                  mtEvent->mAccessible);
-        }
-
-        AccHideEvent* hideEvent = downcast_accEvent(mtEvent);
-        if (hideEvent->NeedsShutdown()) {
-          mtEvent->GetDocAccessible()->ShutdownChildrenInSubtree(mtEvent->mAccessible);
-        }
+      AccHideEvent* hideEvent = downcast_accEvent(mtEvent);
+      if (hideEvent->NeedsShutdown()) {
+        mtEvent->GetDocAccessible()->ShutdownChildrenInSubtree(mtEvent->mAccessible);
       }
     }
+  }
 
-    // Fire reorder event at last.
-    if (mFireReorder) {
-      nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_REORDER, mContainer);
-    }
+  // Fire reorder event at last.
+  if (mFireReorder) {
+    MOZ_ASSERT(mContainer);
+    nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_REORDER, mContainer);
+  }
 
-    mDependentEvents.Clear();
-  }
+  mDependentEvents.Clear();
 }
 
 EventTree*
 EventTree::FindOrInsert(Accessible* aContainer)
 {
   if (!mFirst) {
     return mFirst = new EventTree(aContainer, true);
   }