Backing out fix for bug 412878 ... Marco found a problem with dynamic content updates
authoraaronleventhal@moonset.net
Tue, 22 Jan 2008 07:59:53 -0800
changeset 10533 61b9083aecb161fd2910eff3fa32dc5d8c2aac1d
parent 10532 aedb20a53d94d0ea62fcd7497657fe04fea0c885
child 10534 644a5c44deeacf9533bda8757bf817049e293f0b
push id1
push userbsmedberg@mozilla.com
push dateThu, 20 Mar 2008 16:49:24 +0000
treeherdermozilla-central@61007906a1f8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs412878
milestone1.9b3pre
Backing out fix for bug 412878 ... Marco found a problem with dynamic content updates
accessible/src/base/nsDocAccessible.cpp
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -1657,56 +1657,50 @@ void nsDocAccessible::RefreshNodes(nsIDO
                             iterContent->GetBindingParent())) {
           // GetBindingParent() check is a perf win -- make sure we don't
           // shut down the same subtree twice since we'll reach non-anon content via
           // DOM traversal later in this method
           RefreshNodes(iterNode);
         }
       }
     }
-    // Fire menupopup end if a menu goes away
-    PRUint32 role = Role(accessible);
-    if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
-      nsCOMPtr<nsIDOMNode> domNode;
-      accessNode->GetDOMNode(getter_AddRefs(domNode));
-      nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(domNode));
-      if (!popup) {
-        // Popup elements already fire these via DOMMenuInactive
-        // handling in nsRootAccessible::HandleEvent
-        nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
-                                 accessible);
+
+    // Shutdown ordinary content subtree as well -- there may be
+    // access node children which are not full accessible objects
+    aStartNode->GetFirstChild(getter_AddRefs(nextNode));
+    while (nextNode) {
+      nextNode.swap(iterNode);
+      RefreshNodes(iterNode);
+      iterNode->GetNextSibling(getter_AddRefs(nextNode));
+    }
+
+    // Don't shutdown our doc object!
+    if (accessNode && accessNode != static_cast<nsIAccessNode*>(this)) {
+      // Fire menupopup end if a menu goes away
+      PRUint32 role = Role(accessible);
+      if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
+        nsCOMPtr<nsIDOMNode> domNode;
+        accessNode->GetDOMNode(getter_AddRefs(domNode));
+        nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(domNode));
+        if (!popup) {
+          // Popup elements already fire these via DOMMenuInactive
+          // handling in nsRootAccessible::HandleEvent
+          nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
+                                   accessible);
+        }
       }
+      // Shut down the actual accessible or access node
+      void *uniqueID;
+      accessNode->GetUniqueID(&uniqueID);
+      nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(accessNode));
+      privateAccessNode->Shutdown();
+      // Remove from hash table as well
+      mAccessNodeCache.Remove(uniqueID);
     }
   }
-
-  // Shutdown ordinary content subtree as well -- there may be
-  // access node children which are not full accessible objects
-  aStartNode->GetFirstChild(getter_AddRefs(nextNode));
-  while (nextNode) {
-    nextNode.swap(iterNode);
-    RefreshNodes(iterNode);
-    iterNode->GetNextSibling(getter_AddRefs(nextNode));
-  }
-
-  if (!accessNode) {
-    return;
-  }
-  if (accessNode == this) {
-    // Is this nsDocAccessible. It won't get shut down until pagehide
-    InvalidateChildren();
-    return;
-  }
-  
-  // Shut down the actual accessible or access node
-  nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(accessNode));
-  privateAccessNode->Shutdown();
-  // Remove from hash table as well
-  void *uniqueID;
-  accessNode->GetUniqueID(&uniqueID);
-  mAccessNodeCache.Remove(uniqueID);
 }
 
 NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
                                                       PRUint32 aChangeEventType)
 {
   PRBool isHiding = 
     aChangeEventType == nsIAccessibleEvent::EVENT_ASYNCH_HIDE ||
     aChangeEventType == nsIAccessibleEvent::EVENT_DOM_DESTROY;