From c7593f2912bbf3e4f8e4a4fd16e27c27eaefc45e Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Fri, 6 May 2005 18:18:08 +0000 Subject: [PATCH] Don't crash when we've restored a presentation with a frame that has never loaded a document. Bug 292923, r+sr=bzbarsky, a=brendan. git-svn-id: svn://10.0.0.236/trunk@173116 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index c811ecf178b..3f1ab6350a5 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -4890,8 +4890,11 @@ nsDocShell::FireRestoreEvents() // want the chrome to see it for chrome/extensions that look for page load. // In addition, we need to fire DOMPageRestore on the content window. + nsresult rv = EnsureContentViewer(); + NS_ENSURE_SUCCESS(rv, rv); + nsCOMPtr docViewer = do_QueryInterface(mContentViewer); - NS_ASSERTION(docViewer, "should not be called with a null viewer"); + NS_ENSURE_TRUE(docViewer, NS_ERROR_UNEXPECTED); nsCOMPtr shell; docViewer->GetPresShell(getter_AddRefs(shell)); @@ -4913,9 +4916,8 @@ nsDocShell::FireRestoreEvents() nsIDOMEvent *domEvt = nsnull; nsPresContext *pc = shell->GetPresContext(); - nsresult rv = handler->HandleChromeEvent(pc, &event, &domEvt, - flags & NS_EVENT_CAPTURE_MASK, - &status); + rv = handler->HandleChromeEvent(pc, &event, &domEvt, + flags & NS_EVENT_CAPTURE_MASK, &status); NS_ENSURE_SUCCESS(rv, rv); if (domEvt) {