зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
f99391c4c3
Коммит
60b14922d8
|
@ -36,6 +36,8 @@ using namespace mozilla;
|
|||
using namespace mozilla::a11y;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
StaticAutoPtr<nsTArray<DocAccessibleParent*>> DocManager::sRemoteDocuments;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// DocManager
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -5,12 +5,14 @@
|
|||
#ifndef mozilla_a11_DocManager_h_
|
||||
#define mozilla_a11_DocManager_h_
|
||||
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsRefPtrHashtable.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
@ -74,20 +76,24 @@ public:
|
|||
/*
|
||||
* 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!");
|
||||
}
|
||||
|
||||
/*
|
||||
* 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),
|
||||
if (!sRemoteDocuments) {
|
||||
sRemoteDocuments = new nsTArray<DocAccessibleParent*>;
|
||||
ClearOnShutdown(&sRemoteDocuments);
|
||||
}
|
||||
MOZ_ASSERT(!sRemoteDocuments->Contains(aDoc),
|
||||
"How did we already have the doc!");
|
||||
mRemoteDocuments.AppendElement(aDoc);
|
||||
sRemoteDocuments->AppendElement(aDoc);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -176,7 +182,7 @@ private:
|
|||
/*
|
||||
* The list of remote top level documents.
|
||||
*/
|
||||
nsTArray<DocAccessibleParent*> mRemoteDocuments;
|
||||
static StaticAutoPtr<nsTArray<DocAccessibleParent*>> sRemoteDocuments;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -2868,7 +2868,7 @@ ContentParent::RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc, PDocAcc
|
|||
return parentDoc->AddChildDoc(doc, aParentID);
|
||||
} else {
|
||||
MOZ_ASSERT(!aParentID);
|
||||
GetAccService()->RemoteDocAdded(doc);
|
||||
a11y::DocManager::RemoteDocAdded(doc);
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
|
|
Загрузка…
Ссылка в новой задаче