Bug 1112465 - Fix crashes when navigating to XUL window with devtools opened by checking for GetCanvasFrame in RemoveAnonymousContent. r=ehsan, a=sledru
--- 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);