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)