Bug 781279 - Forget update plugin geometry frame when presentation detaches. r=roc
authorChris Pearce <cpearce@mozilla.com>
Fri, 24 Aug 2012 23:12:21 +1200
changeset 103288 fe4538ef86c5eb28a9c950419b32bd0548c82578
parent 103287 a485ff9049542ead6fb380e3e8f047d7e05eec7b
child 103289 e80dea0213a0e1afffa0d8723d948e54f87f0c56
push id23343
push userryanvm@gmail.com
push dateSat, 25 Aug 2012 02:53:35 +0000
treeherdermozilla-central@f077de66e52d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs781279
milestone17.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 781279 - Forget update plugin geometry frame when presentation detaches. r=roc
layout/generic/nsSubDocumentFrame.cpp
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -833,16 +833,28 @@ BeginSwapDocShellsForViews(nsIView* aSib
 void
 nsSubDocumentFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   if (mPostedReflowCallback) {
     PresContext()->PresShell()->CancelReflowCallback(this);
     mPostedReflowCallback = false;
   }
 
+  // Forget about plugin geometry updates in the subdoc's PresContext,
+  // otherwise we can be left with dangling pointers to the "plugin for
+  // geometry update frame" in the root PresContext.
+  nsIFrame* subdocRootFrame = GetSubdocumentRootFrame();
+  if (subdocRootFrame) {
+    nsPresContext* pc = subdocRootFrame->PresContext();
+    nsRootPresContext* rpc = pc ? pc->GetRootPresContext() : nullptr;
+    if (rpc) {
+      rpc->RootForgetUpdatePluginGeometryFrameForPresContext(pc);
+    }
+  }
+
   // Detach the subdocument's views and stash them in the frame loader.
   // We can then reattach them if we're being reframed (for example if
   // the frame has been made position:fixed).
   nsFrameLoader* frameloader = FrameLoader();
   if (frameloader) {
     nsIView* detachedViews = ::BeginSwapDocShellsForViews(mInnerView->GetFirstChild());
     frameloader->SetDetachedSubdocView(detachedViews, mContent->OwnerDoc());