Bug 1558390: For OOP iframes, also send the embedder accessible when the BrowserBridgeChild is created. r=yzen,nika

Previously, BrowserBridgeChild::SendSetEmbedderAccessible was only called when an OuterDocAccessible was constructed.
However, it's also possible that the BrowserBridgeChild is created *after* the OuterDocAccessible.
Therefore, we must also do this when a BrowserBridgeChild is created if the OuterDocAccessible already exists.

Differential Revision: https://phabricator.services.mozilla.com/D34474

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Teh 2019-06-13 02:19:42 +00:00
Родитель b402df7ecd
Коммит 788fa105b8
5 изменённых файлов: 46 добавлений и 8 удалений

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

@ -20,6 +20,7 @@ class Selection;
namespace a11y {
class DocAccessible;
class EventQueue;
// Constants used to point whether the event is from user input.
enum EIsFromUserInput {

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

@ -37,14 +37,8 @@ OuterDocAccessible::OuterDocAccessible(nsIContent* aContent,
if (IPCAccessibilityActive()) {
auto bridge = dom::BrowserBridgeChild::GetFrom(aContent);
if (bridge) {
// This is an iframe which will be rendered in another process. Tell the
// parent process the iframe accessible so it can link the
// trees together when the iframe document is added.
DocAccessibleChild* ipcDoc = aDoc->IPCDoc();
if (ipcDoc) {
uint64_t id = reinterpret_cast<uintptr_t>(UniqueID());
bridge->SendSetEmbedderAccessible(ipcDoc, id);
}
// This is an iframe which will be rendered in another process.
SendEmbedderAccessible(bridge);
}
}
@ -59,6 +53,16 @@ OuterDocAccessible::OuterDocAccessible(nsIContent* aContent,
OuterDocAccessible::~OuterDocAccessible() {}
void OuterDocAccessible::SendEmbedderAccessible(
dom::BrowserBridgeChild* aBridge) {
MOZ_ASSERT(mDoc);
DocAccessibleChild* ipcDoc = mDoc->IPCDoc();
if (ipcDoc) {
uint64_t id = reinterpret_cast<uintptr_t>(UniqueID());
aBridge->SendSetEmbedderAccessible(ipcDoc, id);
}
}
////////////////////////////////////////////////////////////////////////////////
// Accessible public (DON'T add methods here)

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

@ -9,6 +9,11 @@
#include "AccessibleWrap.h"
namespace mozilla {
namespace dom {
class BrowserBridgeChild;
}
namespace a11y {
class DocAccessibleParent;
@ -32,6 +37,16 @@ class OuterDocAccessible final : public AccessibleWrap {
Accessible* RemoteChildDocAccessible() const;
#endif
/**
* For iframes in a content process which will be rendered in another content
* process, tell the parent process about this OuterDocAccessible
* so it can link the trees together when the embedded document is added.
* Note that an OuterDocAccessible can be created before the
* BrowserBridgeChild or vice versa. Therefore, this must be conditionally
* called when either of these is created.
*/
void SendEmbedderAccessible(dom::BrowserBridgeChild* aBridge);
// Accessible
virtual void Shutdown() override;
virtual mozilla::a11y::role NativeRole() const override;

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

@ -8,6 +8,7 @@ EXPORTS.mozilla.a11y += [
'Accessible.h',
'DocAccessible.h',
'HyperTextAccessible.h',
'OuterDocAccessible.h',
]
UNIFIED_SOURCES += [

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

@ -225,6 +225,9 @@
# ifdef XP_WIN
# include "mozilla/a11y/AccessibleWrap.h"
# endif
# include "mozilla/a11y/DocAccessible.h"
# include "mozilla/a11y/DocManager.h"
# include "mozilla/a11y/OuterDocAccessible.h"
#endif
#include "mozilla/dom/File.h"
@ -2067,6 +2070,20 @@ already_AddRefed<RemoteBrowser> ContentChild::CreateBrowser(
aBrowsingContext, chromeFlags, tabId);
browserBridge->mIPCOpen = true;
#if defined(ACCESSIBILITY)
a11y::DocAccessible* docAcc =
a11y::GetExistingDocAccessible(owner->OwnerDoc());
if (docAcc) {
a11y::Accessible* ownerAcc = docAcc->GetAccessible(owner);
if (ownerAcc) {
a11y::OuterDocAccessible* outerAcc = ownerAcc->AsOuterDoc();
if (outerAcc) {
outerAcc->SendEmbedderAccessible(browserBridge);
}
}
}
#endif // defined(ACCESSIBILITY)
RefPtr<BrowserBridgeHost> browserBridgeHost =
new BrowserBridgeHost(browserBridge);
return browserBridgeHost.forget();