clippy: Fix clippy Problems in components/scripts (#31759)

* revert cargo

* revert cargo

* fic clippy problems
This commit is contained in:
Rosemary Ajayi 2024-03-19 22:22:37 +00:00 committed by GitHub
parent 96e5e776d2
commit 865f6e621f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 69 additions and 81 deletions

View file

@ -2089,13 +2089,13 @@ impl Node {
); );
} else { } else {
// Step 7.7.2.2. // Step 7.7.2.2.
try_upgrade_element(&*descendant); try_upgrade_element(&descendant);
} }
} }
} }
} }
if let SuppressObserver::Unsuppressed = suppress_observers { if let SuppressObserver::Unsuppressed = suppress_observers {
vtable_for(&parent).children_changed(&ChildrenMutation::insert( vtable_for(parent).children_changed(&ChildrenMutation::insert(
previous_sibling.as_deref(), previous_sibling.as_deref(),
new_nodes, new_nodes,
child, child,
@ -2107,7 +2107,7 @@ impl Node {
prev: previous_sibling.as_deref(), prev: previous_sibling.as_deref(),
next: child, next: child,
}; };
MutationObserver::queue_a_mutation_record(&parent, mutation); MutationObserver::queue_a_mutation_record(parent, mutation);
} }
node.owner_doc().remove_script_and_layout_blocker(); node.owner_doc().remove_script_and_layout_blocker();
} }
@ -2117,7 +2117,7 @@ impl Node {
parent.owner_doc().add_script_and_layout_blocker(); parent.owner_doc().add_script_and_layout_blocker();
// Step 1. // Step 1.
if let Some(node) = node { if let Some(node) = node {
Node::adopt(node, &*parent.owner_doc()); Node::adopt(node, &parent.owner_doc());
} }
// Step 2. // Step 2.
rooted_vec!(let removed_nodes <- parent.children()); rooted_vec!(let removed_nodes <- parent.children());
@ -2142,7 +2142,7 @@ impl Node {
Node::insert(node, parent, None, SuppressObserver::Suppressed); Node::insert(node, parent, None, SuppressObserver::Suppressed);
} }
// Step 6. // Step 6.
vtable_for(&parent).children_changed(&ChildrenMutation::replace_all( vtable_for(parent).children_changed(&ChildrenMutation::replace_all(
removed_nodes.r(), removed_nodes.r(),
added_nodes, added_nodes,
)); ));
@ -2154,7 +2154,7 @@ impl Node {
prev: None, prev: None,
next: None, next: None,
}; };
MutationObserver::queue_a_mutation_record(&parent, mutation); MutationObserver::queue_a_mutation_record(parent, mutation);
} }
parent.owner_doc().remove_script_and_layout_blocker(); parent.owner_doc().remove_script_and_layout_blocker();
} }
@ -2216,9 +2216,9 @@ impl Node {
// Step 11. transient registered observers // Step 11. transient registered observers
// Step 12. // Step 12.
if let SuppressObserver::Unsuppressed = suppress_observers { if let SuppressObserver::Unsuppressed = suppress_observers {
vtable_for(&parent).children_changed(&ChildrenMutation::replace( vtable_for(parent).children_changed(&ChildrenMutation::replace(
old_previous_sibling.as_deref(), old_previous_sibling.as_deref(),
&Some(&node), &Some(node),
&[], &[],
old_next_sibling.as_deref(), old_next_sibling.as_deref(),
)); ));
@ -2230,7 +2230,7 @@ impl Node {
prev: old_previous_sibling.as_deref(), prev: old_previous_sibling.as_deref(),
next: old_next_sibling.as_deref(), next: old_next_sibling.as_deref(),
}; };
MutationObserver::queue_a_mutation_record(&parent, mutation); MutationObserver::queue_a_mutation_record(parent, mutation);
} }
parent.owner_doc().remove_script_and_layout_blocker(); parent.owner_doc().remove_script_and_layout_blocker();
} }
@ -2360,7 +2360,7 @@ impl Node {
} }
// Step 5: cloning steps. // Step 5: cloning steps.
vtable_for(&node).cloning_steps(&copy, maybe_doc, clone_children); vtable_for(node).cloning_steps(&copy, maybe_doc, clone_children);
// Step 6. // Step 6.
if clone_children == CloneChildrenFlag::CloneChildren { if clone_children == CloneChildrenFlag::CloneChildren {
@ -2387,7 +2387,7 @@ impl Node {
pub fn collect_text_contents<T: Iterator<Item = DomRoot<Node>>>(iterator: T) -> DOMString { pub fn collect_text_contents<T: Iterator<Item = DomRoot<Node>>>(iterator: T) -> DOMString {
let mut content = String::new(); let mut content = String::new();
for node in iterator { for node in iterator {
if let Some(ref text) = node.downcast::<Text>() { if let Some(text) = node.downcast::<Text>() {
content.push_str(&text.upcast::<CharacterData>().data()); content.push_str(&text.upcast::<CharacterData>().data());
} }
} }
@ -2477,7 +2477,7 @@ impl NodeMethods for Node {
// https://dom.spec.whatwg.org/#dom-node-isconnected // https://dom.spec.whatwg.org/#dom-node-isconnected
fn IsConnected(&self) -> bool { fn IsConnected(&self) -> bool {
return self.is_connected(); self.is_connected()
} }
// https://dom.spec.whatwg.org/#dom-node-ownerdocument // https://dom.spec.whatwg.org/#dom-node-ownerdocument
@ -2758,7 +2758,7 @@ impl NodeMethods for Node {
Node::insert(node, self, reference_child, SuppressObserver::Suppressed); Node::insert(node, self, reference_child, SuppressObserver::Suppressed);
// Step 14. // Step 14.
vtable_for(&self).children_changed(&ChildrenMutation::replace( vtable_for(self).children_changed(&ChildrenMutation::replace(
previous_sibling.as_deref(), previous_sibling.as_deref(),
&removed_child, &removed_child,
nodes, nodes,

View file

@ -311,9 +311,7 @@ impl QueuedTaskConversion for MainThreadScriptMsg {
_ => return None, _ => return None,
}; };
match script_msg { match script_msg {
CommonScriptMsg::Task(_category, _boxed, pipeline_id, _task_source) => { CommonScriptMsg::Task(_category, _boxed, pipeline_id, _task_source) => *pipeline_id,
pipeline_id.clone()
},
_ => None, _ => None,
} }
} }
@ -808,7 +806,7 @@ impl ScriptThreadFactory for ScriptThread {
let top_level_browsing_context_id = state.top_level_browsing_context_id; let top_level_browsing_context_id = state.top_level_browsing_context_id;
let parent_info = state.parent_info; let parent_info = state.parent_info;
let opener = state.opener; let opener = state.opener;
let secure = load_data.inherited_secure_context.clone(); let secure = load_data.inherited_secure_context;
let mem_profiler_chan = state.mem_profiler_chan.clone(); let mem_profiler_chan = state.mem_profiler_chan.clone();
let window_size = state.window_size; let window_size = state.window_size;
@ -1126,7 +1124,7 @@ impl ScriptThread {
.iter() .iter()
.filter_map(|(id, document)| { .filter_map(|(id, document)| {
if document.is_fully_active() { if document.is_fully_active() {
Some(id.clone()) Some(id)
} else { } else {
None None
} }
@ -1185,7 +1183,7 @@ impl ScriptThread {
is_headless: script_thread.headless, is_headless: script_thread.headless,
user_agent: script_thread.user_agent.clone(), user_agent: script_thread.user_agent.clone(),
gpu_id_hub: script_thread.gpu_id_hub.clone(), gpu_id_hub: script_thread.gpu_id_hub.clone(),
inherited_secure_context: script_thread.inherited_secure_context.clone(), inherited_secure_context: script_thread.inherited_secure_context,
}; };
Rc::new(WorkletThreadPool::spawn(init)) Rc::new(WorkletThreadPool::spawn(init))
}) })
@ -1335,7 +1333,7 @@ impl ScriptThread {
}; };
let background_hang_monitor = state.background_hang_monitor_register.register_component( let background_hang_monitor = state.background_hang_monitor_register.register_component(
MonitoredComponentId(state.id.clone(), MonitoredComponentType::Script), MonitoredComponentId(state.id, MonitoredComponentType::Script),
Duration::from_millis(1000), Duration::from_millis(1000),
Duration::from_millis(5000), Duration::from_millis(5000),
Some(Box::new(background_hang_monitor_exit_signal)), Some(Box::new(background_hang_monitor_exit_signal)),
@ -2186,25 +2184,25 @@ impl ScriptThread {
None => warn!("Message sent to closed pipeline {}.", id), None => warn!("Message sent to closed pipeline {}.", id),
}, },
DevtoolScriptControlMsg::GetRootNode(id, reply) => { DevtoolScriptControlMsg::GetRootNode(id, reply) => {
devtools::handle_get_root_node(&*documents, id, reply) devtools::handle_get_root_node(&documents, id, reply)
}, },
DevtoolScriptControlMsg::GetDocumentElement(id, reply) => { DevtoolScriptControlMsg::GetDocumentElement(id, reply) => {
devtools::handle_get_document_element(&*documents, id, reply) devtools::handle_get_document_element(&documents, id, reply)
}, },
DevtoolScriptControlMsg::GetChildren(id, node_id, reply) => { DevtoolScriptControlMsg::GetChildren(id, node_id, reply) => {
devtools::handle_get_children(&*documents, id, node_id, reply) devtools::handle_get_children(&documents, id, node_id, reply)
}, },
DevtoolScriptControlMsg::GetLayout(id, node_id, reply) => { DevtoolScriptControlMsg::GetLayout(id, node_id, reply) => {
devtools::handle_get_layout(&*documents, id, node_id, reply) devtools::handle_get_layout(&documents, id, node_id, reply)
}, },
DevtoolScriptControlMsg::ModifyAttribute(id, node_id, modifications) => { DevtoolScriptControlMsg::ModifyAttribute(id, node_id, modifications) => {
devtools::handle_modify_attribute(&*documents, id, node_id, modifications) devtools::handle_modify_attribute(&documents, id, node_id, modifications)
}, },
DevtoolScriptControlMsg::WantsLiveNotifications(id, to_send) => match documents DevtoolScriptControlMsg::WantsLiveNotifications(id, to_send) => match documents
.find_window(id) .find_window(id)
{ {
Some(window) => devtools::handle_wants_live_notifications(window.upcast(), to_send), Some(window) => devtools::handle_wants_live_notifications(window.upcast(), to_send),
None => return warn!("Message sent to closed pipeline {}.", id), None => warn!("Message sent to closed pipeline {}.", id),
}, },
DevtoolScriptControlMsg::SetTimelineMarkers(id, marker_types, reply) => { DevtoolScriptControlMsg::SetTimelineMarkers(id, marker_types, reply) => {
devtools::handle_set_timeline_markers(&*documents, id, marker_types, reply) devtools::handle_set_timeline_markers(&*documents, id, marker_types, reply)
@ -2213,9 +2211,9 @@ impl ScriptThread {
devtools::handle_drop_timeline_markers(&*documents, id, marker_types) devtools::handle_drop_timeline_markers(&*documents, id, marker_types)
}, },
DevtoolScriptControlMsg::RequestAnimationFrame(id, name) => { DevtoolScriptControlMsg::RequestAnimationFrame(id, name) => {
devtools::handle_request_animation_frame(&*documents, id, name) devtools::handle_request_animation_frame(&documents, id, name)
}, },
DevtoolScriptControlMsg::Reload(id) => devtools::handle_reload(&*documents, id), DevtoolScriptControlMsg::Reload(id) => devtools::handle_reload(&documents, id),
} }
} }
@ -2246,14 +2244,14 @@ impl ScriptThread {
let documents = self.documents.borrow(); let documents = self.documents.borrow();
match msg { match msg {
WebDriverScriptCommand::AddCookie(params, reply) => { WebDriverScriptCommand::AddCookie(params, reply) => {
webdriver_handlers::handle_add_cookie(&*documents, pipeline_id, params, reply) webdriver_handlers::handle_add_cookie(&documents, pipeline_id, params, reply)
}, },
WebDriverScriptCommand::DeleteCookies(reply) => { WebDriverScriptCommand::DeleteCookies(reply) => {
webdriver_handlers::handle_delete_cookies(&*documents, pipeline_id, reply) webdriver_handlers::handle_delete_cookies(&documents, pipeline_id, reply)
}, },
WebDriverScriptCommand::FindElementCSS(selector, reply) => { WebDriverScriptCommand::FindElementCSS(selector, reply) => {
webdriver_handlers::handle_find_element_css( webdriver_handlers::handle_find_element_css(
&*documents, &documents,
pipeline_id, pipeline_id,
selector, selector,
reply, reply,
@ -2261,7 +2259,7 @@ impl ScriptThread {
}, },
WebDriverScriptCommand::FindElementLinkText(selector, partial, reply) => { WebDriverScriptCommand::FindElementLinkText(selector, partial, reply) => {
webdriver_handlers::handle_find_element_link_text( webdriver_handlers::handle_find_element_link_text(
&*documents, &documents,
pipeline_id, pipeline_id,
selector, selector,
partial, partial,
@ -2270,7 +2268,7 @@ impl ScriptThread {
}, },
WebDriverScriptCommand::FindElementTagName(selector, reply) => { WebDriverScriptCommand::FindElementTagName(selector, reply) => {
webdriver_handlers::handle_find_element_tag_name( webdriver_handlers::handle_find_element_tag_name(
&*documents, &documents,
pipeline_id, pipeline_id,
selector, selector,
reply, reply,
@ -2278,7 +2276,7 @@ impl ScriptThread {
}, },
WebDriverScriptCommand::FindElementsCSS(selector, reply) => { WebDriverScriptCommand::FindElementsCSS(selector, reply) => {
webdriver_handlers::handle_find_elements_css( webdriver_handlers::handle_find_elements_css(
&*documents, &documents,
pipeline_id, pipeline_id,
selector, selector,
reply, reply,
@ -2286,7 +2284,7 @@ impl ScriptThread {
}, },
WebDriverScriptCommand::FindElementsLinkText(selector, partial, reply) => { WebDriverScriptCommand::FindElementsLinkText(selector, partial, reply) => {
webdriver_handlers::handle_find_elements_link_text( webdriver_handlers::handle_find_elements_link_text(
&*documents, &documents,
pipeline_id, pipeline_id,
selector, selector,
partial, partial,
@ -2295,7 +2293,7 @@ impl ScriptThread {
}, },
WebDriverScriptCommand::FindElementsTagName(selector, reply) => { WebDriverScriptCommand::FindElementsTagName(selector, reply) => {
webdriver_handlers::handle_find_elements_tag_name( webdriver_handlers::handle_find_elements_tag_name(
&*documents, &documents,
pipeline_id, pipeline_id,
selector, selector,
reply, reply,
@ -2303,7 +2301,7 @@ impl ScriptThread {
}, },
WebDriverScriptCommand::FindElementElementCSS(selector, element_id, reply) => { WebDriverScriptCommand::FindElementElementCSS(selector, element_id, reply) => {
webdriver_handlers::handle_find_element_element_css( webdriver_handlers::handle_find_element_element_css(
&*documents, &documents,
pipeline_id, pipeline_id,
element_id, element_id,
selector, selector,
@ -2316,7 +2314,7 @@ impl ScriptThread {
partial, partial,
reply, reply,
) => webdriver_handlers::handle_find_element_element_link_text( ) => webdriver_handlers::handle_find_element_element_link_text(
&*documents, &documents,
pipeline_id, pipeline_id,
element_id, element_id,
selector, selector,
@ -2325,7 +2323,7 @@ impl ScriptThread {
), ),
WebDriverScriptCommand::FindElementElementTagName(selector, element_id, reply) => { WebDriverScriptCommand::FindElementElementTagName(selector, element_id, reply) => {
webdriver_handlers::handle_find_element_element_tag_name( webdriver_handlers::handle_find_element_element_tag_name(
&*documents, &documents,
pipeline_id, pipeline_id,
element_id, element_id,
selector, selector,
@ -2334,7 +2332,7 @@ impl ScriptThread {
}, },
WebDriverScriptCommand::FindElementElementsCSS(selector, element_id, reply) => { WebDriverScriptCommand::FindElementElementsCSS(selector, element_id, reply) => {
webdriver_handlers::handle_find_element_elements_css( webdriver_handlers::handle_find_element_elements_css(
&*documents, &documents,
pipeline_id, pipeline_id,
element_id, element_id,
selector, selector,
@ -2347,7 +2345,7 @@ impl ScriptThread {
partial, partial,
reply, reply,
) => webdriver_handlers::handle_find_element_elements_link_text( ) => webdriver_handlers::handle_find_element_elements_link_text(
&*documents, &documents,
pipeline_id, pipeline_id,
element_id, element_id,
selector, selector,
@ -2356,7 +2354,7 @@ impl ScriptThread {
), ),
WebDriverScriptCommand::FindElementElementsTagName(selector, element_id, reply) => { WebDriverScriptCommand::FindElementElementsTagName(selector, element_id, reply) => {
webdriver_handlers::handle_find_element_elements_tag_name( webdriver_handlers::handle_find_element_elements_tag_name(
&*documents, &documents,
pipeline_id, pipeline_id,
element_id, element_id,
selector, selector,
@ -2364,39 +2362,29 @@ impl ScriptThread {
) )
}, },
WebDriverScriptCommand::FocusElement(element_id, reply) => { WebDriverScriptCommand::FocusElement(element_id, reply) => {
webdriver_handlers::handle_focus_element( webdriver_handlers::handle_focus_element(&documents, pipeline_id, element_id, reply)
&*documents,
pipeline_id,
element_id,
reply,
)
}, },
WebDriverScriptCommand::ElementClick(element_id, reply) => { WebDriverScriptCommand::ElementClick(element_id, reply) => {
webdriver_handlers::handle_element_click( webdriver_handlers::handle_element_click(&documents, pipeline_id, element_id, reply)
&*documents,
pipeline_id,
element_id,
reply,
)
}, },
WebDriverScriptCommand::GetActiveElement(reply) => { WebDriverScriptCommand::GetActiveElement(reply) => {
webdriver_handlers::handle_get_active_element(&*documents, pipeline_id, reply) webdriver_handlers::handle_get_active_element(&documents, pipeline_id, reply)
}, },
WebDriverScriptCommand::GetPageSource(reply) => { WebDriverScriptCommand::GetPageSource(reply) => {
webdriver_handlers::handle_get_page_source(&*documents, pipeline_id, reply) webdriver_handlers::handle_get_page_source(&documents, pipeline_id, reply)
}, },
WebDriverScriptCommand::GetCookies(reply) => { WebDriverScriptCommand::GetCookies(reply) => {
webdriver_handlers::handle_get_cookies(&*documents, pipeline_id, reply) webdriver_handlers::handle_get_cookies(&documents, pipeline_id, reply)
}, },
WebDriverScriptCommand::GetCookie(name, reply) => { WebDriverScriptCommand::GetCookie(name, reply) => {
webdriver_handlers::handle_get_cookie(&*documents, pipeline_id, name, reply) webdriver_handlers::handle_get_cookie(&documents, pipeline_id, name, reply)
}, },
WebDriverScriptCommand::GetElementTagName(node_id, reply) => { WebDriverScriptCommand::GetElementTagName(node_id, reply) => {
webdriver_handlers::handle_get_name(&*documents, pipeline_id, node_id, reply) webdriver_handlers::handle_get_name(&documents, pipeline_id, node_id, reply)
}, },
WebDriverScriptCommand::GetElementAttribute(node_id, name, reply) => { WebDriverScriptCommand::GetElementAttribute(node_id, name, reply) => {
webdriver_handlers::handle_get_attribute( webdriver_handlers::handle_get_attribute(
&*documents, &documents,
pipeline_id, pipeline_id,
node_id, node_id,
name, name,
@ -2405,7 +2393,7 @@ impl ScriptThread {
}, },
WebDriverScriptCommand::GetElementProperty(node_id, name, reply) => { WebDriverScriptCommand::GetElementProperty(node_id, name, reply) => {
webdriver_handlers::handle_get_property( webdriver_handlers::handle_get_property(
&*documents, &documents,
pipeline_id, pipeline_id,
node_id, node_id,
name, name,
@ -2413,25 +2401,25 @@ impl ScriptThread {
) )
}, },
WebDriverScriptCommand::GetElementCSS(node_id, name, reply) => { WebDriverScriptCommand::GetElementCSS(node_id, name, reply) => {
webdriver_handlers::handle_get_css(&*documents, pipeline_id, node_id, name, reply) webdriver_handlers::handle_get_css(&documents, pipeline_id, node_id, name, reply)
}, },
WebDriverScriptCommand::GetElementRect(node_id, reply) => { WebDriverScriptCommand::GetElementRect(node_id, reply) => {
webdriver_handlers::handle_get_rect(&*documents, pipeline_id, node_id, reply) webdriver_handlers::handle_get_rect(&documents, pipeline_id, node_id, reply)
}, },
WebDriverScriptCommand::GetBoundingClientRect(node_id, reply) => { WebDriverScriptCommand::GetBoundingClientRect(node_id, reply) => {
webdriver_handlers::handle_get_bounding_client_rect( webdriver_handlers::handle_get_bounding_client_rect(
&*documents, &documents,
pipeline_id, pipeline_id,
node_id, node_id,
reply, reply,
) )
}, },
WebDriverScriptCommand::GetElementText(node_id, reply) => { WebDriverScriptCommand::GetElementText(node_id, reply) => {
webdriver_handlers::handle_get_text(&*documents, pipeline_id, node_id, reply) webdriver_handlers::handle_get_text(&documents, pipeline_id, node_id, reply)
}, },
WebDriverScriptCommand::GetElementInViewCenterPoint(node_id, reply) => { WebDriverScriptCommand::GetElementInViewCenterPoint(node_id, reply) => {
webdriver_handlers::handle_get_element_in_view_center_point( webdriver_handlers::handle_get_element_in_view_center_point(
&*documents, &documents,
pipeline_id, pipeline_id,
node_id, node_id,
reply, reply,
@ -2439,23 +2427,23 @@ impl ScriptThread {
}, },
WebDriverScriptCommand::GetBrowsingContextId(webdriver_frame_id, reply) => { WebDriverScriptCommand::GetBrowsingContextId(webdriver_frame_id, reply) => {
webdriver_handlers::handle_get_browsing_context_id( webdriver_handlers::handle_get_browsing_context_id(
&*documents, &documents,
pipeline_id, pipeline_id,
webdriver_frame_id, webdriver_frame_id,
reply, reply,
) )
}, },
WebDriverScriptCommand::GetUrl(reply) => { WebDriverScriptCommand::GetUrl(reply) => {
webdriver_handlers::handle_get_url(&*documents, pipeline_id, reply) webdriver_handlers::handle_get_url(&documents, pipeline_id, reply)
}, },
WebDriverScriptCommand::IsEnabled(element_id, reply) => { WebDriverScriptCommand::IsEnabled(element_id, reply) => {
webdriver_handlers::handle_is_enabled(&*documents, pipeline_id, element_id, reply) webdriver_handlers::handle_is_enabled(&documents, pipeline_id, element_id, reply)
}, },
WebDriverScriptCommand::IsSelected(element_id, reply) => { WebDriverScriptCommand::IsSelected(element_id, reply) => {
webdriver_handlers::handle_is_selected(&*documents, pipeline_id, element_id, reply) webdriver_handlers::handle_is_selected(&documents, pipeline_id, element_id, reply)
}, },
WebDriverScriptCommand::GetTitle(reply) => { WebDriverScriptCommand::GetTitle(reply) => {
webdriver_handlers::handle_get_title(&*documents, pipeline_id, reply) webdriver_handlers::handle_get_title(&documents, pipeline_id, reply)
}, },
_ => (), _ => (),
} }
@ -2547,7 +2535,7 @@ impl ScriptThread {
window_size, window_size,
load_data.url.clone(), load_data.url.clone(),
origin, origin,
load_data.inherited_secure_context.clone(), load_data.inherited_secure_context,
); );
if load_data.url.as_str() == "about:blank" { if load_data.url.as_str() == "about:blank" {
self.start_page_load_about_blank(new_load, load_data.js_eval_result); self.start_page_load_about_blank(new_load, load_data.js_eval_result);
@ -2664,7 +2652,7 @@ impl ScriptThread {
// FIXME: synchronously talks to constellation. // FIXME: synchronously talks to constellation.
// send the required info as part of postmessage instead. // send the required info as part of postmessage instead.
let source = match self.remote_window_proxy( let source = match self.remote_window_proxy(
&*window.global(), &window.global(),
source_browsing_context, source_browsing_context,
source_pipeline_id, source_pipeline_id,
None, None,
@ -2678,7 +2666,7 @@ impl ScriptThread {
Some(source) => source, Some(source) => source,
}; };
// FIXME(#22512): enqueues a task; unnecessary delay. // FIXME(#22512): enqueues a task; unnecessary delay.
window.post_message(origin, source_origin, &*source, data) window.post_message(origin, source_origin, &source, data)
}, },
} }
} }
@ -2723,7 +2711,7 @@ impl ScriptThread {
// Ensure that the state of any local window proxies accurately reflects // Ensure that the state of any local window proxies accurately reflects
// the new pipeline. // the new pipeline.
let _ = self.local_window_proxy( let _ = self.local_window_proxy(
&*window, &window,
browsing_context_id, browsing_context_id,
top_level_browsing_context_id, top_level_browsing_context_id,
Some(parent_pipeline_id), Some(parent_pipeline_id),
@ -2744,7 +2732,7 @@ impl ScriptThread {
let window = self.documents.borrow().find_window(pipeline_id); let window = self.documents.borrow().find_window(pipeline_id);
match window { match window {
None => { None => {
return warn!( warn!(
"update history state after pipeline {} closed.", "update history state after pipeline {} closed.",
pipeline_id pipeline_id
); );
@ -2761,7 +2749,7 @@ impl ScriptThread {
let window = self.documents.borrow().find_window(pipeline_id); let window = self.documents.borrow().find_window(pipeline_id);
match window { match window {
None => { None => {
return warn!( warn!(
"update history state after pipeline {} closed.", "update history state after pipeline {} closed.",
pipeline_id pipeline_id
); );
@ -2815,7 +2803,7 @@ impl ScriptThread {
} }
} }
self.script_sender self.script_sender
.send((id.clone(), ScriptMsg::AbortLoadUrl)) .send((*id, ScriptMsg::AbortLoadUrl))
.unwrap(); .unwrap();
return None; return None;
}, },
@ -3192,7 +3180,7 @@ impl ScriptThread {
); );
let window_proxy = WindowProxy::new( let window_proxy = WindowProxy::new(
&window, window,
browsing_context_id, browsing_context_id,
top_level_browsing_context_id, top_level_browsing_context_id,
iframe.as_deref().map(Castable::upcast), iframe.as_deref().map(Castable::upcast),
@ -3273,7 +3261,7 @@ impl ScriptThread {
time_profiler_chan: self.time_profiler_chan.clone(), time_profiler_chan: self.time_profiler_chan.clone(),
webrender_api_sender: self.webrender_api_sender.clone(), webrender_api_sender: self.webrender_api_sender.clone(),
paint_time_metrics, paint_time_metrics,
window_size: incomplete.window_size.clone(), window_size: incomplete.window_size,
}; };
self.layouts.borrow_mut().insert( self.layouts.borrow_mut().insert(
incomplete.pipeline_id, incomplete.pipeline_id,
@ -3402,7 +3390,7 @@ impl ScriptThread {
self.documents self.documents
.borrow_mut() .borrow_mut()
.insert(incomplete.pipeline_id, &*document); .insert(incomplete.pipeline_id, &document);
window.init_document(&document); window.init_document(&document);