Fix BorrowMutError crash in form reset (#36726)

Fixes: #36724

Signed-off-by: Taym <haddadi.taym@gmail.com>
This commit is contained in:
Taym Haddadi 2025-04-29 20:59:50 +02:00 committed by GitHub
parent e79520c25a
commit b6a89ae408
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 2 deletions

View file

@ -1270,8 +1270,14 @@ impl HTMLFormElement {
return;
}
let controls = self.controls.borrow();
for child in controls.iter() {
let controls: Vec<_> = self
.controls
.borrow()
.iter()
.map(|c| c.as_rooted())
.collect();
for child in controls {
let child = child.upcast::<Node>();
match child.type_id() {

View file

@ -25,6 +25,13 @@
{}
]
],
"form_reset-crash.html": [
"b23cbf6aefdef8231e2cc4cb0e6416195d5bdf71",
[
null,
{}
]
],
"global-enumerate-crash.html": [
"a77e79b1465bf7555340dd5e9bf94a4c8caa85f2",
[

View file

@ -0,0 +1,7 @@
<!DOCTYPE html>
<form id="form">
<output><textarea></textarea></output>
</form>
<script>
form.reset();
</script>