Backed out 4 changesets (bug 1553706, bug 1543313) for failures in DocAccessibleChild.cpp

Backed out changeset 1a8bea02205d (bug 1553706)
Backed out changeset 15f3e6bb3ba9 (bug 1543313)
Backed out changeset 30b106088985 (bug 1543313)
Backed out changeset 85d11dab6b63 (bug 1543313)
This commit is contained in:
Noemi Erli 2019-05-31 06:24:44 +03:00
Родитель 0ebdc5cd60
Коммит d831a07840
6 изменённых файлов: 29 добавлений и 114 удалений

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

@ -36,7 +36,7 @@ OuterDocAccessible::OuterDocAccessible(nsIContent* aContent,
#ifdef XP_WIN
if (DocAccessibleParent* remoteDoc = RemoteChildDoc()) {
remoteDoc->SendParentCOMProxy(this);
remoteDoc->SendParentCOMProxy();
}
#endif

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

@ -557,10 +557,6 @@ ipc::IPCResult DocAccessibleParent::AddChildDoc(DocAccessibleParent* aChildDoc,
mDocProxyStream = docHolder.GetPreservedStream();
# endif // defined(MOZ_SANDBOX)
}
// Send a COM proxy for the embedder OuterDocAccessible to the embedded
// document process. This will be returned as the parent of the
// embedded document.
aChildDoc->SendParentCOMProxy(WrapperFor(outerDoc));
}
#endif // defined(XP_WIN)
@ -738,7 +734,10 @@ void DocAccessibleParent::MaybeInitWindowEmulation() {
MOZ_ASSERT(hWnd);
}
void DocAccessibleParent::SendParentCOMProxy(Accessible* aOuterDoc) {
/**
* @param aCOMProxy COM Proxy to the document in the content process.
*/
void DocAccessibleParent::SendParentCOMProxy() {
// Make sure that we're not racing with a tab shutdown
auto tab = static_cast<dom::BrowserParent*>(Manager());
MOZ_ASSERT(tab);
@ -746,8 +745,13 @@ void DocAccessibleParent::SendParentCOMProxy(Accessible* aOuterDoc) {
return;
}
Accessible* outerDoc = OuterDocOfRemoteBrowser();
if (!outerDoc) {
return;
}
RefPtr<IAccessible> nativeAcc;
aOuterDoc->GetNativeInterface(getter_AddRefs(nativeAcc));
outerDoc->GetNativeInterface(getter_AddRefs(nativeAcc));
MOZ_ASSERT(nativeAcc);
RefPtr<IDispatch> wrapped(

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

@ -36,7 +36,6 @@ class DocAccessibleParent : public ProxyAccessible,
mEmulatedWindowHandle(nullptr),
#endif // defined(XP_WIN)
mTopLevel(false),
mTopLevelInContentProcess(false),
mShutdown(false) {
sMaxDocID++;
mActorID = sMaxDocID;
@ -44,27 +43,9 @@ class DocAccessibleParent : public ProxyAccessible,
LiveDocs().Put(mActorID, this);
}
/**
* Set this as a top level document; i.e. it is not embedded by another remote
* document. This also means it is a top level document in its content
* process.
* Tab documents are top level documents.
*/
void SetTopLevel() {
mTopLevel = true;
mTopLevelInContentProcess = true;
}
void SetTopLevel() { mTopLevel = true; }
bool IsTopLevel() const { return mTopLevel; }
/**
* Set this as a top level document in its content process.
* Note that this could be an out-of-process iframe embedded by a remote
* embedder document. In that case, IsToplevel() will return false, but
* IsTopLevelInContentProcess() will return true.
*/
void SetTopLevelInContentProcess() { mTopLevelInContentProcess = true; }
bool IsTopLevelInContentProcess() const { return mTopLevelInContentProcess; }
bool IsShutdown() const { return mShutdown; }
/**
@ -216,13 +197,7 @@ class DocAccessibleParent : public ProxyAccessible,
#if defined(XP_WIN)
void MaybeInitWindowEmulation();
/**
* @param aOuterDoc The OuterDocAccessible to be returned as the parent of
* this document. Only GetNativeInterface() is called on this, so it
* may be a ProxyAccessibleWrap or similar.
*/
void SendParentCOMProxy(Accessible* aOuterDoc);
void SendParentCOMProxy();
virtual mozilla::ipc::IPCResult RecvGetWindowedPluginIAccessible(
const WindowsHandle& aHwnd, IAccessibleHolder* aPluginCOMProxy) override;
@ -304,7 +279,6 @@ class DocAccessibleParent : public ProxyAccessible,
nsTHashtable<ProxyEntry> mAccessibles;
uint64_t mActorID;
bool mTopLevel;
bool mTopLevelInContentProcess;
bool mShutdown;
static uint64_t sMaxDocID;

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

@ -35,7 +35,6 @@
#include "nsIScrollableFrame.h"
#include "mozilla/PresShell.h"
#include "mozilla/dom/NodeInfo.h"
#include "mozilla/dom/BrowserBridgeParent.h"
#include "mozilla/dom/BrowserParent.h"
#include "nsIServiceManager.h"
#include "nsNameSpaceManager.h"
@ -1306,15 +1305,15 @@ static already_AddRefed<IDispatch> GetProxiedAccessibleInSubtree(
auto wrapper = static_cast<DocProxyAccessibleWrap*>(WrapperFor(aDoc));
RefPtr<IAccessible> comProxy;
int32_t docWrapperChildId = AccessibleWrap::GetChildIDFor(wrapper);
// Only document accessible proxies at the top level of their content process
// are created with a pointer to their COM proxy.
if (aDoc->IsTopLevelInContentProcess()) {
// Only top level document accessible proxies are created with a pointer to
// their COM proxy.
if (aDoc->IsTopLevel()) {
wrapper->GetNativeInterface(getter_AddRefs(comProxy));
} else {
auto tab = static_cast<dom::BrowserParent*>(aDoc->Manager());
MOZ_ASSERT(tab);
DocAccessibleParent* topLevelDoc = tab->GetTopLevelDocAccessible();
MOZ_ASSERT(topLevelDoc && topLevelDoc->IsTopLevelInContentProcess());
MOZ_ASSERT(topLevelDoc && topLevelDoc->IsTopLevel());
VARIANT docId = {{{VT_I4}}};
docId.lVal = docWrapperChildId;
RefPtr<IDispatch> disp = GetProxiedAccessibleInSubtree(topLevelDoc, docId);
@ -1479,40 +1478,6 @@ already_AddRefed<IAccessible> AccessibleWrap::GetIAccessibleFor(
return nullptr;
}
/**
* Visit DocAccessibleParent descendants of `aBrowser` that are at the top
* level of their content process.
* That is, IsTopLevelInContentProcess() will be true for each visited actor.
* Each visited actor will be an embedded document in a different content
* process to its embedder.
* The DocAccessibleParent for `aBrowser` itself is excluded.
* `aCallback` will be called for each DocAccessibleParent.
* The callback should return true to continue traversal, false to cease.
*/
template <typename Callback>
static bool VisitDocAccessibleParentDescendantsAtTopLevelInContentProcess(
dom::BrowserParent* aBrowser, Callback aCallback) {
// We can't use BrowserBridgeParent::VisitAllDescendants because it doesn't
// provide a way to stop the search.
const auto& bridges = aBrowser->ManagedPBrowserBridgeParent();
for (auto iter = bridges.ConstIter(); !iter.Done(); iter.Next()) {
auto bridge = static_cast<dom::BrowserBridgeParent*>(iter.Get()->GetKey());
dom::BrowserParent* childBrowser = bridge->GetBrowserParent();
DocAccessibleParent* childDocAcc = childBrowser->GetTopLevelDocAccessible();
if (!childDocAcc) {
continue;
}
if (!aCallback(childDocAcc)) {
return false; // Stop traversal.
}
if (!VisitDocAccessibleParentDescendantsAtTopLevelInContentProcess(
childBrowser, aCallback)) {
return false; // Stop traversal.
}
}
return true; // Continue traversal.
}
already_AddRefed<IAccessible> AccessibleWrap::GetRemoteIAccessibleFor(
const VARIANT& aVarChild) {
a11y::RootAccessible* root = RootAccessible();
@ -1528,9 +1493,14 @@ already_AddRefed<IAccessible> AccessibleWrap::GetRemoteIAccessibleFor(
// condition because it is possible for reentry to occur in the call to
// GetProxiedAccessibleInSubtree() such that remoteDocs->Length() is mutated.
for (size_t i = 0; i < remoteDocs->Length(); i++) {
DocAccessibleParent* topRemoteDoc = remoteDocs->ElementAt(i);
DocAccessibleParent* remoteDoc = remoteDocs->ElementAt(i);
Accessible* outerDoc = topRemoteDoc->OuterDocOfRemoteBrowser();
uint32_t remoteDocMsaaId = WrapperFor(remoteDoc)->GetExistingID();
if (!sIDGen.IsSameContentProcessFor(aVarChild.lVal, remoteDocMsaaId)) {
continue;
}
Accessible* outerDoc = remoteDoc->OuterDocOfRemoteBrowser();
if (!outerDoc) {
continue;
}
@ -1539,28 +1509,8 @@ already_AddRefed<IAccessible> AccessibleWrap::GetRemoteIAccessibleFor(
continue;
}
RefPtr<IDispatch> disp;
auto checkDoc = [&aVarChild,
&disp](DocAccessibleParent* aRemoteDoc) -> bool {
uint32_t remoteDocMsaaId = WrapperFor(aRemoteDoc)->GetExistingID();
if (!sIDGen.IsSameContentProcessFor(aVarChild.lVal, remoteDocMsaaId)) {
return true; // Continue the search.
}
if ((disp = GetProxiedAccessibleInSubtree(aRemoteDoc, aVarChild))) {
return false; // Found it! Stop traversal!
}
return true; // Continue the search.
};
// Check the top level document for this id.
checkDoc(topRemoteDoc);
if (!disp) {
// The top level document doesn't contain this id. Recursively check any
// out-of-process iframe documents it embeds.
VisitDocAccessibleParentDescendantsAtTopLevelInContentProcess(
static_cast<dom::BrowserParent*>(topRemoteDoc->Manager()), checkDoc);
}
RefPtr<IDispatch> disp =
GetProxiedAccessibleInSubtree(remoteDoc, aVarChild);
if (!disp) {
continue;
}

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

@ -415,11 +415,7 @@ a11y::DocAccessibleParent* BrowserParent::GetTopLevelDocAccessible() const {
ManagedPDocAccessibleParent();
for (auto iter = docs.ConstIter(); !iter.Done(); iter.Next()) {
auto doc = static_cast<a11y::DocAccessibleParent*>(iter.Get()->GetKey());
// We want the document for this BrowserParent even if it's for an
// embedded out-of-process iframe. Therefore, we use
// IsTopLevelInContentProcess. In contrast, using IsToplevel would only
// include documents that aren't embedded; e.g. tab documents.
if (doc->IsTopLevelInContentProcess()) {
if (doc->IsTopLevel()) {
return doc;
}
}
@ -1130,7 +1126,6 @@ mozilla::ipc::IPCResult BrowserParent::RecvPDocAccessibleConstructor(
// In this case, we don't get aParentDoc and aParentID.
MOZ_ASSERT(!aParentDoc && !aParentID);
MOZ_ASSERT(embedderID);
doc->SetTopLevelInContentProcess();
# ifdef XP_WIN
MOZ_ASSERT(!aDocCOMProxy.IsNull());
RefPtr<IAccessible> proxy(aDocCOMProxy.Get());
@ -1145,7 +1140,6 @@ mozilla::ipc::IPCResult BrowserParent::RecvPDocAccessibleConstructor(
# endif
}
# ifdef XP_WIN
a11y::WrapperFor(doc)->SetID(aMsaaID);
if (a11y::nsWinUtils::IsWindowEmulationStarted()) {
doc->SetEmulatedWindowHandle(embedderDoc->GetEmulatedWindowHandle());
}
@ -1169,9 +1163,7 @@ mozilla::ipc::IPCResult BrowserParent::RecvPDocAccessibleConstructor(
RefPtr<IAccessible> proxy(aDocCOMProxy.Get());
doc->SetCOMInterface(proxy);
doc->MaybeInitWindowEmulation();
if (a11y::Accessible* outerDoc = doc->OuterDocOfRemoteBrowser()) {
doc->SendParentCOMProxy(outerDoc);
}
doc->SendParentCOMProxy();
# endif
}
#endif

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

@ -162,12 +162,7 @@ class BrowserParent final : public PBrowserParent,
nsIXULBrowserWindow* GetXULBrowserWindow();
/**
* Return the top level DocAccessibleParent for this BrowserParent.
* Note that in the case of an out-of-process iframe, the returned actor
* might not be at the top level of the DocAccessibleParent tree; i.e. it
* might have a parent. However, it will be at the top level in its content
* process. That is, doc->IsTopLevelInContentProcess() will always be true,
* but doc->IsTopLevel() might not.
* Return the top level doc accessible parent for this tab.
*/
a11y::DocAccessibleParent* GetTopLevelDocAccessible() const;