bug 1088148 - only tell the parent process about child documents that are attached to their parent r=surkov
authorTrevor Saunders <trev.saunders@gmail.com>
Wed, 07 Jan 2015 15:16:37 -0500
changeset 222740 33125ece9497300afdc11c4093b890e7e34da1c1
parent 222739 70f64ef5569e12ebd16e206b5e067f5378bc3ada
child 222741 06ea411856f7d3d36007bc9019baa24922f068cf
push id53716
push usertrev.saunders@gmail.com
push dateThu, 08 Jan 2015 23:55:02 +0000
treeherdermozilla-inbound@06ea411856f7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov
bugs1088148
milestone37.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 1088148 - only tell the parent process about child documents that are attached to their parent r=surkov
accessible/base/NotificationController.cpp
--- a/accessible/base/NotificationController.cpp
+++ b/accessible/base/NotificationController.cpp
@@ -204,40 +204,41 @@ NotificationController::WillRefresh(mozi
   }
 
   // Process rendered text change notifications.
   mTextHash.EnumerateEntries(TextEnumerator, mDocument);
   mTextHash.Clear();
 
   // Bind hanging child documents.
   uint32_t hangingDocCnt = mHangingChildDocuments.Length();
+  nsTArray<nsRefPtr<DocAccessible>> newChildDocs;
   for (uint32_t idx = 0; idx < hangingDocCnt; idx++) {
     DocAccessible* childDoc = mHangingChildDocuments[idx];
     if (childDoc->IsDefunct())
       continue;
 
     nsIContent* ownerContent = mDocument->DocumentNode()->
       FindContentForSubDocument(childDoc->DocumentNode());
     if (ownerContent) {
       Accessible* outerDocAcc = mDocument->GetAccessible(ownerContent);
       if (outerDocAcc && outerDocAcc->AppendChild(childDoc)) {
         if (mDocument->AppendChildDocument(childDoc)) {
-
+          newChildDocs.AppendElement(Move(mHangingChildDocuments[idx]));
           continue;
         }
 
         outerDocAcc->RemoveChild(childDoc);
       }
 
       // Failed to bind the child document, destroy it.
       childDoc->Shutdown();
     }
   }
 
-  nsTArray<nsRefPtr<DocAccessible>> newChildDocs = Move(mHangingChildDocuments);
+  mHangingChildDocuments.Clear();
 
   // If the document is ready and all its subdocuments are completely loaded
   // then process the document load.
   if (mDocument->HasLoadState(DocAccessible::eReady) &&
       !mDocument->HasLoadState(DocAccessible::eCompletelyLoaded) &&
       hangingDocCnt == 0) {
     uint32_t childDocCnt = mDocument->ChildDocumentCount(), childDocIdx = 0;
     for (; childDocIdx < childDocCnt; childDocIdx++) {
@@ -279,16 +280,17 @@ NotificationController::WillRefresh(mozi
     size_t newDocCount = newChildDocs.Length();
     for (size_t i = 0; i < newDocCount; i++) {
       DocAccessible* childDoc = newChildDocs[i];
       DocAccessibleChild* ipcDoc = new DocAccessibleChild(childDoc);
       childDoc->SetIPCDoc(ipcDoc);
       auto contentChild = dom::ContentChild::GetSingleton();
       DocAccessibleChild* parentIPCDoc = mDocument->IPCDoc();
       uint64_t id = reinterpret_cast<uintptr_t>(childDoc->Parent()->UniqueID());
+      MOZ_ASSERT(id);
       contentChild->SendPDocAccessibleConstructor(ipcDoc, parentIPCDoc, id);
     }
   }
 
   mObservingState = eRefreshObserving;
   if (!mDocument)
     return;