From 579f24fd9d8c35edb2f4dd2bdd548d5739d11fcf Mon Sep 17 00:00:00 2001 From: "bryner%brianryner.com" Date: Thu, 30 Jun 2005 20:58:33 +0000 Subject: [PATCH] Fix crash when using fastback to go to pages that use SVG in an tag, and bulletproof a little bit. Bug 299153, r+sr=dbaron, a=bsmedberg git-svn-id: svn://10.0.0.236/trunk@175421 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/docshell/base/nsDocShell.cpp | 26 ++++++++++++++------------ mozilla/layout/base/nsPresShell.cpp | 17 +++++++++++++++-- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/mozilla/docshell/base/nsDocShell.cpp b/mozilla/docshell/base/nsDocShell.cpp index eb9c0b74c9c..76c2b23463e 100644 --- a/mozilla/docshell/base/nsDocShell.cpp +++ b/mozilla/docshell/base/nsDocShell.cpp @@ -5006,20 +5006,22 @@ nsDocShell::FinishRestore() } } - nsCOMPtr domDoc; - mContentViewer->GetDOMDocument(getter_AddRefs(domDoc)); + if (mContentViewer) { + nsCOMPtr domDoc; + mContentViewer->GetDOMDocument(getter_AddRefs(domDoc)); - nsCOMPtr doc = do_QueryInterface(domDoc); - if (doc) { - // Finally, we remove the request from the loadgroup. This will cause - // onStateChange(STATE_STOP) to fire, which will fire the PageShow - // event to the chrome. + nsCOMPtr doc = do_QueryInterface(domDoc); + if (doc) { + // Finally, we remove the request from the loadgroup. This will + // cause onStateChange(STATE_STOP) to fire, which will fire the + // PageShow event to the chrome. - nsIChannel *channel = doc->GetChannel(); - if (channel) { - mIsRestoringDocument = PR_TRUE; - mLoadGroup->RemoveRequest(channel, nsnull, NS_OK); - mIsRestoringDocument = PR_FALSE; + nsIChannel *channel = doc->GetChannel(); + if (channel) { + mIsRestoringDocument = PR_TRUE; + mLoadGroup->RemoveRequest(channel, nsnull, NS_OK); + mIsRestoringDocument = PR_FALSE; + } } } diff --git a/mozilla/layout/base/nsPresShell.cpp b/mozilla/layout/base/nsPresShell.cpp index 4df8f7d6180..041738db2a0 100644 --- a/mozilla/layout/base/nsPresShell.cpp +++ b/mozilla/layout/base/nsPresShell.cpp @@ -6587,8 +6587,21 @@ PresShell::Freeze() static void StartPluginInstance(PresShell *aShell, nsIContent *aContent) { - // For now we just reconstruct the frame. - aShell->RecreateFramesFor(aContent); + // For now we just reconstruct the frame, but only if the element + // has a plugin instance. + nsIFrame *frame = nsnull; + aShell->GetPrimaryFrameFor(aContent, &frame); + if (frame) { + nsIObjectFrame *objFrame = nsnull; + CallQueryInterface(frame, &objFrame); + if (objFrame) { + nsCOMPtr instance; + objFrame->GetPluginInstance(*getter_AddRefs(instance)); + if (instance) { + aShell->RecreateFramesFor(aContent); + } + } + } } PR_STATIC_CALLBACK(PRBool)