Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 002bcd5e72150ed17b53a718853ca784544080bc
      
https://github.com/WebKit/WebKit/commit/002bcd5e72150ed17b53a718853ca784544080bc
  Author: Ryan Reno <rr...@apple.com>
  Date:   2024-09-11 (Wed, 11 Sep 2024)

  Changed paths:
    A LayoutTests/css-typedom/computed-style-map-lifetime-expected.txt
    A LayoutTests/css-typedom/computed-style-map-lifetime.html
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    A Source/WebCore/bindings/js/JSStylePropertyMapReadOnlyCustom.cpp
    M Source/WebCore/css/typedom/ComputedStylePropertyMapReadOnly.cpp
    M Source/WebCore/css/typedom/ComputedStylePropertyMapReadOnly.h
    M Source/WebCore/css/typedom/DeclaredStylePropertyMap.h
    M Source/WebCore/css/typedom/HashMapStylePropertyMapReadOnly.h
    M Source/WebCore/css/typedom/InlineStylePropertyMap.h
    M Source/WebCore/css/typedom/StylePropertyMapReadOnly.h
    M Source/WebCore/css/typedom/StylePropertyMapReadOnly.idl

  Log Message:
  -----------
  [CSS Typed OM] Fix reference cycle between the computed style property map 
and DOM elements
https://bugs.webkit.org/show_bug.cgi?id=279268
rdar://135356992

Reviewed by Chris Dumez and Matthieu Dubet.

There is a ref cycle between Element.computedStylePropertyMap and the
element itself. This change makes the back reference between
ComputedStylePropertyMapReadOnly and the element weak. To cover the case
where a JS reference is held to the computedStylePropertyMap but the
element has been disconnected from the document and is eligible for GC
the map will keep the element alive.

Verified fix with run-webkit-tests --world-leaks 
imported/w3c/web-platform-tests/css/css-typed-om
and the new layout test to verify GC behavior.

* LayoutTests/css-typedom/computed-style-map-lifetime-expected.txt: Added.
* LayoutTests/css-typedom/computed-style-map-lifetime.html: Added.
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/bindings/js/JSStylePropertyMapReadOnlyCustom.cpp: Copied from 
Source/WebCore/css/typedom/ComputedStylePropertyMapReadOnly.h.
(WebCore::JSStylePropertyMapReadOnly::visitAdditionalChildren):
* Source/WebCore/css/typedom/ComputedStylePropertyMapReadOnly.h:
* Source/WebCore/css/typedom/DeclaredStylePropertyMap.h:
* Source/WebCore/css/typedom/HashMapStylePropertyMapReadOnly.h:
* Source/WebCore/css/typedom/InlineStylePropertyMap.h:
* Source/WebCore/css/typedom/StylePropertyMapReadOnly.h:
* Source/WebCore/css/typedom/StylePropertyMapReadOnly.idl:

Canonical link: https://commits.webkit.org/283490@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