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.
This commit is contained in:
Trevor Saunders 2013-10-29 17:22:41 -04:00
parent dc28fb0d43
commit e58d9a62b9

View File

@ -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