From d33445a4ead9c4c7b77e4593a0f609c4cf9a384a Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Thu, 24 Apr 2025 14:36:34 +0200 Subject: [PATCH] LibWeb: Notify ObservableArray observer about deletions in clear() Another +1 WPT subtest! --- Libraries/LibWeb/WebIDL/ObservableArray.cpp | 3 ++- .../css/cssom/CSSStyleSheet-constructable-invalidation.txt | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/LibWeb/WebIDL/ObservableArray.cpp b/Libraries/LibWeb/WebIDL/ObservableArray.cpp index 13c76e61570..789f2ceebcc 100644 --- a/Libraries/LibWeb/WebIDL/ObservableArray.cpp +++ b/Libraries/LibWeb/WebIDL/ObservableArray.cpp @@ -69,7 +69,8 @@ JS::ThrowCompletionOr ObservableArray::append(JS::Value value) void ObservableArray::clear() { while (!indexed_properties().is_empty()) { - indexed_properties().storage()->take_first(); + auto deleted_value = indexed_properties().storage()->take_first().value; + MUST(m_on_delete_an_indexed_value->function()(deleted_value)); } } diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/CSSStyleSheet-constructable-invalidation.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/CSSStyleSheet-constructable-invalidation.txt index b8fecef6a39..53c4124707f 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/CSSStyleSheet-constructable-invalidation.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/CSSStyleSheet-constructable-invalidation.txt @@ -2,8 +2,7 @@ Harness status: OK Found 3 tests -2 Pass -1 Fail -Fail mutating constructed CSSStyleSheet applied to root invalidates styles +3 Pass +Pass mutating constructed CSSStyleSheet applied to root invalidates styles Pass mutating constructed CSSStyleSheet applied to shadowdom invalidates styles Pass mutating dependent constructed CSSStyleSheet applied to shadowdom invalidates styles \ No newline at end of file