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

Changeset 280549 in webkit


Ignore:
Timestamp:
Aug 2, 2021, 12:14:48 PM (5 years ago)
Author:
rniwa@webkit.org
Message:

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.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r280548 r280549  
     12021-08-02  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION(r279800): IntersectionObserver may never get a delivery of an observation if the element has been unobserved and is disconnected
     4        https://bugs.webkit.org/show_bug.cgi?id=228679
     5
     6        Reviewed by Chris Dumez.
     7
     8        Added a regression test.
     9
     10        * intersection-observer/intersection-observer-keeps-element-of-queued-entry-alive-expected.txt: Added.
     11        * intersection-observer/intersection-observer-keeps-element-of-queued-entry-alive.html: Added.
     12
    1132021-08-02  Wenson Hsieh  <wenson_hsieh@apple.com>
    214
  • trunk/Source/WebCore/ChangeLog

    r280548 r280549  
     12021-08-02  Ryosuke Niwa  <rniwa@webkit.org>
     2
     3        REGRESSION(r279800): IntersectionObserver may never get a delivery of an observation if the element
     4        has been unobserved and is disconnected
     5        https://bugs.webkit.org/show_bug.cgi?id=228679
     6
     7        Reviewed by Chris Dumez.
     8
     9        The bug was caused by the elements of the pending entries not being considered as opaque roots
     10        of the intersection observer. If the intersection observer is no longer observing those elements,
     11        the JS wrapper of the intersection observer may be collected erroneously.
     12
     13        This patch addresses this issue by explicitly treating the elements of pending entries as
     14        opaque roots of the intersection observer in IntersectionObserver::isReachableFromOpaqueRoots.
     15
     16        Test: intersection-observer/intersection-observer-keeps-element-of-queued-entry-alive.html
     17
     18        * page/IntersectionObserver.cpp:
     19        (WebCore::IntersectionObserver::isReachableFromOpaqueRoots const):
     20
    1212021-08-02  Wenson Hsieh  <wenson_hsieh@apple.com>
    222
  • trunk/Source/WebCore/page/IntersectionObserver.cpp

    r279800 r280549  
    291291            return true;
    292292    }
     293    for (auto& target : m_pendingTargets) {
     294        if (visitor.containsOpaqueRoot(target->opaqueRoot()))
     295            return true;
     296    }
    293297    return false;
    294298}
Note: See TracChangeset for help on using the changeset viewer.