Commit a6a90b66 authored by James Teh's avatar James Teh
Browse files

Bug 1771934: Acquire the Android a11y lock in some additional places. r=eeejay a=pascalc

parent ea2a0f8b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -687,6 +687,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);
@@ -932,6 +933,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;
+1 −4
Original line number Diff line number Diff line
@@ -172,10 +172,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)
+5 −0
Original line number Diff line number Diff line
@@ -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"
@@ -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,