Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8f7312114c32d445fa64b1bf6075160948a9befe
      
https://github.com/WebKit/WebKit/commit/8f7312114c32d445fa64b1bf6075160948a9befe
  Author: Ryan Reno <rr...@apple.com>
  Date:   2024-07-08 (Mon, 08 Jul 2024)

  Changed paths:
    A LayoutTests/http/tests/resources/document-leak-test.js
    A 
LayoutTests/http/tests/webcodecs/resources/video-decoder-callbacks-frame.html
    A 
LayoutTests/http/tests/webcodecs/video-decoder-callbacks-do-not-leak-expected.txt
    A LayoutTests/http/tests/webcodecs/video-decoder-callbacks-do-not-leak.html
    M Source/WebCore/Modules/webcodecs/WebCodecsErrorCallback.h
    M Source/WebCore/Modules/webcodecs/WebCodecsErrorCallback.idl
    M Source/WebCore/Modules/webcodecs/WebCodecsVideoDecoder.h
    M Source/WebCore/Modules/webcodecs/WebCodecsVideoDecoder.idl
    M Source/WebCore/Modules/webcodecs/WebCodecsVideoFrameOutputCallback.h
    M Source/WebCore/Modules/webcodecs/WebCodecsVideoFrameOutputCallback.idl
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/bindings/js/JSWebCodecsVideoDecoderCustom.cpp

  Log Message:
  -----------
  WebCodecs VideoDecoder callbacks leak the Document object
https://bugs.webkit.org/show_bug.cgi?id=276277
rdar://131208814

Reviewed by Youenn Fablet.

WebCodecsVideoDecoder holds refs to the required output and error
callbacks. They are strong and never cleared which cause them to leak
anything they capture. Interestingly, they manage to leak the Document
even without explicitly capturing the object.

In order to keep them as non-nullable refs we can make the callbacks
Weak and use JSWebCodecsVideoDecoder::visitAdditionalChildren to keep
them alive as long as the owning wrapper is alive.

* LayoutTests/http/tests/resources/document-leak-test.js: Added.
(createFrames):
(iframeForMessage):
(iframeLeaked):
(iframeSentMessage):
(runDocumentLeakTest):
* 
LayoutTests/http/tests/webcodecs/resources/video-decoder-callbacks-frame.html: 
Added.
* 
LayoutTests/http/tests/webcodecs/video-decoder-callbacks-do-not-leak-expected.txt:
 Added.
* LayoutTests/http/tests/webcodecs/video-decoder-callbacks-do-not-leak.html: 
Added.
* Source/WebCore/Modules/webcodecs/WebCodecsErrorCallback.h:
* Source/WebCore/Modules/webcodecs/WebCodecsErrorCallback.idl:
* Source/WebCore/Modules/webcodecs/WebCodecsVideoDecoder.h:
(WebCore::WebCodecsVideoDecoder::outputCallbackConcurrently):
(WebCore::WebCodecsVideoDecoder::errorCallbackConcurrently):
* Source/WebCore/Modules/webcodecs/WebCodecsVideoDecoder.idl:
* Source/WebCore/Modules/webcodecs/WebCodecsVideoFrameOutputCallback.h:
* Source/WebCore/Modules/webcodecs/WebCodecsVideoFrameOutputCallback.idl:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/JSWebCodecsVideoDecoderCustom.cpp: Added.
(WebCore::JSWebCodecsVideoDecoder::visitAdditionalChildren):

Canonical link: https://commits.webkit.org/280738@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to