mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 01:32:14 -05:00
LibWeb: Do not store resize observer entries in a plain vector
This is not safe from GC. Unfortunately we cannot add a test to capture the issue, as the allocation which may trigger GC is internal and not observable from JS.
This commit is contained in:
parent
be1d400369
commit
04648d93d4
Notes:
github-actions[bot]
2024-10-31 23:37:30 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/04648d93d42 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2088
3 changed files with 3 additions and 3 deletions
|
@ -5131,7 +5131,7 @@ size_t Document::broadcast_active_resize_observations()
|
|||
}
|
||||
|
||||
// 2. Let entries be an empty list of ResizeObserverEntryies.
|
||||
Vector<JS::NonnullGCPtr<ResizeObserver::ResizeObserverEntry>> entries;
|
||||
JS::MarkedVector<JS::NonnullGCPtr<ResizeObserver::ResizeObserverEntry>> entries(heap());
|
||||
|
||||
// 3. For each observation in [[activeTargets]] perform these steps:
|
||||
for (auto const& observation : observer->active_targets()) {
|
||||
|
|
|
@ -97,7 +97,7 @@ void ResizeObserver::disconnect()
|
|||
m_active_targets.clear();
|
||||
}
|
||||
|
||||
void ResizeObserver::invoke_callback(Vector<JS::NonnullGCPtr<ResizeObserverEntry>>& entries) const
|
||||
void ResizeObserver::invoke_callback(ReadonlySpan<JS::NonnullGCPtr<ResizeObserverEntry>> entries) const
|
||||
{
|
||||
auto& callback = *m_callback;
|
||||
auto& realm = callback.callback_context->realm();
|
||||
|
|
|
@ -31,7 +31,7 @@ public:
|
|||
void unobserve(DOM::Element& target);
|
||||
void disconnect();
|
||||
|
||||
void invoke_callback(Vector<JS::NonnullGCPtr<ResizeObserverEntry>>& entries) const;
|
||||
void invoke_callback(ReadonlySpan<JS::NonnullGCPtr<ResizeObserverEntry>> entries) const;
|
||||
|
||||
Vector<JS::NonnullGCPtr<ResizeObservation>>& observation_targets() { return m_observation_targets; }
|
||||
Vector<JS::NonnullGCPtr<ResizeObservation>>& active_targets() { return m_active_targets; }
|
||||
|
|
Loading…
Reference in a new issue