From e58d9a62b92009b592387dd80553ba891d14a1dc Mon Sep 17 00:00:00 2001 From: Trevor Saunders Date: Tue, 29 Oct 2013 17:22:41 -0400 Subject: [PATCH] bug 931399 - shutdown DocAccessible's when the related docshell is destroyed r=bz When we get to PresShell::Destroy the pres shell and document have already nulled out their poitners to the docshell which DocAccessible::Shutdown() needs to remove the document from the command observer. --- layout/base/nsDocumentViewer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 0035a2f0c66..a5eadd33539 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -33,6 +33,7 @@ #include "nsIDOMHTMLElement.h" #include "nsContentUtils.h" #include "nsLayoutStylesheetCache.h" +#include "mozilla/a11y/DocAccessible.h" #include "mozilla/BasicEvents.h" #include "mozilla/Preferences.h" #include "mozilla/dom/EncodingUtils.h" @@ -1549,6 +1550,16 @@ nsDocumentViewer::Destroy() // cache ourselves. shEntry->SyncPresentationState(); + // Shut down accessibility for the document before we start to tear it down. +#ifdef ACCESSIBILITY + if (mPresShell) { + a11y::DocAccessible* docAcc = mPresShell->GetDocAccessible(); + if (docAcc) { + docAcc->Shutdown(); + } + } +#endif + // Break the link from the document/presentation to the docshell, so that // link traversals cannot affect the currently-loaded document. // When the presentation is restored, Open() and InitInternal() will reset