Changeset 229683 in webkit


Ignore:
Timestamp:
Mar 16, 2018 2:17:27 PM (6 years ago)
Author:
Brent Fulgham
Message:

Set a trap to catch an infrequent form-related nullptr crash
https://bugs.webkit.org/show_bug.cgi?id=183704
<rdar://problem/37579354>

Reviewed by Ryosuke Niwa.

Source/WebCore:

Make FormState a FrameDestructionObserver. We expect all relevant FormState objects to have been
cleaned up prior to the frame being destroyed. If we find such a case, we'd like to see the
stack trace to see what's going on.

  • loader/FormState.cpp:

(WebCore::FormState::FormState):
(WebCore::FormState::willDetachPage): RELEASE_ASSERT_NOT_REACHED if we ever get here.

  • loader/FormState.h:

Source/WebKit:

Add a RELEASE_ASSERT to see if we ever encounter a nullptr WebCore frame.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):

Location:
trunk/Source
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r229682 r229683  
     12018-03-16  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Set a trap to catch an infrequent form-related nullptr crash
     4        https://bugs.webkit.org/show_bug.cgi?id=183704
     5        <rdar://problem/37579354>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Make FormState a FrameDestructionObserver. We expect all relevant FormState objects to have been
     10        cleaned up prior to the frame being destroyed. If we find such a case, we'd like to see the
     11        stack trace to see what's going on.
     12
     13        * loader/FormState.cpp:
     14        (WebCore::FormState::FormState):
     15        (WebCore::FormState::willDetachPage): RELEASE_ASSERT_NOT_REACHED if we ever get here.
     16        * loader/FormState.h:
     17
    1182018-03-16  Joanmarie Diggs  <jdiggs@igalia.com>
    219
  • trunk/Source/WebCore/loader/FormState.cpp

    r210845 r229683  
    3636
    3737inline FormState::FormState(HTMLFormElement& form, StringPairVector&& textFieldValues, Document& sourceDocument, FormSubmissionTrigger formSubmissionTrigger)
    38     : m_form(form)
     38    : FrameDestructionObserver(sourceDocument.frame())
     39    , m_form(form)
    3940    , m_textFieldValues(WTFMove(textFieldValues))
    4041    , m_sourceDocument(sourceDocument)
    4142    , m_formSubmissionTrigger(formSubmissionTrigger)
    4243{
     44    RELEASE_ASSERT(sourceDocument.frame());
    4345}
    4446
     
    4850}
    4951
     52void FormState::willDetachPage()
     53{
     54    // Beartrap for <rdar://problem/37579354>
     55    RELEASE_ASSERT_NOT_REACHED();
    5056}
     57
     58}
  • trunk/Source/WebCore/loader/FormState.h

    r210845 r229683  
    2929#pragma once
    3030
     31#include "FrameDestructionObserver.h"
    3132#include <wtf/text/WTFString.h>
    3233
     
    4041using StringPairVector = Vector<std::pair<String, String>>;
    4142
    42 class FormState : public RefCounted<FormState> {
     43class FormState : public RefCounted<FormState>, public FrameDestructionObserver {
    4344public:
    4445    static Ref<FormState> create(HTMLFormElement&, StringPairVector&& textFieldValues, Document&, FormSubmissionTrigger);
     
    5152private:
    5253    FormState(HTMLFormElement&, StringPairVector&& textFieldValues, Document&, FormSubmissionTrigger);
     54    void willDetachPage() override;
    5355
    5456    Ref<HTMLFormElement> m_form;
  • trunk/Source/WebKit/ChangeLog

    r229680 r229683  
     12018-03-16  Brent Fulgham  <bfulgham@apple.com>
     2
     3        Set a trap to catch an infrequent form-related nullptr crash
     4        https://bugs.webkit.org/show_bug.cgi?id=183704
     5        <rdar://problem/37579354>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Add a RELEASE_ASSERT to see if we ever encounter a nullptr WebCore frame.
     10
     11        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     12        (WebKit::WebFrameLoaderClient::dispatchWillSubmitForm):
     13
    1142018-03-16  Jer Noble  <jer.noble@apple.com>
    215
  • trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r229617 r229683  
    940940    auto& form = formState.form();
    941941
    942     auto* sourceFrame = WebFrame::fromCoreFrame(*formState.sourceDocument().frame());
     942    auto* sourceCoreFrame = formState.sourceDocument().frame();
     943    RELEASE_ASSERT(sourceCoreFrame);
     944    auto* sourceFrame = WebFrame::fromCoreFrame(*sourceCoreFrame);
    943945    ASSERT(sourceFrame);
    944946
Note: See TracChangeset for help on using the changeset viewer.