From 2d06b997a38a5d9001f1c9f36174c515215556f0 Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Fri, 11 Sep 2015 15:22:51 -0400 Subject: [PATCH] bug 1204070 - add a little more checking to proxy subtree removal r=davidb --- accessible/ipc/DocAccessibleParent.cpp | 7 +++++++ accessible/ipc/DocAccessibleParent.h | 2 +- accessible/ipc/ProxyAccessible.cpp | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/accessible/ipc/DocAccessibleParent.cpp b/accessible/ipc/DocAccessibleParent.cpp index a847c36836c..6213a20794f 100644 --- a/accessible/ipc/DocAccessibleParent.cpp +++ b/accessible/ipc/DocAccessibleParent.cpp @@ -106,6 +106,13 @@ DocAccessibleParent::RecvHideEvent(const uint64_t& aRootID) MOZ_DIAGNOSTIC_ASSERT(CheckDocTree()); + // We shouldn't actually need this because mAccessibles shouldn't have an + // entry for the document itself, but it doesn't hurt to be explicit. + if (!aRootID) { + NS_ERROR("trying to hide entire document?"); + return false; + } + ProxyEntry* rootEntry = mAccessibles.GetEntry(aRootID); if (!rootEntry) { NS_ERROR("invalid root being removed!"); diff --git a/accessible/ipc/DocAccessibleParent.h b/accessible/ipc/DocAccessibleParent.h index f9e6cc53c87..f905ea603a5 100644 --- a/accessible/ipc/DocAccessibleParent.h +++ b/accessible/ipc/DocAccessibleParent.h @@ -104,7 +104,7 @@ public: void RemoveAccessible(ProxyAccessible* aAccessible) { - MOZ_ASSERT(mAccessibles.GetEntry(aAccessible->ID())); + MOZ_DIAGNOSTIC_ASSERT(mAccessibles.GetEntry(aAccessible->ID())); mAccessibles.RemoveEntry(aAccessible->ID()); } diff --git a/accessible/ipc/ProxyAccessible.cpp b/accessible/ipc/ProxyAccessible.cpp index 8c7fd97a603..096ecf5cd21 100644 --- a/accessible/ipc/ProxyAccessible.cpp +++ b/accessible/ipc/ProxyAccessible.cpp @@ -21,6 +21,7 @@ namespace a11y { void ProxyAccessible::Shutdown() { + MOZ_DIAGNOSTIC_ASSERT(!IsDoc()); NS_ASSERTION(!mOuterDoc, "Why do we still have a child doc?"); // XXX Ideally this wouldn't be necessary, but it seems OuterDoc accessibles