bug 1170153 - check documents have a docshell before trying to tell the parent process about new remote DocAccessibles r=davidb
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Mon, 06 Jul 2015 08:15:37 -0400
changeset 275882 cf4897732a5f9db1fb68596449be7416fa05a98c
parent 275881 a61cdc2610c2e6eb7da3101bad7f3dbae8f62fcc
child 275883 e8e7191442b368c9a37242ff1fc0188e2e1bfde3
child 275896 d6063656f1718dd9bb6633cd97201c94087a2208
push id3246
push usergijskruitbosch@gmail.com
push dateTue, 07 Jul 2015 09:06:38 +0000
reviewersdavidb
bugs1170153
milestone42.0a1
bug 1170153 - check documents have a docshell before trying to tell the parent process about new remote DocAccessibles r=davidb We should never create DocAccessibles for documents that are going away so it seems like this shouldn't be necessary, but without a test case its hard to know why we are creating DocAccessibles for documents without docshells. So for now work around the issue and hope it doesn't matter in practice.
accessible/base/DocManager.cpp
--- a/accessible/base/DocManager.cpp
+++ b/accessible/base/DocManager.cpp
@@ -452,20 +452,22 @@ DocManager::CreateDocOrRootAccessible(ns
     // Note: don't use AccReorderEvent to avoid coalsecense and special reorder
     // events processing.
     docAcc->FireDelayedEvent(nsIAccessibleEvent::EVENT_REORDER,
                              ApplicationAcc());
 
     if (IPCAccessibilityActive()) {
       DocAccessibleChild* ipcDoc = new DocAccessibleChild(docAcc);
       docAcc->SetIPCDoc(ipcDoc);
-      nsCOMPtr<nsITabChild> tabChild =
-        do_GetInterface(aDocument->GetDocShell());
-    static_cast<TabChild*>(tabChild.get())->
-      SendPDocAccessibleConstructor(ipcDoc, nullptr, 0);
+      nsIDocShell* docShell = aDocument->GetDocShell();
+      if (docShell) {
+        nsCOMPtr<nsITabChild> tabChild = do_GetInterface(docShell);
+        static_cast<TabChild*>(tabChild.get())->
+          SendPDocAccessibleConstructor(ipcDoc, nullptr, 0);
+      }
     }
   } else {
     parentDocAcc->BindChildDocument(docAcc);
   }
 
 #ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDocCreate)) {
     logging::DocCreate("document creation finished", aDocument);