Bug 1112465 - Fix crashes when navigating to XUL window with devtools opened by checking for GetCanvasFrame in RemoveAnonymousContent. r=ehsan, a=sledru
authorPatrick Brosset <pbrosset@mozilla.com>
Wed, 17 Dec 2014 04:38:00 -0500
changeset 242780 31516786a389cb8bd5df22bb7af4a8f7e9710a8c
parent 242779 069c6e7bb97d423181f7838b84d8c1cb5a6279ff
child 242781 642bfe63921cba8e1b87361476733ccac13135d6
push id4311
push userraliiev@mozilla.com
push dateMon, 12 Jan 2015 19:37:41 +0000
treeherdermozilla-beta@150c9fed433b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan, sledru
bugs1112465
milestone36.0a2
Bug 1112465 - Fix crashes when navigating to XUL window with devtools opened by checking for GetCanvasFrame in RemoveAnonymousContent. r=ehsan, a=sledru
dom/base/nsDocument.cpp
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -5227,17 +5227,17 @@ nsIDocument::InsertAnonymousContent(Elem
   return anonymousContent.forget();
 }
 
 void
 nsIDocument::RemoveAnonymousContent(AnonymousContent& aContent,
                                     ErrorResult& aRv)
 {
   nsIPresShell* shell = GetShell();
-  if (!shell) {
+  if (!shell || !shell->GetCanvasFrame()) {
     aRv.Throw(NS_ERROR_UNEXPECTED);
     return;
   }
 
   nsCOMPtr<Element> container = shell->GetCanvasFrame()
                                      ->GetCustomContentContainer();
   if (!container) {
     aRv.Throw(NS_ERROR_UNEXPECTED);