Skip to content

Commit

Permalink
Bug 1771934: Acquire the Android a11y lock in some additional places.…
Browse files Browse the repository at this point in the history
… r=eeejay

Differential Revision: https://phabricator.services.mozilla.com/D147854
  • Loading branch information
jcsteh committed Jun 7, 2022
1 parent 0f37ee0 commit 0c1571c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
9 changes: 9 additions & 0 deletions accessible/ipc/DocAccessibleParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,7 @@ mozilla::ipc::IPCResult DocAccessibleParent::RecvRoleChangedEvent(

mozilla::ipc::IPCResult DocAccessibleParent::RecvBindChildDoc(
PDocAccessibleParent* aChildDoc, const uint64_t& aID) {
ACQUIRE_ANDROID_LOCK
// One document should never directly be the child of another.
// We should always have at least an outer doc accessible in between.
MOZ_ASSERT(aID);
Expand Down Expand Up @@ -967,6 +968,14 @@ void DocAccessibleParent::Destroy() {
}
}

void DocAccessibleParent::ActorDestroy(ActorDestroyReason aWhy) {
MOZ_ASSERT(CheckDocTree());
if (!mShutdown) {
ACQUIRE_ANDROID_LOCK
Destroy();
}
}

DocAccessibleParent* DocAccessibleParent::ParentDoc() const {
if (mParentDoc == kNoParentDoc) {
return nullptr;
Expand Down
5 changes: 1 addition & 4 deletions accessible/ipc/DocAccessibleParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,10 +165,7 @@ class DocAccessibleParent : public RemoteAccessible,

virtual mozilla::ipc::IPCResult RecvShutdown() override;
void Destroy();
virtual void ActorDestroy(ActorDestroyReason aWhy) override {
MOZ_ASSERT(CheckDocTree());
if (!mShutdown) Destroy();
}
virtual void ActorDestroy(ActorDestroyReason aWhy) override;

/*
* Return the main processes representation of the parent document (if any)
Expand Down
5 changes: 5 additions & 0 deletions dom/ipc/BrowserBridgeParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

#ifdef ACCESSIBILITY
# include "mozilla/a11y/DocAccessibleParent.h"
# include "nsAccessibilityService.h"
#endif

#include "mozilla/Monitor.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/dom/BrowserBridgeParent.h"
#include "mozilla/dom/BrowserParent.h"
Expand Down Expand Up @@ -268,6 +270,9 @@ a11y::DocAccessibleParent* BrowserBridgeParent::GetDocAccessibleParent() {

IPCResult BrowserBridgeParent::RecvSetEmbedderAccessible(
PDocAccessibleParent* aDoc, uint64_t aID) {
# if defined(ANDROID)
MonitorAutoLock mal(nsAccessibilityService::GetAndroidMonitor());
# endif
MOZ_ASSERT(aDoc || mEmbedderAccessibleDoc,
"Embedder doc shouldn't be cleared if it wasn't set");
MOZ_ASSERT(!mEmbedderAccessibleDoc || !aDoc || mEmbedderAccessibleDoc == aDoc,
Expand Down

0 comments on commit 0c1571c

Please sign in to comment.