Bug 597963 crash [@ nsIDocument::GetContainer() ] r=surkov.alexander a=blocking-2.0
authorGinn Chen <ginn.chen@oracle.com>
Tue, 09 Nov 2010 18:22:59 +0800
changeset 57148 11837c6ed4a052a0a5b85dc5fdb2ef6f860c702c
parent 57147 c6310223480b858623a50a37010b07fad7ffa49e
child 57149 f8cfc4c027090419290f76ce8717072f495037a3
push idunknown
push userunknown
push dateunknown
reviewerssurkov.alexander, blocking-2.0
bugs597963
milestone2.0b8pre
Bug 597963 crash [@ nsIDocument::GetContainer() ] r=surkov.alexander a=blocking-2.0
accessible/src/base/nsOuterDocAccessible.cpp
--- a/accessible/src/base/nsOuterDocAccessible.cpp
+++ b/accessible/src/base/nsOuterDocAccessible.cpp
@@ -191,18 +191,23 @@ nsOuterDocAccessible::InvalidateChildren
   // accessible is created and appended as a child when it's requested.
 
   mChildrenFlags = eChildrenUninitialized;
 }
 
 PRBool
 nsOuterDocAccessible::AppendChild(nsAccessible *aAccessible)
 {
-  NS_ASSERTION(!mChildren.Length(),
-               "Previous child document of outerdoc accessible wasn't removed!");
+  // We keep showing the old document for a bit after creating the new one,
+  // and while building the new DOM and frame tree. That's done on purpose
+  // to avoid weird flashes of default background color.
+  // The old viewer will be destroyed after the new one is created.
+  // For a11y, it should be safe to shut down the old document now.
+  if (mChildren.Length())
+    mChildren[0]->Shutdown();
 
   if (!nsAccessible::AppendChild(aAccessible))
     return PR_FALSE;
 
   NS_LOG_ACCDOCCREATE("append document to outerdoc",
                       aAccessible->GetDocumentNode())
   NS_LOG_ACCDOCCREATE_ACCADDRESS("outerdoc", this)