From 607c3038cb159cbb1f48e404332a4d0f340c2e79 Mon Sep 17 00:00:00 2001 From: Cameron Kaiser Date: Sat, 30 Sep 2017 22:38:45 -0700 Subject: [PATCH] #439: M1368852 --- layout/generic/nsSubDocumentFrame.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/layout/generic/nsSubDocumentFrame.cpp b/layout/generic/nsSubDocumentFrame.cpp index 7251ab710..49ef0ceb7 100644 --- a/layout/generic/nsSubDocumentFrame.cpp +++ b/layout/generic/nsSubDocumentFrame.cpp @@ -951,7 +951,16 @@ public: // Flush frames, to ensure any pending display:none changes are made. // Note it can be unsafe to flush if we've destroyed the presentation // for some other reason, like if we're shutting down. - if (!mPresShell->IsDestroying()) { + // + // But avoid the flush if we know for sure we're away, like when we're out + // of the document already. + // + // FIXME(emilio): This could still be a perf footgun when removing lots of + // siblings where each of them cause the reframe of an ancestor which happen + // to contain a subdocument. + // + // We should find some way to avoid that! + if (!mPresShell->IsDestroying() && mFrameElement->IsInComposedDoc()) { mPresShell->FlushPendingNotifications(Flush_Frames); }