haikuwebkit/LayoutTests/fast/scrolling/scrolling-event-target-gc-e...

6 lines
128 B
Plaintext
Raw Permalink Normal View History

JS wrappers of scroll event targets can get prematurely collected by GC https://bugs.webkit.org/show_bug.cgi?id=204219 Reviewed by Keith Miller. Source/WebCore: This patch addresses the bug that the JS wrappers of the pending scroll event targets can be collected by GC before scroll events are fired. This bug has always existed but it's worse after r252205 because there is more of a time delay between an element is scrolled in RenderLayer sense and when the corresponding scroll event is fired on the element. Fixed the bug by using GCReachableRef to store the pending scroll event targets introduced in r252205 to keep the JS wrappers of those elements & document alive. Test: fast/scrolling/scrolling-event-target-gc.html * dom/Document.cpp: (WebCore::Document::PendingScrollEventTargetList): Added. Wraps Vector<GCReachableRef<ContainerNode>> to avoid including GCReachableRef.h in Document.h. (WebCore::Document::commonTeardown): Clear m_pendingScrollEventTargetList to avoid document leaks. (WebCore::Document::addPendingScrollEventTarget): (WebCore::Document::runScrollSteps): * dom/Document.h: LayoutTests: Added a regression test for adding elements as pending scroll event targets, and removing them from the document before scroll events are fired. * fast/scrolling/scrolling-event-target-gc-expected.txt: Added. * fast/scrolling/scrolling-event-target-gc.html: Added. Canonical link: https://commits.webkit.org/217541@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@252504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-11-15 23:05:51 +00:00
This tests scheduling a scroll event on an element then removing the element.
WebKit should not collect its JS wrappers.
PASS