Changeset 244971 in webkit


Ignore:
Timestamp:
May 6, 2019 1:25:27 PM (5 years ago)
Author:
Chris Dumez
Message:

Add assertions to CachedFrame to help figure out crash in CachedFrame constructor
https://bugs.webkit.org/show_bug.cgi?id=197621

Reviewed by Geoffrey Garen.

Add release assertions to try and figure out who is sometimes detaching the document from its
frame while constructing CachedFrames for its descendants.

  • dom/Document.cpp:

(WebCore::Document::detachFromFrame):

  • dom/Document.h:

(WebCore::Document::setMayBeDetachedFromFrame):

  • history/CachedFrame.cpp:

(WebCore::CachedFrame::CachedFrame):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r244961 r244971  
     12019-05-06  Chris Dumez  <cdumez@apple.com>
     2
     3        Add assertions to CachedFrame to help figure out crash in CachedFrame constructor
     4        https://bugs.webkit.org/show_bug.cgi?id=197621
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        Add release assertions to try and figure out who is sometimes detaching the document from its
     9        frame while constructing CachedFrames for its descendants.
     10
     11        * dom/Document.cpp:
     12        (WebCore::Document::detachFromFrame):
     13        * dom/Document.h:
     14        (WebCore::Document::setMayBeDetachedFromFrame):
     15        * history/CachedFrame.cpp:
     16        (WebCore::CachedFrame::CachedFrame):
     17
    1182019-05-06  Zan Dobersek  <zdobersek@igalia.com>
    219
  • trunk/Source/WebCore/dom/Document.cpp

    r244860 r244971  
    81318131void Document::detachFromFrame()
    81328132{
     8133    // Assertion to help pinpint rdar://problem/49877867. If this hits, the crash trace should tell us
     8134    // which piece of code is detaching the document from its frame while constructing the CachedFrames.
     8135    RELEASE_ASSERT(m_mayBeDetachedFromFrame);
     8136
    81338137    observeFrame(nullptr);
    81348138}
  • trunk/Source/WebCore/dom/Document.h

    r244853 r244971  
    14631463#endif
    14641464
     1465    // For debugging rdar://problem/49877867.
     1466    void setMayBeDetachedFromFrame(bool mayBeDetachedFromFrame) { m_mayBeDetachedFromFrame = mayBeDetachedFromFrame; }
     1467
    14651468    Logger& logger();
    14661469
     
    20602063    bool m_hasEvaluatedUserAgentScripts { false };
    20612064    bool m_isRunningUserScripts { false };
     2065    bool m_mayBeDetachedFromFrame { true };
    20622066#if ENABLE(APPLE_PAY)
    20632067    bool m_hasStartedApplePaySession { false };
  • trunk/Source/WebCore/history/CachedFrame.cpp

    r242797 r244971  
    144144    ASSERT(m_document->pageCacheState() == Document::InPageCache);
    145145
     146    RELEASE_ASSERT(m_document->domWindow());
     147    RELEASE_ASSERT(m_document->frame());
     148    RELEASE_ASSERT(m_document->domWindow()->frame());
     149
     150    // FIXME: We have evidence that constructing CachedFrames for descendant frames may detach the document from its frame (rdar://problem/49877867).
     151    // This sets the flag to help find the guilty code.
     152    m_document->setMayBeDetachedFromFrame(false);
     153
    146154    // Create the CachedFrames for all Frames in the FrameTree.
    147155    for (Frame* child = frame.tree().firstChild(); child; child = child->tree().nextSibling())
    148156        m_childFrames.append(std::make_unique<CachedFrame>(*child));
    149157
     158    RELEASE_ASSERT(m_document->domWindow());
     159    RELEASE_ASSERT(m_document->frame());
    150160    RELEASE_ASSERT(m_document->domWindow()->frame());
    151161
     
    194204#endif
    195205
     206    m_document->setMayBeDetachedFromFrame(true);
    196207    m_document->detachFromCachedFrame(*this);
    197208
Note: See TracChangeset for help on using the changeset viewer.