haikuwebkit/LayoutTests/intersection-observer
Ryosuke Niwa 364dab0f99 Source/WebCore:
REGRESSION(r279800): IntersectionObserver may never get a delivery of an observation if the element
has been unobserved and is disconnected
https://bugs.webkit.org/show_bug.cgi?id=228679

Reviewed by Chris Dumez.

The bug was caused by the elements of the pending entries not being considered as opaque roots
of the intersection observer. If the intersection observer is no longer observing those elements,
the JS wrapper of the intersection observer may be collected erroneously.

This patch addresses this issue by explicitly treating the elements of pending entries as
opaque roots of the intersection observer in IntersectionObserver::isReachableFromOpaqueRoots.

Test: intersection-observer/intersection-observer-keeps-element-of-queued-entry-alive.html

* page/IntersectionObserver.cpp:
(WebCore::IntersectionObserver::isReachableFromOpaqueRoots const):

LayoutTests:
REGRESSION(r279800): IntersectionObserver may never get a delivery of an observation if the element has been unobserved and is disconnected
https://bugs.webkit.org/show_bug.cgi?id=228679

Reviewed by Chris Dumez.

Added a regression test.

* intersection-observer/intersection-observer-keeps-element-of-queued-entry-alive-expected.txt: Added.
* intersection-observer/intersection-observer-keeps-element-of-queued-entry-alive.html: Added.


Canonical link: https://commits.webkit.org/240176@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280549 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-02 19:14:48 +00:00
..
resources
initial-observation-expected.txt
initial-observation.html
intersection-clipped-to-target-expected.txt
intersection-clipped-to-target.html
intersection-observer-callback-after-gc-expected.txt
intersection-observer-callback-after-gc.html
intersection-observer-callback-leak-expected.txt
intersection-observer-callback-leak.html
intersection-observer-callback-timestamp-expected.txt
intersection-observer-callback-timestamp.html
intersection-observer-entry-interface-expected.txt
intersection-observer-entry-interface.html
intersection-observer-entry-keeps-js-wrapper-of-target-alive-expected.txt
intersection-observer-entry-keeps-js-wrapper-of-target-alive.html
intersection-observer-entry-keeps-js-wrappers-of-rects-alive-expected.txt
intersection-observer-entry-keeps-js-wrappers-of-rects-alive.html
intersection-observer-interface-expected.txt
intersection-observer-interface.html
intersection-observer-keeps-element-of-queued-entry-alive-expected.txt
intersection-observer-keeps-element-of-queued-entry-alive.html
intersection-observer-keeps-js-wrapper-of-target-alive-expected.txt
intersection-observer-keeps-js-wrapper-of-target-alive.html
intersection-observer-should-not-leak-observed-nodes-expected.txt
intersection-observer-should-not-leak-observed-nodes.html
no-document-leak-expected.txt
no-document-leak.html
observer-and-callback-without-js-references-expected.txt
observer-and-callback-without-js-references.html
root-element-deleted-expected.txt
root-element-deleted.html
root-element-moved-expected.txt
root-element-moved.html
root-margin-with-zoom-expected.txt
root-margin-with-zoom.html
target-deleted-expected.txt
target-deleted.html