mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1128751 - handle unbinding and rebinding of documents in content processes r=davidb
The code for managing document lifetimes assumed documents could not be rebound to parents, however that is not the case.
This commit is contained in:
parent
473f2ceb3c
commit
f8ab3722d7
@ -280,12 +280,19 @@ NotificationController::WillRefresh(mozilla::TimeStamp aTime)
|
||||
size_t newDocCount = newChildDocs.Length();
|
||||
for (size_t i = 0; i < newDocCount; i++) {
|
||||
DocAccessible* childDoc = newChildDocs[i];
|
||||
DocAccessibleChild* ipcDoc = new DocAccessibleChild(childDoc);
|
||||
Accessible* parent = childDoc->Parent();
|
||||
DocAccessibleChild* parentIPCDoc = mDocument->IPCDoc();
|
||||
uint64_t id = reinterpret_cast<uintptr_t>(parent->UniqueID());
|
||||
MOZ_ASSERT(id);
|
||||
DocAccessibleChild* ipcDoc = childDoc->IPCDoc();
|
||||
if (ipcDoc) {
|
||||
parentIPCDoc->SendBindChildDoc(ipcDoc, id);
|
||||
continue;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -279,8 +279,6 @@ GetAccService()
|
||||
inline bool
|
||||
IPCAccessibilityActive()
|
||||
{
|
||||
// XXX reenable when crashes are fixed
|
||||
return false;
|
||||
#ifdef MOZ_B2G
|
||||
return false;
|
||||
#else
|
||||
|
@ -137,9 +137,19 @@ DocAccessibleParent::RecvEvent(const uint64_t& aID, const uint32_t& aEventType)
|
||||
ProxyEvent(e->mProxy, aEventType);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleParent::RecvBindChildDoc(PDocAccessibleParent* aChildDoc, const uint64_t& aID)
|
||||
{
|
||||
auto childDoc = static_cast<DocAccessibleParent*>(aChildDoc);
|
||||
DebugOnly<bool> result = AddChildDoc(childDoc, aID, false);
|
||||
MOZ_ASSERT(result);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
|
||||
uint64_t aParentID)
|
||||
uint64_t aParentID, bool aCreating)
|
||||
{
|
||||
ProxyAccessible* outerDoc = mAccessibles.GetEntry(aParentID)->mProxy;
|
||||
if (!outerDoc)
|
||||
@ -149,7 +159,11 @@ DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
|
||||
outerDoc->SetChildDoc(aChildDoc);
|
||||
mChildDocs.AppendElement(aChildDoc);
|
||||
aChildDoc->mParentDoc = this;
|
||||
ProxyCreated(aChildDoc, 0);
|
||||
|
||||
if (aCreating) {
|
||||
ProxyCreated(aChildDoc, 0);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,14 @@ public:
|
||||
virtual bool RecvShowEvent(const ShowEventData& aData) override;
|
||||
virtual bool RecvHideEvent(const uint64_t& aRootID) override;
|
||||
|
||||
virtual bool RecvBindChildDoc(PDocAccessibleParent* aChildDoc, const uint64_t& aID) override;
|
||||
void Unbind()
|
||||
{
|
||||
mParent = nullptr;
|
||||
mParentDoc->mChildDocs.RemoveElement(this);
|
||||
mParentDoc = nullptr;
|
||||
}
|
||||
|
||||
void Destroy();
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) override
|
||||
{
|
||||
@ -62,7 +70,8 @@ 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);
|
||||
bool AddChildDoc(DocAccessibleParent* aChildDoc, uint64_t aParentID,
|
||||
bool aCreating = true);
|
||||
|
||||
/*
|
||||
* Called when the document in the content process this object represents
|
||||
|
@ -57,6 +57,12 @@ parent:
|
||||
ShowEvent(ShowEventData data);
|
||||
HideEvent(uint64_t aRootID);
|
||||
|
||||
/*
|
||||
* Tell the parent document to bind the existing document as a new child
|
||||
* document.
|
||||
*/
|
||||
BindChildDoc(PDocAccessible aChildDoc, uint64_t aID);
|
||||
|
||||
child:
|
||||
// Accessible
|
||||
prio(high) sync State(uint64_t aID) returns(uint64_t states);
|
||||
|
@ -29,7 +29,7 @@ ProxyAccessible::Shutdown()
|
||||
if (mChildren.Length() != 1)
|
||||
MOZ_CRASH("outer doc doesn't own adoc!");
|
||||
|
||||
static_cast<DocAccessibleParent*>(mChildren[0])->Destroy();
|
||||
static_cast<DocAccessibleParent*>(mChildren[0])->Unbind();
|
||||
}
|
||||
|
||||
mChildren.Clear();
|
||||
|
Loading…
Reference in New Issue
Block a user