[35131] Borrow hazard in Document::broadcast_active_resize_observations (#35168)

* removed panic status: added cloned and collect

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>

* applied fmt

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>

---------

Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
This commit is contained in:
Domenico Rizzo 2025-01-25 01:42:13 +01:00 committed by GitHub
parent 81b09790cd
commit fe5a075766
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 4 deletions

View file

@ -3213,12 +3213,14 @@ impl Document {
// Breaking potential re-borrow cycle on `resize_observers`:
// broadcasting resize observations calls into a JS callback,
// which can add new observers.
for observer in self
let iterator: Vec<DomRoot<ResizeObserver>> = self
.resize_observers
.borrow()
.iter()
.map(|obs| DomRoot::from_ref(&**obs))
{
.cloned()
.map(|obs| DomRoot::from_ref(&*obs))
.collect();
for observer in iterator {
observer.broadcast_active_resize_observations(&mut shallowest, can_gc);
}
shallowest

View file

@ -1,4 +1,5 @@
[calculate-depth-for-node.html]
expected: CRASH
expected: ERROR
["Calculate depth for node" algorithm with Shadow DOM]
expected: FAIL