haikuwebkit/LayoutTests/intersection-observer/intersection-observer-callb...

4 lines
86 B
Plaintext
Raw Permalink Normal View History

Source/WebCore: IntersectionObserverCallback leaks https://bugs.webkit.org/show_bug.cgi?id=218225 Reviewed by Ryosuke Niwa. Unless the page is unloaded, JSIntersectionObserverCallback and objects inside it can not be garbage collected properly. To fix this, make IntersectionObserverCallback as a weak callback. To keep it alive, in JSIntersectionObserver::visitAdditionalChildren add the callback to visitor. Test: intersection-observer/intersection-observer-callback-leak.html * Sources.txt: * WebCore.xcodeproj/project.pbxproj: * bindings/js/JSIntersectionObserverCustom.cpp: Copied from Source/WebCore/page/IntersectionObserverCallback.idl. (WebCore::JSIntersectionObserver::visitAdditionalChildren): * page/IntersectionObserver.h: (WebCore::IntersectionObserver::callbackConcurrently): * page/IntersectionObserver.idl: * page/IntersectionObserverCallback.h: (WebCore::IntersectionObserverCallback::hasCallback const): * page/IntersectionObserverCallback.idl: LayoutTests: IntersectionObserverCallback leak https://bugs.webkit.org/show_bug.cgi?id=218225 Reviewed by Ryosuke Niwa. In intersection-observer-callback-after-gc.html, the callbacks with observed targets deleted should stay alive as long as observers are alive. In intersection-observer-callback-leak.html, use `internals.numberOfLiveNodes` to check that the objects inside JSIntersectionObserverCallback can be garbage collected. * intersection-observer/intersection-observer-callback-after-gc-expected.txt: Added. * intersection-observer/intersection-observer-callback-after-gc.html: Added. * intersection-observer/intersection-observer-callback-leak-expected.txt: Added. * intersection-observer/intersection-observer-callback-leak.html: Added. Canonical link: https://commits.webkit.org/231015@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@269141 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-29 08:15:18 +00:00
PASS test: IntersectionObserverCallbacks stay alive if according observers is alive