mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
script: Avoid double borrow crash on iframe focus (#35742)
Signed-off-by: Seán de Búrca <leftmostcat@gmail.com>
This commit is contained in:
parent
28cea920ec
commit
649291bf69
3 changed files with 28 additions and 4 deletions
|
@ -2498,10 +2498,18 @@ impl ScriptThread {
|
|||
.find_document(parent_pipeline_id)
|
||||
.unwrap();
|
||||
|
||||
let iframes = document.iframes();
|
||||
if let Some(iframe) = iframes.get(browsing_context_id) {
|
||||
document.request_focus(Some(iframe.element.upcast()), FocusType::Parent, can_gc);
|
||||
}
|
||||
let Some(iframe_element_root) = ({
|
||||
// Enclose `iframes()` call and create a new root to avoid retaining
|
||||
// borrow.
|
||||
let iframes = document.iframes();
|
||||
iframes
|
||||
.get(browsing_context_id)
|
||||
.map(|iframe| DomRoot::from_ref(iframe.element.upcast()))
|
||||
}) else {
|
||||
return;
|
||||
};
|
||||
|
||||
document.request_focus(Some(&iframe_element_root), FocusType::Parent, can_gc);
|
||||
}
|
||||
|
||||
fn handle_post_message_msg(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue