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

Changeset 242867 in webkit


Ignore:
Timestamp:
Mar 13, 2019, 2:25:02 AM (7 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r242587 - 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:
releases/WebKitGTK/webkit-2.24
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.24/LayoutTests/ChangeLog

    r242540 r242867  
     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-02  Darin Adler  <darin@apple.com>
    215
  • releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog

    r242540 r242867  
     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-02  Darin Adler  <darin@apple.com>
    222
  • releases/WebKitGTK/webkit-2.24/Source/WebCore/platform/DataListSuggestionPicker.h

    r241183 r242867  
    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:
  • releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog

    r242547 r242867  
     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  Carlos Garcia Campos  <cgarcia@igalia.com>
    220
  • releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r242461 r242867  
    38833883void WebPage::setActiveDataListSuggestionPicker(WebDataListSuggestionPicker* dataListSuggestionPicker)
    38843884{
    3885     m_activeDataListSuggestionPicker = dataListSuggestionPicker;
     3885    m_activeDataListSuggestionPicker = makeWeakPtr(dataListSuggestionPicker);
    38863886}
    38873887
    38883888void WebPage::didSelectDataListOption(const String& selectedOption)
    38893889{
    3890     m_activeDataListSuggestionPicker->didSelectOption(selectedOption);
     3890    if (m_activeDataListSuggestionPicker)
     3891        m_activeDataListSuggestionPicker->didSelectOption(selectedOption);
    38913892}
    38923893
    38933894void WebPage::didCloseSuggestions()
    38943895{
    3895     if (m_activeDataListSuggestionPicker)
    3896         m_activeDataListSuggestionPicker->didCloseSuggestions();
    3897     m_activeDataListSuggestionPicker = nullptr;
     3896    if (auto picker = std::exchange(m_activeDataListSuggestionPicker, nullptr))
     3897        picker->didCloseSuggestions();
    38983898}
    38993899
  • releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/WebPage.h

    r242461 r242867  
    16571657
    16581658#if ENABLE(DATALIST_ELEMENT)
    1659     WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr };
     1659    WeakPtr<WebDataListSuggestionPicker> m_activeDataListSuggestionPicker;
    16601660#endif
    16611661
Note: See TracChangeset for help on using the changeset viewer.