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

Changeset 222768 in webkit


Ignore:
Timestamp:
Oct 2, 2017, 10:10:29 PM (9 years ago)
Author:
Wenson Hsieh
Message:

REGRESSION(r222595): Intermittent crash while accessing DataTransferItemList
https://bugs.webkit.org/show_bug.cgi?id=177791
<rdar://problem/34781456>

Reviewed by Ryosuke Niwa.

Source/WebCore:

DataTransfer::moveDragState() currently attempts to move the other DataTransfer's DataTransferItemList and
DragImageLoader as members of its own. This is incorrect, since both of these entities hold raw references of
some form to the other DataTransfer, yet they are held as unique_ptrs in the new DataTransfer. To fix this, we
(1) remove the line of code that moves the item list, since item lists will be lazily generated on the new
DataTransfer anyways, and (2) update the DataTransfer pointer on the old DataTransfer's DragImageLoader after
moving it to the new DataTransfer.

Test: editing/pasteboard/drag-end-crash-accessing-item-list.html

  • dom/DataTransfer.cpp:

(WebCore::DragImageLoader::moveToDataTransfer):
(WebCore::DataTransfer::moveDragState):

LayoutTests:

Add a new layout test that simulates the crash encountered in this bug by forcing a garbage collection sweep
right before accessing the pasteboard in a "dragend" event handler.

  • TestExpectations:
  • editing/pasteboard/drag-end-crash-accessing-item-list-expected.txt: Added.
  • editing/pasteboard/drag-end-crash-accessing-item-list.html: Added.
  • platform/mac-wk1/TestExpectations:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r222766 r222768  
     12017-10-02  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        REGRESSION(r222595): Intermittent crash while accessing DataTransferItemList
     4        https://bugs.webkit.org/show_bug.cgi?id=177791
     5        <rdar://problem/34781456>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        Add a new layout test that simulates the crash encountered in this bug by forcing a garbage collection sweep
     10        right before accessing the pasteboard in a "dragend" event handler.
     11
     12        * TestExpectations:
     13        * editing/pasteboard/drag-end-crash-accessing-item-list-expected.txt: Added.
     14        * editing/pasteboard/drag-end-crash-accessing-item-list.html: Added.
     15        * platform/mac-wk1/TestExpectations:
     16
    1172017-10-02  Brent Fulgham  <bfulgham@apple.com>
    218
  • trunk/LayoutTests/TestExpectations

    r222734 r222768  
    7171editing/pasteboard/data-transfer-get-data-on-drop-rich-text.html [ Skip ]
    7272editing/pasteboard/data-transfer-get-data-on-drop-url.html [ Skip ]
     73editing/pasteboard/drag-end-crash-accessing-item-list.html [ Skip ]
    7374
    7475# Only iOS supports QuickLook
  • trunk/LayoutTests/platform/mac-wk1/TestExpectations

    r222739 r222768  
    1212editing/pasteboard/data-transfer-get-data-on-drop-rich-text.html [ Pass ]
    1313editing/pasteboard/data-transfer-get-data-on-drop-url.html [ Pass ]
     14editing/pasteboard/drag-end-crash-accessing-item-list.html [ Pass ]
    1415
    1516#//////////////////////////////////////////////////////////////////////////////////////////
  • trunk/Source/WebCore/ChangeLog

    r222767 r222768  
     12017-10-02  Wenson Hsieh  <wenson_hsieh@apple.com>
     2
     3        REGRESSION(r222595): Intermittent crash while accessing DataTransferItemList
     4        https://bugs.webkit.org/show_bug.cgi?id=177791
     5        <rdar://problem/34781456>
     6
     7        Reviewed by Ryosuke Niwa.
     8
     9        DataTransfer::moveDragState() currently attempts to move the other DataTransfer's DataTransferItemList and
     10        DragImageLoader as members of its own. This is incorrect, since both of these entities hold raw references of
     11        some form to the other DataTransfer, yet they are held as unique_ptrs in the new DataTransfer. To fix this, we
     12        (1) remove the line of code that moves the item list, since item lists will be lazily generated on the new
     13        DataTransfer anyways, and (2) update the DataTransfer pointer on the old DataTransfer's DragImageLoader after
     14        moving it to the new DataTransfer.
     15
     16        Test: editing/pasteboard/drag-end-crash-accessing-item-list.html
     17
     18        * dom/DataTransfer.cpp:
     19        (WebCore::DragImageLoader::moveToDataTransfer):
     20        (WebCore::DataTransfer::moveDragState):
     21
    1222017-10-02  Chris Dumez  <cdumez@apple.com>
    223
  • trunk/Source/WebCore/dom/DataTransfer.cpp

    r222702 r222768  
    5252    void startLoading(CachedResourceHandle<CachedImage>&);
    5353    void stopLoading(CachedResourceHandle<CachedImage>&);
     54    void moveToDataTransfer(DataTransfer&);
    5455
    5556private:
     
    364365    : m_dataTransfer(dataTransfer)
    365366{
     367}
     368
     369void DragImageLoader::moveToDataTransfer(DataTransfer& newDataTransfer)
     370{
     371    m_dataTransfer = &newDataTransfer;
    366372}
    367373
     
    509515    m_dragImageElement = WTFMove(other->m_dragImageElement);
    510516    m_dragImageLoader = WTFMove(other->m_dragImageLoader);
    511     m_itemList = WTFMove(other->m_itemList);
     517    if (m_dragImageLoader)
     518        m_dragImageLoader->moveToDataTransfer(*this);
    512519    m_fileList = WTFMove(other->m_fileList);
    513520}
Note: See TracChangeset for help on using the changeset viewer.