bug 1098386 - Allow PDocAccessibleConstructor to be recieved when gAccessibilityService doesn't exist r=surkov

Talos causes accessibility to be instantiated only in the content
process.  That means PDocAccessibleConstructor messages can be recieved
by the parent when GetAccService() returns null.  The easiest way of
dealing with this is moving DocManager::mRemoteDocuments from a member
of the acc service singleton to its own global.  That means the parent
process can track accessible documents in child processes without
instantiating a11y in the parent process.
This commit is contained in:
Trevor Saunders 2014-12-08 20:08:15 -05:00
parent 9fae9e4367
commit 429fb6858c
3 changed files with 9 additions and 7 deletions

View File

@ -36,6 +36,8 @@ using namespace mozilla;
using namespace mozilla::a11y; using namespace mozilla::a11y;
using namespace mozilla::dom; using namespace mozilla::dom;
nsTArray<DocAccessibleParent*> DocManager::sRemoteDocuments;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// DocManager // DocManager
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////

View File

@ -74,20 +74,20 @@ public:
/* /*
* Notification that a top level document in a content process has gone away. * Notification that a top level document in a content process has gone away.
*/ */
void RemoteDocShutdown(DocAccessibleParent* aDoc) static void RemoteDocShutdown(DocAccessibleParent* aDoc)
{ {
DebugOnly<bool> result = mRemoteDocuments.RemoveElement(aDoc); DebugOnly<bool> result = sRemoteDocuments.RemoveElement(aDoc);
MOZ_ASSERT(result, "Why didn't we find the document!"); MOZ_ASSERT(result, "Why didn't we find the document!");
} }
/* /*
* Notify of a new top level document in a content process. * Notify of a new top level document in a content process.
*/ */
void RemoteDocAdded(DocAccessibleParent* aDoc) static void RemoteDocAdded(DocAccessibleParent* aDoc)
{ {
MOZ_ASSERT(!mRemoteDocuments.Contains(aDoc), MOZ_ASSERT(!sRemoteDocuments.Contains(aDoc),
"How did we already have the doc!"); "How did we already have the doc!");
mRemoteDocuments.AppendElement(aDoc); sRemoteDocuments.AppendElement(aDoc);
} }
#ifdef DEBUG #ifdef DEBUG
@ -176,7 +176,7 @@ private:
/* /*
* The list of remote top level documents. * The list of remote top level documents.
*/ */
nsTArray<DocAccessibleParent*> mRemoteDocuments; static nsTArray<DocAccessibleParent*> sRemoteDocuments;
}; };
/** /**

View File

@ -2864,7 +2864,7 @@ ContentParent::RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc, PDocAcc
return parentDoc->AddChildDoc(doc, aParentID); return parentDoc->AddChildDoc(doc, aParentID);
} else { } else {
MOZ_ASSERT(!aParentID); MOZ_ASSERT(!aParentID);
GetAccService()->RemoteDocAdded(doc); a11y::DocManager::RemoteDocAdded(doc);
} }
#endif #endif
return true; return true;