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

Changeset 242858 in webkit


Ignore:
Timestamp:
Mar 13, 2019, 1:24:42 AM (7 years ago)
Author:
bshafiei@apple.com
Message:

Cherry-pick r242587. rdar://problem/48839354

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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242587 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-607-branch
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/LayoutTests/ChangeLog

    r242856 r242858  
     12019-03-13  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Cherry-pick r242587. rdar://problem/48839354
     4
     5    Crash when attempting to change input type while dismissing datalist suggestions
     6    https://bugs.webkit.org/show_bug.cgi?id=195384
     7    <rdar://problem/48563718>
     8   
     9    Reviewed by Brent Fulgham.
     10   
     11    Source/WebCore:
     12   
     13    When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its
     14    active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept
     15    alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly
     16    reference its active datalist suggestions picker.
     17   
     18    Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html
     19   
     20    * platform/DataListSuggestionPicker.h:
     21   
     22    Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting
     23    issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h).
     24   
     25    Source/WebKit:
     26   
     27    See WebCore ChangeLog for more details.
     28   
     29    * WebProcess/WebPage/WebPage.cpp:
     30    (WebKit::WebPage::setActiveDataListSuggestionPicker):
     31    (WebKit::WebPage::didSelectDataListOption):
     32    (WebKit::WebPage::didCloseSuggestions):
     33    * WebProcess/WebPage/WebPage.h:
     34   
     35    Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.
     36   
     37    LayoutTests:
     38   
     39    Add a new layout test to exercise this scenario.
     40   
     41    * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions-expected.txt: Added.
     42    * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html: Added.
     43   
     44    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     45
     46    2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
     47
     48            Crash when attempting to change input type while dismissing datalist suggestions
     49            https://bugs.webkit.org/show_bug.cgi?id=195384
     50            <rdar://problem/48563718>
     51
     52            Reviewed by Brent Fulgham.
     53
     54            Add a new layout test to exercise this scenario.
     55
     56            * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions-expected.txt: Added.
     57            * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html: Added.
     58
    1592019-03-13  Babak Shafiei  <bshafiei@apple.com>
    260
  • branches/safari-607-branch/Source/WebCore/ChangeLog

    r242856 r242858  
     12019-03-13  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Cherry-pick r242587. rdar://problem/48839354
     4
     5    Crash when attempting to change input type while dismissing datalist suggestions
     6    https://bugs.webkit.org/show_bug.cgi?id=195384
     7    <rdar://problem/48563718>
     8   
     9    Reviewed by Brent Fulgham.
     10   
     11    Source/WebCore:
     12   
     13    When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its
     14    active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept
     15    alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly
     16    reference its active datalist suggestions picker.
     17   
     18    Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html
     19   
     20    * platform/DataListSuggestionPicker.h:
     21   
     22    Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting
     23    issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h).
     24   
     25    Source/WebKit:
     26   
     27    See WebCore ChangeLog for more details.
     28   
     29    * WebProcess/WebPage/WebPage.cpp:
     30    (WebKit::WebPage::setActiveDataListSuggestionPicker):
     31    (WebKit::WebPage::didSelectDataListOption):
     32    (WebKit::WebPage::didCloseSuggestions):
     33    * WebProcess/WebPage/WebPage.h:
     34   
     35    Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.
     36   
     37    LayoutTests:
     38   
     39    Add a new layout test to exercise this scenario.
     40   
     41    * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions-expected.txt: Added.
     42    * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html: Added.
     43   
     44    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     45
     46    2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
     47
     48            Crash when attempting to change input type while dismissing datalist suggestions
     49            https://bugs.webkit.org/show_bug.cgi?id=195384
     50            <rdar://problem/48563718>
     51
     52            Reviewed by Brent Fulgham.
     53
     54            When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its
     55            active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept
     56            alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly
     57            reference its active datalist suggestions picker.
     58
     59            Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html
     60
     61            * platform/DataListSuggestionPicker.h:
     62
     63            Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting
     64            issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h).
     65
    1662019-03-13  Babak Shafiei  <bshafiei@apple.com>
    267
  • branches/safari-607-branch/Source/WebCore/platform/DataListSuggestionPicker.h

    r232640 r242858  
    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> {
    3837public:
    3938    virtual ~DataListSuggestionPicker() = default;
  • branches/safari-607-branch/Source/WebKit/ChangeLog

    r242849 r242858  
     12019-03-13  Babak Shafiei  <bshafiei@apple.com>
     2
     3        Cherry-pick r242587. rdar://problem/48839354
     4
     5    Crash when attempting to change input type while dismissing datalist suggestions
     6    https://bugs.webkit.org/show_bug.cgi?id=195384
     7    <rdar://problem/48563718>
     8   
     9    Reviewed by Brent Fulgham.
     10   
     11    Source/WebCore:
     12   
     13    When closing a datalist suggestion menu, WebPageProxy sends a message to WebPage instructing it to tell its
     14    active datalist suggestions picker to close. However, for a myriad of reasons, the suggestions picker (kept
     15    alive by its text input type) may have already gone away by this point. To mitigate this, make WebPage weakly
     16    reference its active datalist suggestions picker.
     17   
     18    Test: fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html
     19   
     20    * platform/DataListSuggestionPicker.h:
     21   
     22    Make DataListSuggestionPicker capable of being weakly referenced. Additionally, fix some minor preexisting
     23    issues in this header (#imports instead of #includes, as well as an unnecessary include of IntRect.h).
     24   
     25    Source/WebKit:
     26   
     27    See WebCore ChangeLog for more details.
     28   
     29    * WebProcess/WebPage/WebPage.cpp:
     30    (WebKit::WebPage::setActiveDataListSuggestionPicker):
     31    (WebKit::WebPage::didSelectDataListOption):
     32    (WebKit::WebPage::didCloseSuggestions):
     33    * WebProcess/WebPage/WebPage.h:
     34   
     35    Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.
     36   
     37    LayoutTests:
     38   
     39    Add a new layout test to exercise this scenario.
     40   
     41    * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions-expected.txt: Added.
     42    * fast/forms/datalist/change-input-type-after-closing-datalist-suggestions.html: Added.
     43   
     44    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242587 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     45
     46    2019-03-06  Wenson Hsieh  <wenson_hsieh@apple.com>
     47
     48            Crash when attempting to change input type while dismissing datalist suggestions
     49            https://bugs.webkit.org/show_bug.cgi?id=195384
     50            <rdar://problem/48563718>
     51
     52            Reviewed by Brent Fulgham.
     53
     54            See WebCore ChangeLog for more details.
     55
     56            * WebProcess/WebPage/WebPage.cpp:
     57            (WebKit::WebPage::setActiveDataListSuggestionPicker):
     58            (WebKit::WebPage::didSelectDataListOption):
     59            (WebKit::WebPage::didCloseSuggestions):
     60            * WebProcess/WebPage/WebPage.h:
     61
     62            Turn m_activeDataListSuggestionPicker from a raw pointer into a WeakPtr.
     63
    1642019-03-13  Babak Shafiei  <bshafiei@apple.com>
    265
  • branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.cpp

    r242133 r242858  
    38633863void WebPage::setActiveDataListSuggestionPicker(WebDataListSuggestionPicker* dataListSuggestionPicker)
    38643864{
    3865     m_activeDataListSuggestionPicker = dataListSuggestionPicker;
     3865    m_activeDataListSuggestionPicker = makeWeakPtr(dataListSuggestionPicker);
    38663866}
    38673867
    38683868void WebPage::didSelectDataListOption(const String& selectedOption)
    38693869{
    3870     m_activeDataListSuggestionPicker->didSelectOption(selectedOption);
     3870    if (m_activeDataListSuggestionPicker)
     3871        m_activeDataListSuggestionPicker->didSelectOption(selectedOption);
    38713872}
    38723873
    38733874void WebPage::didCloseSuggestions()
    38743875{
    3875     if (m_activeDataListSuggestionPicker)
    3876         m_activeDataListSuggestionPicker->didCloseSuggestions();
    3877     m_activeDataListSuggestionPicker = nullptr;
     3876    if (auto picker = std::exchange(m_activeDataListSuggestionPicker, nullptr))
     3877        picker->didCloseSuggestions();
    38783878}
    38793879
  • branches/safari-607-branch/Source/WebKit/WebProcess/WebPage/WebPage.h

    r241888 r242858  
    16311631
    16321632#if ENABLE(DATALIST_ELEMENT)
    1633     WebDataListSuggestionPicker* m_activeDataListSuggestionPicker { nullptr };
     1633    WeakPtr<WebDataListSuggestionPicker> m_activeDataListSuggestionPicker;
    16341634#endif
    16351635
Note: See TracChangeset for help on using the changeset viewer.