bug 931399 - shutdown DocAccessible's when the related docshell is destroyed r=bz
authorTrevor Saunders <trev.saunders@gmail.com>
Tue, 29 Oct 2013 17:22:41 -0400
changeset 153594 0b1d63d30f0a5b33c387578649b0981d2d94c29a
parent 153593 81175b9cddcf8273b9b9b60584d8a6e5d085c6d1
child 153595 66fe02c5c163e1b5eb5f7fd8242e3136e824dd2d
push id35848
push usertrev.saunders@gmail.com
push dateTue, 05 Nov 2013 19:27:28 +0000
treeherdermozilla-inbound@0b1d63d30f0a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbz
bugs931399
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 931399 - shutdown DocAccessible's when the related docshell is destroyed r=bz
accessible/src/windows/msaa/IUnknownImpl.h
layout/base/nsDocumentViewer.cpp
--- a/accessible/src/windows/msaa/IUnknownImpl.h
+++ b/accessible/src/windows/msaa/IUnknownImpl.h
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. *
  */
 
 #ifndef mozilla_a11y_IUnknownImpl_h_
 #define mozilla_a11y_IUnknownImpl_h_
 
 #include <windows.h>
+#undef CreateEvent // thank you windows you're such a helper
 #include "nsError.h"
 
 // Avoid warning C4509 like "nonstandard extension used:
 // 'AccessibleWrap::[acc_getName]' uses SEH and 'name' has destructor.
 // At this point we're catching a crash which is of much greater
 // importance than the missing dereference for the nsCOMPtr<>
 #ifdef _MSC_VER
 #pragma warning( disable : 4509 )
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -28,16 +28,19 @@
 #include "nsILinkHandler.h"
 #include "nsIDOMDocument.h"
 #include "nsISelectionListener.h"
 #include "nsISelectionPrivate.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMHTMLElement.h"
 #include "nsContentUtils.h"
 #include "nsLayoutStylesheetCache.h"
+#ifdef ACCESSIBILITY
+#include "mozilla/a11y/DocAccessible.h"
+#endif
 #include "mozilla/BasicEvents.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/EncodingUtils.h"
 
 #include "nsViewManager.h"
 #include "nsView.h"
 
 #include "nsIPageSequenceFrame.h"
@@ -1544,16 +1547,26 @@ nsDocumentViewer::Destroy()
       shEntry->SetContentViewer(this);
     }
 
     // Always sync the presentation state.  That way even if someone screws up
     // and shEntry has no window state at this point we'll be ok; we just won't
     // 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
     // these pointers to their original values.
 
     if (mDocument) {
       mDocument->SetContainer(nullptr);
     }