bug 1110510 - make sure to create and destroy proxies for documents r=surkov

This commit is contained in:
Trevor Saunders 2014-12-11 17:36:59 -05:00
Родитель 60b14922d8
Коммит b750b23370
5 изменённых файлов: 48 добавлений и 32 удалений

Просмотреть файл

@ -9,7 +9,9 @@
#include "ARIAMap.h"
#include "DocAccessible-inl.h"
#include "DocAccessibleChild.h"
#include "DocAccessibleParent.h"
#include "nsAccessibilityService.h"
#include "Platform.h"
#include "RootAccessibleWrap.h"
#include "xpcAccessibleDocument.h"
@ -535,3 +537,17 @@ DocManager::SearchIfDocIsRefreshing(const nsIDocument* aKey,
return PL_DHASH_NEXT;
}
#endif
void
DocManager::RemoteDocAdded(DocAccessibleParent* aDoc)
{
if (!sRemoteDocuments) {
sRemoteDocuments = new nsTArray<DocAccessibleParent*>;
ClearOnShutdown(&sRemoteDocuments);
}
MOZ_ASSERT(!sRemoteDocuments->Contains(aDoc),
"How did we already have the doc!");
sRemoteDocuments->AppendElement(aDoc);
ProxyCreated(aDoc);
}

Просмотреть файл

@ -85,16 +85,7 @@ public:
/*
* Notify of a new top level document in a content process.
*/
static void RemoteDocAdded(DocAccessibleParent* aDoc)
{
if (!sRemoteDocuments) {
sRemoteDocuments = new nsTArray<DocAccessibleParent*>;
ClearOnShutdown(&sRemoteDocuments);
}
MOZ_ASSERT(!sRemoteDocuments->Contains(aDoc),
"How did we already have the doc!");
sRemoteDocuments->AppendElement(aDoc);
}
static void RemoteDocAdded(DocAccessibleParent* aDoc);
#ifdef DEBUG
bool IsProcessingRefreshDriverNotification() const;

Просмотреть файл

@ -130,5 +130,30 @@ DocAccessibleParent::RecvEvent(const uint64_t& aID, const uint32_t& aEventType)
ProxyEvent(e->mProxy, aEventType);
return true;
}
bool
DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
uint64_t aParentID)
{
ProxyAccessible* outerDoc = mAccessibles.GetEntry(aParentID)->mProxy;
if (!outerDoc)
return false;
aChildDoc->mParent = outerDoc;
outerDoc->SetChildDoc(aChildDoc);
mChildDocs.AppendElement(aChildDoc);
aChildDoc->mParentDoc = this;
ProxyCreated(aChildDoc);
return true;
}
void
DocAccessibleParent::ActorDestroy(ActorDestroyReason aWhy)
{
ProxyDestroyed(this);
MOZ_ASSERT(mChildDocs.IsEmpty(),
"why wheren't the child docs destroyed already?");
mParentDoc ? mParentDoc->RemoveChildDoc(this)
: GetAccService()->RemoteDocShutdown(this);
}
}
}

Просмотреть файл

@ -26,7 +26,7 @@ class DocAccessibleParent : public ProxyAccessible,
{
public:
DocAccessibleParent() :
mParentDoc(nullptr)
ProxyAccessible(this), mParentDoc(nullptr)
{ MOZ_COUNT_CTOR_INHERITED(DocAccessibleParent, ProxyAccessible); }
~DocAccessibleParent()
{
@ -45,13 +45,7 @@ public:
virtual bool RecvShowEvent(const ShowEventData& aData) MOZ_OVERRIDE;
virtual bool RecvHideEvent(const uint64_t& aRootID) MOZ_OVERRIDE;
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE
{
MOZ_ASSERT(mChildDocs.IsEmpty(),
"why wheren't the child docs destroyed already?");
mParentDoc ? mParentDoc->RemoveChildDoc(this)
: GetAccService()->RemoteDocShutdown(this);
}
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
/*
* Return the main processes representation of the parent document (if any)
@ -63,18 +57,7 @@ public:
* Called when a document in a content process notifies the main process of a
* new child document.
*/
bool AddChildDoc(DocAccessibleParent* aChildDoc, uint64_t aParentID)
{
ProxyAccessible* outerDoc = mAccessibles.GetEntry(aParentID)->mProxy;
if (!outerDoc)
return false;
aChildDoc->mParent = outerDoc;
outerDoc->SetChildDoc(aChildDoc);
mChildDocs.AppendElement(aChildDoc);
aChildDoc->mParentDoc = this;
return true;
}
bool AddChildDoc(DocAccessibleParent* aChildDoc, uint64_t aParentID);
/*
* Called when the document in the content process this object represents

Просмотреть файл

@ -86,8 +86,9 @@ public:
uint64_t ID() const { return mID; }
protected:
ProxyAccessible() :
mParent(nullptr), mDoc(nullptr), mWrapper(0), mID(0)
ProxyAccessible(DocAccessibleParent* aThisAsDoc) :
mParent(nullptr), mDoc(aThisAsDoc), mWrapper(0), mID(0),
mRole(roles::DOCUMENT)
{ MOZ_COUNT_CTOR(ProxyAccessible); }
protected: