Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cffe1bb496638c3ba8ceb32be54023e52e0b8513
      
https://github.com/WebKit/WebKit/commit/cffe1bb496638c3ba8ceb32be54023e52e0b8513
  Author: Nipun Shukla <[email protected]>
  Date:   2026-06-24 (Wed, 24 Jun 2026)

  Changed paths:
    A LayoutTests/fast/dom/MutationObserver/no-document-leak-expected.txt
    A LayoutTests/fast/dom/MutationObserver/no-document-leak.html
    A 
LayoutTests/fast/dom/MutationObserver/resources/no-document-leak-frame.html
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/dom/WindowEventLoop.cpp
    M Source/WebCore/dom/WindowEventLoop.h

  Log Message:
  -----------
  Document leak in MutationObserver
https://bugs.webkit.org/show_bug.cgi?id=317618
rdar://178665935

Reviewed by Chris Dumez.

Previously, stopping a document didn't remove its MutationObservers from
the shared WindowEventLoop's observer sets, so an observer left parked there
with a pending mutation record keeps its target nodes, and therefore the
whole document, alive forever.

This is resolved by draining a stopped context's MutationObservers from those
sets in Document::stopActiveDOMObjects().

Test: fast/dom/MutationObserver/no-document-leak.html

* LayoutTests/fast/dom/MutationObserver/no-document-leak-expected.txt: Added.
* LayoutTests/fast/dom/MutationObserver/no-document-leak.html: Added.
* LayoutTests/fast/dom/MutationObserver/resources/no-document-leak-frame.html: 
Added.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::stopActiveDOMObjects):
* Source/WebCore/dom/WindowEventLoop.cpp:
(WebCore::WindowEventLoop::removeMutationObserversForContext):
* Source/WebCore/dom/WindowEventLoop.h:

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to