bug 1088148 - Notify the main process of new child docs after firing events r=davidb

If we notify the parent process about new child documents before we
notify it of events it is possible the parent process's tree is out of
sync with ours, and doesn't contain the outer doc accessible for the new
document.  SO we need to first notify the parent of changes in the
accessible tree for the document, and then we can notify it of new child
documents.  We must also make sure when we serialize a subtree that is
being created to not include the sub document or its accessible tree.
This commit is contained in:
Trevor Saunders
2014-10-28 14:18:03 -04:00
parent a42ea8a08a
commit d2ea896f31
2 changed files with 22 additions and 10 deletions

View File

@@ -220,15 +220,6 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
Accessible* outerDocAcc = mDocument->GetAccessible(ownerContent);
if (outerDocAcc && outerDocAcc->AppendChild(childDoc)) {
if (mDocument->AppendChildDocument(childDoc)) {
if (IPCAccessibilityActive()) {
DocAccessibleChild* ipcDoc = new DocAccessibleChild(childDoc);
childDoc->SetIPCDoc(ipcDoc);
auto contentChild = dom::ContentChild::GetSingleton();
DocAccessibleChild* parentIPCDoc = mDocument->IPCDoc();
uint64_t id = reinterpret_cast<uintptr_t>(outerDocAcc->UniqueID());
contentChild->SendPDocAccessibleConstructor(ipcDoc, parentIPCDoc,
id);
}
continue;
}
@@ -240,7 +231,8 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
childDoc->Shutdown();
}
}
mHangingChildDocuments.Clear();
nsTArray<nsRefPtr<DocAccessible>> newChildDocs = Move(mHangingChildDocuments);
// If the document is ready and all its subdocuments are completely loaded
// then process the document load.
@@ -282,6 +274,20 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
mObservingState = eRefreshProcessing;
ProcessEventQueue();
if (IPCAccessibilityActive()) {
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());
contentChild->SendPDocAccessibleConstructor(ipcDoc, parentIPCDoc, id);
}
}
mObservingState = eRefreshObserving;
if (!mDocument)
return;