Bug 1552104. Need to clear display items when we remove a document from the view tree but it sticks around. r=mattwoodrow
☠☠ backed out by 82d64b7597a0 ☠ ☠
authorTimothy Nikkel <tnikkel@gmail.com>
Thu, 16 May 2019 09:39:03 +0000
changeset 532891 e6913f1de086cb75104de6f5105df44f7818ce1e
parent 532890 d7367a8f16debee5c2efbf337df61cc2a25421ef
child 532892 7f053480beaab8263f4ac6a7fd740d9eaaa5ee5a
push id11276
push userrgurzau@mozilla.com
push dateMon, 20 May 2019 13:11:24 +0000
treeherdermozilla-beta@847755a7c325 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmattwoodrow
bugs1552104
milestone68.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 1552104. Need to clear display items when we remove a document from the view tree but it sticks around. r=mattwoodrow This happens in one test on try server that has some iframes that navigate. I audited everywhere else that we change the view tree, this seems like the only place it can happen. Differential Revision: https://phabricator.services.mozilla.com/D31399
layout/base/nsDocumentViewer.cpp
layout/generic/nsSubDocumentFrame.h
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -1726,16 +1726,26 @@ nsDocumentViewer::Destroy() {
     if (mPresShell) {
       nsViewManager* vm = mPresShell->GetViewManager();
       if (vm) {
         nsView* rootView = vm->GetRootView();
 
         if (rootView) {
           nsView* rootViewParent = rootView->GetParent();
           if (rootViewParent) {
+            nsView* subdocview = rootViewParent->GetParent();
+            if (subdocview) {
+              nsIFrame* f = subdocview->GetFrame();
+              if (f) {
+                nsSubDocumentFrame* s = do_QueryFrame(f);
+                if (s) {
+                  s->ClearDisplayItems();
+                }
+              }
+            }
             nsViewManager* parentVM = rootViewParent->GetViewManager();
             if (parentVM) {
               parentVM->RemoveChild(rootView);
             }
           }
         }
       }
     }
--- a/layout/generic/nsSubDocumentFrame.h
+++ b/layout/generic/nsSubDocumentFrame.h
@@ -117,34 +117,34 @@ class nsSubDocumentFrame final : public 
   }
 
   nsFrameLoader* FrameLoader() const;
   void ResetFrameLoader();
 
   void PropagateIsUnderHiddenEmbedderElementToSubView(
       bool aIsUnderHiddenEmbedderElement);
 
+  void ClearDisplayItems();
+
  protected:
   friend class AsyncFrameInit;
 
   // Helper method to look up the HTML marginwidth & marginheight attributes.
   mozilla::CSSIntSize GetMarginAttributes();
 
   bool IsInline() { return mIsInline; }
 
   nscoord GetIntrinsicISize();
   nscoord GetIntrinsicBSize();
 
   // Show our document viewer. The document viewer is hidden via a script
   // runner, so that we can save and restore the presentation if we're
   // being reframed.
   void ShowViewer();
 
-  void ClearDisplayItems();
-
   /* Obtains the frame we should use for intrinsic size information if we are
    * an HTML <object> or <embed>  (a replaced element - not <iframe>)
    * and our sub-document has an intrinsic size. The frame returned is the
    * frame for the document element of the document we're embedding.
    *
    * Called "Obtain*" and not "Get*" because of comment on GetDocShell that
    * says it should be called ObtainDocShell because of its side effects.
    */