bug 1184217 - make CheckDocTree check the entire document tree not just the subtree r=davidb[
☠☠ backed out by d2629e3e4b0c ☠ ☠
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Tue, 18 Aug 2015 11:45:37 -0400
changeset 259301 1d82f63f06e705da27bd1ebbb8149a7eefe417f5
parent 259300 57a3cadc3990cf99329f0b0e082832e2cc378a80
child 259302 63431f8eca5b32e4bf8b69850e1d4f8ac9cd9c2e
push id64194
push usertrev.saunders@gmail.com
push dateTue, 25 Aug 2015 20:12:18 +0000
treeherdermozilla-inbound@1d82f63f06e7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1184217
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 1184217 - make CheckDocTree check the entire document tree not just the subtree r=davidb[
accessible/ipc/DocAccessibleParent.cpp
accessible/ipc/DocAccessibleParent.h
--- a/accessible/ipc/DocAccessibleParent.cpp
+++ b/accessible/ipc/DocAccessibleParent.cpp
@@ -261,25 +261,43 @@ DocAccessibleParent::Destroy()
   ProxyDestroyed(this);
   if (mParentDoc)
     mParentDoc->RemoveChildDoc(this);
   else if (IsTopLevel())
     GetAccService()->RemoteDocShutdown(this);
 }
 
 bool
-DocAccessibleParent::CheckDocTree() const
+DocAccessibleParent::CheckDocTreeInternal() const
 {
   size_t childDocs = mChildDocs.Length();
   for (size_t i = 0; i < childDocs; i++) {
     if (!mChildDocs[i] || mChildDocs[i]->mParentDoc != this)
       return false;
 
-    if (!mChildDocs[i]->CheckDocTree()) {
+    if (!mChildDocs[i]->CheckDocTreeInternal()) {
       return false;
     }
   }
 
   return true;
 }
 
+const DocAccessibleParent*
+DocAccessibleParent::CheckTopDoc() const
+{
+  const DocAccessibleParent* doc = this;
+  while (doc->ParentDoc()) {
+    doc = doc->ParentDoc();
+  }
+
+  MOZ_DIAGNOSTIC_ASSERT(doc->mTopLevel);
+
+  return doc;
+}
+
+bool
+DocAccessibleParent::CheckDocTree() const
+{
+  return CheckTopDoc()->CheckDocTreeInternal();
+}
 } // a11y
 } // mozilla
--- a/accessible/ipc/DocAccessibleParent.h
+++ b/accessible/ipc/DocAccessibleParent.h
@@ -147,16 +147,18 @@ private:
 
     ProxyAccessible* mProxy;
   };
 
   uint32_t AddSubtree(ProxyAccessible* aParent,
                       const nsTArray<AccessibleData>& aNewTree, uint32_t aIdx,
                       uint32_t aIdxInParent);
   MOZ_WARN_UNUSED_RESULT bool CheckDocTree() const;
+  MOZ_WARN_UNUSED_RESULT bool CheckDocTreeInternal() const;
+  const DocAccessibleParent* CheckTopDoc() const;
 
   nsTArray<DocAccessibleParent*> mChildDocs;
   DocAccessibleParent* mParentDoc;
 
   /*
    * Conceptually this is a map from IDs to proxies, but we store the ID in the
    * proxy object so we can't use a real map.
    */