Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 33c1f1877fa266b544427d68f05d3e33e7a027f4
      
https://github.com/WebKit/WebKit/commit/33c1f1877fa266b544427d68f05d3e33e7a027f4
  Author: Ryan Reno <[email protected]>
  Date:   2024-07-01 (Mon, 01 Jul 2024)

  Changed paths:
    A 
LayoutTests/fast/reporting/reporting-observer-callback-does-not-leak-expected.txt
    A LayoutTests/fast/reporting/reporting-observer-callback-does-not-leak.html
    A LayoutTests/fast/reporting/resources/reporting-observer-with-callback.html
    M Source/WebCore/Modules/reporting/ReportingObserver.cpp
    M Source/WebCore/Modules/reporting/ReportingObserver.h
    M Source/WebCore/Modules/reporting/ReportingObserver.idl
    M Source/WebCore/Modules/reporting/ReportingObserverCallback.h
    M Source/WebCore/Modules/reporting/ReportingObserverCallback.idl
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/bindings/js/JSReportingObserverCustom.cpp

  Log Message:
  -----------
  ReportingObserverCallbacks can leak the Document object
https://bugs.webkit.org/show_bug.cgi?id=276080
rdar://130908426

Reviewed by Ryosuke Niwa.

By default callbacks are held as JSC::Strong handles. This creates a GC
Root which will keep anything captured in the callback function alive.
On sites like britannica.com, many documents are captured in this way
and lead to memory leaks.

This patch makes ReportingObserverCallback Weak and keeps the callback
wrapper alive via ReportingObserver's visitAdditionalChildren.

* 
LayoutTests/fast/reporting/reporting-observer-callback-does-not-leak-expected.txt:
 Added.
* LayoutTests/fast/reporting/reporting-observer-callback-does-not-leak.html: 
Added.
* LayoutTests/fast/reporting/resources/reporting-observer-with-callback.html: 
Added.
* Source/WebCore/Modules/reporting/ReportingObserver.cpp:
(WebCore::ReportingObserver::callbackConcurrently):
* Source/WebCore/Modules/reporting/ReportingObserver.h:
* Source/WebCore/Modules/reporting/ReportingObserver.idl:
* Source/WebCore/Modules/reporting/ReportingObserverCallback.h:
* Source/WebCore/Modules/reporting/ReportingObserverCallback.idl:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/JSReportingObserverCustom.cpp: Added.
(WebCore::JSReportingObserver::visitAdditionalChildren):

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



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

Reply via email to