⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242587 in webkit


Ignore:
Timestamp:
Mar 6, 2019, 7:11:38 PM (7 years ago)
Author:
Wenson Hsieh
Message:

Crash when attempting to change input type while dismissing datalist suggestions
https://bugs.webkit.org/show_bug.cgi?id=195384
<rdar://problem/48563718>

Reviewed by Brent Fulgham.

Source/WebCore:

When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its
active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept
alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly
reference its active datalist suggestions picker.

Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html

  • platform/DataListSuggestionPicker.h:

Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting
issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h).

Source/WebKit:

See WebCore ChangeLog for more details.

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::setActiveDataListSuggestionPicker):
(WebKit::WebPage::didSelectDataListOption):
(WebKit::WebPage::didCloseSuggestions):

  • WebProcess/WebPage/WebPage.h:

Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.

LayoutTests:

Add a new layout test to exercise this scenario.

  • fast/forms/datalist/change-input-type-after-closing-datalist-suggestions-expected.txt: Added.
  • fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html: Added.
Location:
trunk
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r242575 r242587  
     12019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Crash when attempting to change input type while dismissing datalist suggestions
     4        https://bugs.webkit.org/show_bug.cgi?id=195384
     5        <rdar://problem/48563718>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Add a new layout test to exercise this scenario.
     10
     11        * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions-expected.txt: Added.
     12        * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html: Added.
     13
    1142019-03-06  Justin Fan  <justin_fan@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r242586 r242587  
     12019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Crash when attempting to change input type while dismissing datalist suggestions
     4        https://bugs.webkit.org/show_bug.cgi?id=195384
     5        <rdar://problem/48563718>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its
     10        active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept
     11        alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly
     12        reference its active datalist suggestions picker.
     13
     14        Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html
     15
     16        * platform/DataListSuggestionPicker.h:
     17
     18        Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting
     19        issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h).
     20
    1212019-03-06  Ryan Haddad  <ryanhaddad@apple.com>
    222
  • trunk/Source/WebCore/platform/DataListSuggestionPicker.h

    r241183 r242587  
    2828#if ENABLE(DATALIST_ELEMENT)
    2929
    30 #import "DataListSuggestionInformation.h"
    31 #import "IntRect.h"
    32 
    33 #import <wtf/text/WTFString.h>
     30#include "DataListSuggestionInformation.h"
     31#include <wtf/WeakPtr.h>
     32#include <wtf/text/WTFString.h>
    3433
    3534namespace WebCore {
    3635
    37 class DataListSuggestionPicker {
     36class DataListSuggestionPicker : public CanMakeWeakPtr<DataListSuggestionPicker> {
    3837    WTF_MAKE_FAST_ALLOCATED;
    3938public:
  • trunk/Source/WebKit/ChangeLog

    r242580 r242587  
     12019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        Crash when attempting to change input type while dismissing datalist suggestions
     4        https://bugs.webkit.org/show_bug.cgi?id=195384
     5        <rdar://problem/48563718>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        See WebCore ChangeLog for more details.
     10
     11        * WebProcess/WebPage/WebPage.cpp:
     12        (WebKit::WebPage::setActiveDataListSuggestionPicker):
     13        (WebKit::WebPage::didSelectDataListOption):
     14        (WebKit::WebPage::didCloseSuggestions):
     15        * WebProcess/WebPage/WebPage.h:
     16
     17        Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.
     18
    1192019-03-06  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r242580 r242587  
    39003900void WebPage::setActiveDataListSuggestionPicker(WebDataListSuggestionPicker* dataListSuggestionPicker)
    39013901{
    3902     m_activeDataListSuggestionPicker = dataListSuggestionPicker;
     3902    m_activeDataListSuggestionPicker = makeWeakPtr(dataListSuggestionPicker);
    39033903}
    39043904
    39053905void WebPage::didSelectDataListOption(const String& selectedOption)
    39063906{
    3907     m_activeDataListSuggestionPicker->didSelectOption(selectedOption);
     3907    if (m_activeDataListSuggestionPicker)
     3908        m_activeDataListSuggestionPicker->didSelectOption(selectedOption);
    39083909}
    39093910
    39103911void WebPage::didCloseSuggestions()
    39113912{
    3912     if (m_activeDataListSuggestionPicker)
    3913         m_activeDataListSuggestionPicker->didCloseSuggestions();
    3914     m_activeDataListSuggestionPicker = nullptr;
     3913    if (auto picker = std::exchange(m_activeDataListSuggestionPicker, nullptr))
     3914        picker->didCloseSuggestions();
    39153915}
    39163916
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r242551 r242587  
    16581658
    16591659#if ENABLE(DATALIST_ELEMENT)
    1660     WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr };
     1660    WeakPtr<WebDataListSuggestionPicker> m_activeDataListSuggestionPicker;
    16611661#endif
    16621662
Note: See TracChangeset for help on using the changeset viewer.