mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Fixed the .clone() warnings. (#31819)
This commit is contained in:
parent
95e69fe4ff
commit
9b26dca141
28 changed files with 76 additions and 93 deletions
|
@ -204,7 +204,7 @@ impl CanvasState {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_canvas_id(&self) -> CanvasId {
|
pub fn get_canvas_id(&self) -> CanvasId {
|
||||||
self.canvas_id.clone()
|
self.canvas_id
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn send_canvas_2d_msg(&self, msg: Canvas2dMsg) {
|
pub fn send_canvas_2d_msg(&self, msg: Canvas2dMsg) {
|
||||||
|
|
|
@ -1537,7 +1537,7 @@ impl GlobalScope {
|
||||||
// If this is a newly-created port, let the constellation immediately know.
|
// If this is a newly-created port, let the constellation immediately know.
|
||||||
let port_impl = MessagePortImpl::new(dom_port.message_port_id().clone());
|
let port_impl = MessagePortImpl::new(dom_port.message_port_id().clone());
|
||||||
message_ports.insert(
|
message_ports.insert(
|
||||||
dom_port.message_port_id().clone(),
|
*dom_port.message_port_id(),
|
||||||
ManagedMessagePort {
|
ManagedMessagePort {
|
||||||
port_impl: Some(port_impl),
|
port_impl: Some(port_impl),
|
||||||
dom_port: Dom::from_ref(dom_port),
|
dom_port: Dom::from_ref(dom_port),
|
||||||
|
@ -1548,8 +1548,8 @@ impl GlobalScope {
|
||||||
let _ = self
|
let _ = self
|
||||||
.script_to_constellation_chan()
|
.script_to_constellation_chan()
|
||||||
.send(ScriptMsg::NewMessagePort(
|
.send(ScriptMsg::NewMessagePort(
|
||||||
router_id.clone(),
|
*router_id,
|
||||||
dom_port.message_port_id().clone(),
|
*dom_port.message_port_id(),
|
||||||
));
|
));
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
@ -1674,9 +1674,7 @@ impl GlobalScope {
|
||||||
.get(blob_id)
|
.get(blob_id)
|
||||||
.expect("get_blob_bytes for an unknown blob.");
|
.expect("get_blob_bytes for an unknown blob.");
|
||||||
match blob_info.blob_impl.blob_data() {
|
match blob_info.blob_impl.blob_data() {
|
||||||
BlobData::Sliced(ref parent, ref rel_pos) => {
|
BlobData::Sliced(ref parent, ref rel_pos) => Some((*parent, rel_pos.clone())),
|
||||||
Some((parent.clone(), rel_pos.clone()))
|
|
||||||
},
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1739,9 +1737,7 @@ impl GlobalScope {
|
||||||
.get(blob_id)
|
.get(blob_id)
|
||||||
.expect("get_blob_bytes_or_file_id for an unknown blob.");
|
.expect("get_blob_bytes_or_file_id for an unknown blob.");
|
||||||
match blob_info.blob_impl.blob_data() {
|
match blob_info.blob_impl.blob_data() {
|
||||||
BlobData::Sliced(ref parent, ref rel_pos) => {
|
BlobData::Sliced(ref parent, ref rel_pos) => Some((*parent, rel_pos.clone())),
|
||||||
Some((parent.clone(), rel_pos.clone()))
|
|
||||||
},
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1811,9 +1807,7 @@ impl GlobalScope {
|
||||||
.get(blob_id)
|
.get(blob_id)
|
||||||
.expect("get_blob_size called for a unknown blob.");
|
.expect("get_blob_size called for a unknown blob.");
|
||||||
match blob_info.blob_impl.blob_data() {
|
match blob_info.blob_impl.blob_data() {
|
||||||
BlobData::Sliced(ref parent, ref rel_pos) => {
|
BlobData::Sliced(ref parent, ref rel_pos) => Some((*parent, rel_pos.clone())),
|
||||||
Some((parent.clone(), rel_pos.clone()))
|
|
||||||
},
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1857,9 +1851,7 @@ impl GlobalScope {
|
||||||
blob_info.has_url = true;
|
blob_info.has_url = true;
|
||||||
|
|
||||||
match blob_info.blob_impl.blob_data() {
|
match blob_info.blob_impl.blob_data() {
|
||||||
BlobData::Sliced(ref parent, ref rel_pos) => {
|
BlobData::Sliced(ref parent, ref rel_pos) => Some((*parent, rel_pos.clone())),
|
||||||
Some((parent.clone(), rel_pos.clone()))
|
|
||||||
},
|
|
||||||
_ => None,
|
_ => None,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1904,7 +1896,7 @@ impl GlobalScope {
|
||||||
|
|
||||||
let (tx, rx) = profile_ipc::channel(self.time_profiler_chan().clone()).unwrap();
|
let (tx, rx) = profile_ipc::channel(self.time_profiler_chan().clone()).unwrap();
|
||||||
let msg = FileManagerThreadMsg::AddSlicedURLEntry(
|
let msg = FileManagerThreadMsg::AddSlicedURLEntry(
|
||||||
parent_file_id.clone(),
|
*parent_file_id,
|
||||||
rel_pos.clone(),
|
rel_pos.clone(),
|
||||||
tx,
|
tx,
|
||||||
origin.clone(),
|
origin.clone(),
|
||||||
|
@ -1913,7 +1905,7 @@ impl GlobalScope {
|
||||||
match rx.recv().expect("File manager thread is down.") {
|
match rx.recv().expect("File manager thread is down.") {
|
||||||
Ok(new_id) => {
|
Ok(new_id) => {
|
||||||
*blob_info.blob_impl.blob_data_mut() = BlobData::File(FileBlob::new(
|
*blob_info.blob_impl.blob_data_mut() = BlobData::File(FileBlob::new(
|
||||||
new_id.clone(),
|
new_id,
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
rel_pos.to_abs_range(parent_len as usize).len() as u64,
|
rel_pos.to_abs_range(parent_len as usize).len() as u64,
|
||||||
|
@ -1977,7 +1969,7 @@ impl GlobalScope {
|
||||||
self.send_to_file_manager(msg);
|
self.send_to_file_manager(msg);
|
||||||
|
|
||||||
*blob_info.blob_impl.blob_data_mut() = BlobData::File(FileBlob::new(
|
*blob_info.blob_impl.blob_data_mut() = BlobData::File(FileBlob::new(
|
||||||
id.clone(),
|
id,
|
||||||
None,
|
None,
|
||||||
Some(bytes.to_vec()),
|
Some(bytes.to_vec()),
|
||||||
bytes.len() as u64,
|
bytes.len() as u64,
|
||||||
|
@ -2295,7 +2287,7 @@ impl GlobalScope {
|
||||||
pub fn issue_page_warning(&self, warning: &str) {
|
pub fn issue_page_warning(&self, warning: &str) {
|
||||||
if let Some(ref chan) = self.devtools_chan {
|
if let Some(ref chan) = self.devtools_chan {
|
||||||
let _ = chan.send(ScriptToDevtoolsControlMsg::ReportPageError(
|
let _ = chan.send(ScriptToDevtoolsControlMsg::ReportPageError(
|
||||||
self.pipeline_id.clone(),
|
self.pipeline_id,
|
||||||
PageError {
|
PageError {
|
||||||
type_: "PageError".to_string(),
|
type_: "PageError".to_string(),
|
||||||
errorMessage: warning.to_string(),
|
errorMessage: warning.to_string(),
|
||||||
|
@ -2483,7 +2475,7 @@ impl GlobalScope {
|
||||||
} else if self.is::<Window>() {
|
} else if self.is::<Window>() {
|
||||||
if let Some(ref chan) = self.devtools_chan {
|
if let Some(ref chan) = self.devtools_chan {
|
||||||
let _ = chan.send(ScriptToDevtoolsControlMsg::ReportPageError(
|
let _ = chan.send(ScriptToDevtoolsControlMsg::ReportPageError(
|
||||||
self.pipeline_id.clone(),
|
self.pipeline_id,
|
||||||
PageError {
|
PageError {
|
||||||
type_: "PageError".to_string(),
|
type_: "PageError".to_string(),
|
||||||
errorMessage: error_info.message.clone(),
|
errorMessage: error_info.message.clone(),
|
||||||
|
|
|
@ -41,10 +41,10 @@ pub struct WebGPUContextId(pub u64);
|
||||||
impl Clone for GPUCanvasConfiguration {
|
impl Clone for GPUCanvasConfiguration {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
alphaMode: self.alphaMode.clone(),
|
alphaMode: self.alphaMode,
|
||||||
device: self.device.clone(),
|
device: self.device.clone(),
|
||||||
format: self.format.clone(),
|
format: self.format,
|
||||||
usage: self.usage.clone(),
|
usage: self.usage,
|
||||||
viewFormats: self.viewFormats.clone(),
|
viewFormats: self.viewFormats.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1698,7 +1698,7 @@ impl VirtualMethods for HTMLFormElement {
|
||||||
.borrow()
|
.borrow()
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|c| !c.is_in_same_home_subtree(self))
|
.filter(|c| !c.is_in_same_home_subtree(self))
|
||||||
.map(|c| c.clone()),
|
.cloned(),
|
||||||
);
|
);
|
||||||
|
|
||||||
for control in to_reset.iter() {
|
for control in to_reset.iter() {
|
||||||
|
|
|
@ -1411,7 +1411,7 @@ impl LayoutHTMLImageElementHelpers for LayoutDom<'_, HTMLImageElement> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn image_density(self) -> Option<f64> {
|
fn image_density(self) -> Option<f64> {
|
||||||
self.current_request().current_pixel_density.clone()
|
self.current_request().current_pixel_density
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_width(self) -> LengthOrPercentageOrAuto {
|
fn get_width(self) -> LengthOrPercentageOrAuto {
|
||||||
|
|
|
@ -1357,7 +1357,7 @@ impl HTMLMediaElement {
|
||||||
HTMLMediaElementTypeId::HTMLVideoElement => Some(self.video_renderer.clone()),
|
HTMLMediaElementTypeId::HTMLVideoElement => Some(self.video_renderer.clone()),
|
||||||
};
|
};
|
||||||
|
|
||||||
let audio_renderer = self.audio_renderer.borrow().as_ref().map(|r| r.clone());
|
let audio_renderer = self.audio_renderer.borrow().as_ref().cloned();
|
||||||
|
|
||||||
let pipeline_id = window.pipeline_id();
|
let pipeline_id = window.pipeline_id();
|
||||||
let client_context_id =
|
let client_context_id =
|
||||||
|
@ -2470,7 +2470,7 @@ impl LayoutHTMLMediaElementHelpers for LayoutDom<'_, HTMLMediaElement> {
|
||||||
fn data(self) -> HTMLMediaData {
|
fn data(self) -> HTMLMediaData {
|
||||||
let media = unsafe { &*self.unsafe_get() };
|
let media = unsafe { &*self.unsafe_get() };
|
||||||
HTMLMediaData {
|
HTMLMediaData {
|
||||||
current_frame: media.video_renderer.lock().unwrap().current_frame.clone(),
|
current_frame: media.video_renderer.lock().unwrap().current_frame,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,7 +105,7 @@ unsafe extern "C" fn off_thread_compilation_callback(
|
||||||
let url = context.url.clone();
|
let url = context.url.clone();
|
||||||
let final_url = context.final_url.clone();
|
let final_url = context.final_url.clone();
|
||||||
let script_element = context.script_element.clone();
|
let script_element = context.script_element.clone();
|
||||||
let script_kind = context.script_kind.clone();
|
let script_kind = context.script_kind;
|
||||||
let script = replace(&mut context.script_text, String::new());
|
let script = replace(&mut context.script_text, String::new());
|
||||||
let fetch_options = context.fetch_options.clone();
|
let fetch_options = context.fetch_options.clone();
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ impl HTMLScriptElement {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_script_id(&self) -> ScriptId {
|
pub fn get_script_id(&self) -> ScriptId {
|
||||||
self.id.clone()
|
self.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -402,7 +402,7 @@ impl FetchResponseListener for ClassicContext {
|
||||||
// Step 6, response is an error.
|
// Step 6, response is an error.
|
||||||
finish_fetching_a_classic_script(
|
finish_fetching_a_classic_script(
|
||||||
&*self.elem.root(),
|
&*self.elem.root(),
|
||||||
self.kind.clone(),
|
self.kind,
|
||||||
self.url.clone(),
|
self.url.clone(),
|
||||||
Err(NoTrace(err.clone())),
|
Err(NoTrace(err.clone())),
|
||||||
);
|
);
|
||||||
|
@ -438,7 +438,7 @@ impl FetchResponseListener for ClassicContext {
|
||||||
|
|
||||||
let context = Box::new(OffThreadCompilationContext {
|
let context = Box::new(OffThreadCompilationContext {
|
||||||
script_element: self.elem.clone(),
|
script_element: self.elem.clone(),
|
||||||
script_kind: self.kind.clone(),
|
script_kind: self.kind,
|
||||||
final_url,
|
final_url,
|
||||||
url: self.url.clone(),
|
url: self.url.clone(),
|
||||||
task_source: global.dom_manipulation_task_source(),
|
task_source: global.dom_manipulation_task_source(),
|
||||||
|
@ -464,7 +464,7 @@ impl FetchResponseListener for ClassicContext {
|
||||||
self.fetch_options.clone(),
|
self.fetch_options.clone(),
|
||||||
ScriptType::Classic,
|
ScriptType::Classic,
|
||||||
);
|
);
|
||||||
finish_fetching_a_classic_script(&*elem, self.kind.clone(), self.url.clone(), Ok(load));
|
finish_fetching_a_classic_script(&*elem, self.kind, self.url.clone(), Ok(load));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,7 +816,7 @@ impl HTMLScriptElement {
|
||||||
Rc::clone(&text_rc),
|
Rc::clone(&text_rc),
|
||||||
base_url.clone(),
|
base_url.clone(),
|
||||||
options.clone(),
|
options.clone(),
|
||||||
script_type.clone(),
|
script_type,
|
||||||
));
|
));
|
||||||
|
|
||||||
// Step 27-2.
|
// Step 27-2.
|
||||||
|
@ -850,7 +850,7 @@ impl HTMLScriptElement {
|
||||||
ModuleOwner::Window(Trusted::new(self)),
|
ModuleOwner::Window(Trusted::new(self)),
|
||||||
text_rc,
|
text_rc,
|
||||||
base_url.clone(),
|
base_url.clone(),
|
||||||
self.id.clone(),
|
self.id,
|
||||||
options,
|
options,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
|
@ -40,10 +40,7 @@ impl MessageChannel {
|
||||||
incumbent.track_message_port(&*port2, None);
|
incumbent.track_message_port(&*port2, None);
|
||||||
|
|
||||||
// Step 3
|
// Step 3
|
||||||
incumbent.entangle_ports(
|
incumbent.entangle_ports(*port1.message_port_id(), *port2.message_port_id());
|
||||||
port1.message_port_id().clone(),
|
|
||||||
port2.message_port_id().clone(),
|
|
||||||
);
|
|
||||||
|
|
||||||
// Steps 4-6
|
// Steps 4-6
|
||||||
reflect_dom_object_with_proto(
|
reflect_dom_object_with_proto(
|
||||||
|
|
|
@ -151,7 +151,7 @@ impl MessagePort {
|
||||||
|
|
||||||
// Have the global proxy this call to the corresponding MessagePortImpl.
|
// Have the global proxy this call to the corresponding MessagePortImpl.
|
||||||
self.global()
|
self.global()
|
||||||
.post_messageport_msg(self.message_port_id().clone(), task);
|
.post_messageport_msg(*self.message_port_id(), task);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -176,15 +176,15 @@ impl Transferable for MessagePort {
|
||||||
|
|
||||||
// 2. Store the transferred object at a given key.
|
// 2. Store the transferred object at a given key.
|
||||||
if let Some(ports) = port_impls.as_mut() {
|
if let Some(ports) = port_impls.as_mut() {
|
||||||
ports.insert(id.clone(), transferred_port);
|
ports.insert(*id, transferred_port);
|
||||||
} else {
|
} else {
|
||||||
let mut ports = HashMap::new();
|
let mut ports = HashMap::new();
|
||||||
ports.insert(id.clone(), transferred_port);
|
ports.insert(*id, transferred_port);
|
||||||
*port_impls = Some(ports);
|
*port_impls = Some(ports);
|
||||||
}
|
}
|
||||||
|
|
||||||
let PipelineNamespaceId(name_space) = id.clone().namespace_id;
|
let PipelineNamespaceId(name_space) = (*id).namespace_id;
|
||||||
let MessagePortIndex(index) = id.clone().index;
|
let MessagePortIndex(index) = (*id).index;
|
||||||
let index = index.get();
|
let index = index.get();
|
||||||
|
|
||||||
let mut big: [u8; 8] = [0; 8];
|
let mut big: [u8; 8] = [0; 8];
|
||||||
|
@ -251,7 +251,7 @@ impl Transferable for MessagePort {
|
||||||
};
|
};
|
||||||
|
|
||||||
let transferred_port =
|
let transferred_port =
|
||||||
MessagePort::new_transferred(&*owner, id.clone(), port_impl.entangled_port_id());
|
MessagePort::new_transferred(&*owner, id, port_impl.entangled_port_id());
|
||||||
owner.track_message_port(&transferred_port, Some(port_impl));
|
owner.track_message_port(&transferred_port, Some(port_impl));
|
||||||
|
|
||||||
return_object.set(transferred_port.reflector().rootable().get());
|
return_object.set(transferred_port.reflector().rootable().get());
|
||||||
|
|
|
@ -80,7 +80,7 @@ impl PerformanceEntryList {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map_or(true, |type_| *e.entry_type() == *type_)
|
.map_or(true, |type_| *e.entry_type() == *type_)
|
||||||
})
|
})
|
||||||
.map(|e| e.clone())
|
.cloned()
|
||||||
.collect::<Vec<DomRoot<PerformanceEntry>>>();
|
.collect::<Vec<DomRoot<PerformanceEntry>>>();
|
||||||
res.sort_by(|a, b| {
|
res.sort_by(|a, b| {
|
||||||
a.start_time()
|
a.start_time()
|
||||||
|
|
|
@ -109,7 +109,7 @@ impl PerformanceNavigationTimingMethods for PerformanceNavigationTiming {
|
||||||
|
|
||||||
// https://w3c.github.io/navigation-timing/#dom-performancenavigationtiming-type
|
// https://w3c.github.io/navigation-timing/#dom-performancenavigationtiming-type
|
||||||
fn Type(&self) -> NavigationType {
|
fn Type(&self) -> NavigationType {
|
||||||
self.nav_type.clone()
|
self.nav_type
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://w3c.github.io/navigation-timing/#dom-performancenavigationtiming-redirectcount
|
// https://w3c.github.io/navigation-timing/#dom-performancenavigationtiming-redirectcount
|
||||||
|
|
|
@ -186,7 +186,7 @@ impl PerformanceObserverMethods for PerformanceObserver {
|
||||||
let entry_types = entry_types
|
let entry_types = entry_types
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|e| VALID_ENTRY_TYPES.contains(&e.as_ref()))
|
.filter(|e| VALID_ENTRY_TYPES.contains(&e.as_ref()))
|
||||||
.map(|e| e.clone())
|
.cloned()
|
||||||
.collect::<Vec<DOMString>>();
|
.collect::<Vec<DOMString>>();
|
||||||
|
|
||||||
// Step 6.3
|
// Step 6.3
|
||||||
|
|
|
@ -310,7 +310,7 @@ pub fn get_descriptor_permission_state(
|
||||||
.borrow()
|
.borrow()
|
||||||
.get(&permission_name.to_string())
|
.get(&permission_name.to_string())
|
||||||
{
|
{
|
||||||
return prev_result.clone();
|
return *prev_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store the invocation result
|
// Store the invocation result
|
||||||
|
|
|
@ -208,16 +208,12 @@ impl Request {
|
||||||
|
|
||||||
// Step 15
|
// Step 15
|
||||||
if let Some(init_referrerpolicy) = init.referrerPolicy.as_ref() {
|
if let Some(init_referrerpolicy) = init.referrerPolicy.as_ref() {
|
||||||
let init_referrer_policy = init_referrerpolicy.clone().into();
|
let init_referrer_policy = (*init_referrerpolicy).into();
|
||||||
request.referrer_policy = Some(init_referrer_policy);
|
request.referrer_policy = Some(init_referrer_policy);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 16
|
// Step 16
|
||||||
let mode = init
|
let mode = init.mode.as_ref().map(|m| (*m).into()).or(fallback_mode);
|
||||||
.mode
|
|
||||||
.as_ref()
|
|
||||||
.map(|m| m.clone().into())
|
|
||||||
.or(fallback_mode);
|
|
||||||
|
|
||||||
// Step 17
|
// Step 17
|
||||||
if let Some(NetTraitsRequestMode::Navigate) = mode {
|
if let Some(NetTraitsRequestMode::Navigate) = mode {
|
||||||
|
@ -231,13 +227,13 @@ impl Request {
|
||||||
|
|
||||||
// Step 19
|
// Step 19
|
||||||
if let Some(init_credentials) = init.credentials.as_ref() {
|
if let Some(init_credentials) = init.credentials.as_ref() {
|
||||||
let credentials = init_credentials.clone().into();
|
let credentials = (*init_credentials).into();
|
||||||
request.credentials_mode = credentials;
|
request.credentials_mode = credentials;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 20
|
// Step 20
|
||||||
if let Some(init_cache) = init.cache.as_ref() {
|
if let Some(init_cache) = init.cache.as_ref() {
|
||||||
let cache = init_cache.clone().into();
|
let cache = (*init_cache).into();
|
||||||
request.cache_mode = cache;
|
request.cache_mode = cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +248,7 @@ impl Request {
|
||||||
|
|
||||||
// Step 22
|
// Step 22
|
||||||
if let Some(init_redirect) = init.redirect.as_ref() {
|
if let Some(init_redirect) = init.redirect.as_ref() {
|
||||||
let redirect = init_redirect.clone().into();
|
let redirect = (*init_redirect).into();
|
||||||
request.redirect_mode = redirect;
|
request.redirect_mode = redirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -334,8 +334,8 @@ impl ResponseMethods for Response {
|
||||||
// https://fetch.spec.whatwg.org/#concept-response-clone
|
// https://fetch.spec.whatwg.org/#concept-response-clone
|
||||||
// Instead of storing a net_traits::Response internally, we
|
// Instead of storing a net_traits::Response internally, we
|
||||||
// only store the relevant fields, and only clone them here
|
// only store the relevant fields, and only clone them here
|
||||||
*new_response.response_type.borrow_mut() = self.response_type.borrow().clone();
|
*new_response.response_type.borrow_mut() = *self.response_type.borrow();
|
||||||
*new_response.status.borrow_mut() = self.status.borrow().clone();
|
*new_response.status.borrow_mut() = *self.status.borrow();
|
||||||
*new_response.raw_status.borrow_mut() = self.raw_status.borrow().clone();
|
*new_response.raw_status.borrow_mut() = self.raw_status.borrow().clone();
|
||||||
*new_response.url.borrow_mut() = self.url.borrow().clone();
|
*new_response.url.borrow_mut() = self.url.borrow().clone();
|
||||||
*new_response.url_list.borrow_mut() = self.url_list.borrow().clone();
|
*new_response.url_list.borrow_mut() = self.url_list.borrow().clone();
|
||||||
|
|
|
@ -112,7 +112,7 @@ impl RTCIceCandidateMethods for RTCIceCandidate {
|
||||||
|
|
||||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-sdpmlineindex>
|
/// <https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-sdpmlineindex>
|
||||||
fn GetSdpMLineIndex(&self) -> Option<u16> {
|
fn GetSdpMLineIndex(&self) -> Option<u16> {
|
||||||
self.sdp_m_line_index.clone()
|
self.sdp_m_line_index
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-usernamefragment>
|
/// <https://w3c.github.io/webrtc-pc/#dom-rtcicecandidate-usernamefragment>
|
||||||
|
@ -125,7 +125,7 @@ impl RTCIceCandidateMethods for RTCIceCandidate {
|
||||||
RTCIceCandidateInit {
|
RTCIceCandidateInit {
|
||||||
candidate: self.candidate.clone(),
|
candidate: self.candidate.clone(),
|
||||||
sdpMid: self.sdp_m_id.clone(),
|
sdpMid: self.sdp_m_id.clone(),
|
||||||
sdpMLineIndex: self.sdp_m_line_index.clone(),
|
sdpMLineIndex: self.sdp_m_line_index,
|
||||||
usernameFragment: self.username_fragment.clone(),
|
usernameFragment: self.username_fragment.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1000,7 +1000,7 @@ impl TestBindingMethods for TestBinding {
|
||||||
resolve.map(SimpleHandler::new),
|
resolve.map(SimpleHandler::new),
|
||||||
reject.map(SimpleHandler::new),
|
reject.map(SimpleHandler::new),
|
||||||
);
|
);
|
||||||
let p = Promise::new_in_current_realm(comp.clone());
|
let p = Promise::new_in_current_realm(comp);
|
||||||
p.append_native_handler(&handler, comp);
|
p.append_native_handler(&handler, comp);
|
||||||
return p;
|
return p;
|
||||||
|
|
||||||
|
|
|
@ -29,13 +29,13 @@ impl Iterable for TestBindingPairIterable {
|
||||||
self.map.borrow().len() as u32
|
self.map.borrow().len() as u32
|
||||||
}
|
}
|
||||||
fn get_value_at_index(&self, index: u32) -> u32 {
|
fn get_value_at_index(&self, index: u32) -> u32 {
|
||||||
self.map
|
*self
|
||||||
|
.map
|
||||||
.borrow()
|
.borrow()
|
||||||
.iter()
|
.iter()
|
||||||
.nth(index as usize)
|
.nth(index as usize)
|
||||||
.map(|a| &a.1)
|
.map(|a| &a.1)
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.clone()
|
|
||||||
}
|
}
|
||||||
fn get_key_at_index(&self, index: u32) -> DOMString {
|
fn get_key_at_index(&self, index: u32) -> DOMString {
|
||||||
self.map
|
self.map
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl TransitionEvent {
|
||||||
TransitionEvent {
|
TransitionEvent {
|
||||||
event: Event::new_inherited(),
|
event: Event::new_inherited(),
|
||||||
property_name: Atom::from(init.propertyName.clone()),
|
property_name: Atom::from(init.propertyName.clone()),
|
||||||
elapsed_time: init.elapsedTime.clone(),
|
elapsed_time: init.elapsedTime,
|
||||||
pseudo_element: init.pseudoElement.clone(),
|
pseudo_element: init.pseudoElement.clone(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ impl TransitionEventMethods for TransitionEvent {
|
||||||
|
|
||||||
// https://drafts.csswg.org/css-transitions/#Events-TransitionEvent-elapsedTime
|
// https://drafts.csswg.org/css-transitions/#Events-TransitionEvent-elapsedTime
|
||||||
fn ElapsedTime(&self) -> Finite<f32> {
|
fn ElapsedTime(&self) -> Finite<f32> {
|
||||||
self.elapsed_time.clone()
|
self.elapsed_time
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://drafts.csswg.org/css-transitions/#Events-TransitionEvent-pseudoElement
|
// https://drafts.csswg.org/css-transitions/#Events-TransitionEvent-pseudoElement
|
||||||
|
|
|
@ -235,7 +235,7 @@ impl WebGLRenderbuffer {
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
let samples = receiver.recv().unwrap();
|
let samples = receiver.recv().unwrap();
|
||||||
if sample_count < 0 || sample_count > samples.get(0).cloned().unwrap_or(0) {
|
if sample_count < 0 || sample_count > samples.first().cloned().unwrap_or(0) {
|
||||||
return Err(WebGLError::InvalidOperation);
|
return Err(WebGLError::InvalidOperation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2329,7 +2329,7 @@ impl Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_page_clip_rect_with_new_viewport(&self, viewport: UntypedRect<f32>) -> bool {
|
pub fn set_page_clip_rect_with_new_viewport(&self, viewport: UntypedRect<f32>) -> bool {
|
||||||
let rect = f32_rect_to_au_rect(viewport.clone());
|
let rect = f32_rect_to_au_rect(viewport);
|
||||||
self.current_viewport.set(rect);
|
self.current_viewport.set(rect);
|
||||||
// We use a clipping rectangle that is five times the size of the of the viewport,
|
// We use a clipping rectangle that is five times the size of the of the viewport,
|
||||||
// so that we don't collect display list items for areas too far outside the viewport,
|
// so that we don't collect display list items for areas too far outside the viewport,
|
||||||
|
|
|
@ -220,7 +220,7 @@ impl WorkerGlobalScope {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_worker_id(&self) -> WorkerId {
|
pub fn get_worker_id(&self) -> WorkerId {
|
||||||
self.worker_id.clone()
|
self.worker_id
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn task_canceller(&self) -> TaskCanceller {
|
pub fn task_canceller(&self) -> TaskCanceller {
|
||||||
|
|
|
@ -153,7 +153,7 @@ impl WorkletMethods for Worklet {
|
||||||
self.window.origin().immutable().clone(),
|
self.window.origin().immutable().clone(),
|
||||||
global.api_base_url(),
|
global.api_base_url(),
|
||||||
module_url_record,
|
module_url_record,
|
||||||
options.credentials.clone(),
|
options.credentials,
|
||||||
pending_tasks_struct,
|
pending_tasks_struct,
|
||||||
&promise,
|
&promise,
|
||||||
);
|
);
|
||||||
|
|
|
@ -720,7 +720,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
|
||||||
.credentials_mode(credentials_mode)
|
.credentials_mode(credentials_mode)
|
||||||
.use_url_credentials(use_url_credentials)
|
.use_url_credentials(use_url_credentials)
|
||||||
.origin(self.global().origin().immutable().clone())
|
.origin(self.global().origin().immutable().clone())
|
||||||
.referrer_policy(self.referrer_policy.clone())
|
.referrer_policy(self.referrer_policy)
|
||||||
.pipeline_id(Some(self.global().pipeline_id()));
|
.pipeline_id(Some(self.global().pipeline_id()));
|
||||||
|
|
||||||
// step 4 (second half)
|
// step 4 (second half)
|
||||||
|
|
|
@ -731,7 +731,7 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ThreadSafeLayoutElement<'dom>
|
||||||
fn as_node(&self) -> ServoThreadSafeLayoutNode<'dom, LayoutDataType> {
|
fn as_node(&self) -> ServoThreadSafeLayoutNode<'dom, LayoutDataType> {
|
||||||
ServoThreadSafeLayoutNode {
|
ServoThreadSafeLayoutNode {
|
||||||
node: self.element.as_node(),
|
node: self.element.as_node(),
|
||||||
pseudo: self.pseudo.clone(),
|
pseudo: self.pseudo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -741,7 +741,7 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ThreadSafeLayoutElement<'dom>
|
||||||
|
|
||||||
fn with_pseudo(&self, pseudo: PseudoElementType) -> Self {
|
fn with_pseudo(&self, pseudo: PseudoElementType) -> Self {
|
||||||
ServoThreadSafeLayoutElement {
|
ServoThreadSafeLayoutElement {
|
||||||
element: self.element.clone(),
|
element: self.element,
|
||||||
pseudo,
|
pseudo,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -285,7 +285,7 @@ impl<'dom, LayoutDataType: LayoutDataTrait> ServoThreadSafeLayoutNode<'dom, Layo
|
||||||
/// Creates a new `ServoThreadSafeLayoutNode` from the given `ServoLayoutNode`.
|
/// Creates a new `ServoThreadSafeLayoutNode` from the given `ServoLayoutNode`.
|
||||||
pub fn new(node: ServoLayoutNode<'dom, LayoutDataType>) -> Self {
|
pub fn new(node: ServoLayoutNode<'dom, LayoutDataType>) -> Self {
|
||||||
ServoThreadSafeLayoutNode {
|
ServoThreadSafeLayoutNode {
|
||||||
node: node.clone(),
|
node: node,
|
||||||
pseudo: PseudoElementType::Normal,
|
pseudo: PseudoElementType::Normal,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -529,7 +529,7 @@ impl<'dom, LayoutDataType: LayoutDataTrait> Iterator
|
||||||
PseudoElementType::Before | PseudoElementType::After => None,
|
PseudoElementType::Before | PseudoElementType::After => None,
|
||||||
|
|
||||||
PseudoElementType::DetailsSummary => {
|
PseudoElementType::DetailsSummary => {
|
||||||
let mut current_node = self.current_node.clone();
|
let mut current_node = self.current_node;
|
||||||
loop {
|
loop {
|
||||||
let next_node = if let Some(ref node) = current_node {
|
let next_node = if let Some(ref node) = current_node {
|
||||||
if let Some(element) = node.as_element() {
|
if let Some(element) = node.as_element() {
|
||||||
|
@ -537,7 +537,7 @@ impl<'dom, LayoutDataType: LayoutDataTrait> Iterator
|
||||||
element.has_namespace(&ns!(html))
|
element.has_namespace(&ns!(html))
|
||||||
{
|
{
|
||||||
self.current_node = None;
|
self.current_node = None;
|
||||||
return Some(node.clone());
|
return Some(*node);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
unsafe { node.dangerous_next_sibling() }
|
unsafe { node.dangerous_next_sibling() }
|
||||||
|
@ -550,7 +550,7 @@ impl<'dom, LayoutDataType: LayoutDataTrait> Iterator
|
||||||
},
|
},
|
||||||
|
|
||||||
PseudoElementType::DetailsContent => {
|
PseudoElementType::DetailsContent => {
|
||||||
let node = self.current_node.clone();
|
let node = self.current_node;
|
||||||
let node = node.and_then(|node| {
|
let node = node.and_then(|node| {
|
||||||
if node.is_element() &&
|
if node.is_element() &&
|
||||||
node.as_element()
|
node.as_element()
|
||||||
|
@ -568,7 +568,7 @@ impl<'dom, LayoutDataType: LayoutDataTrait> Iterator
|
||||||
},
|
},
|
||||||
|
|
||||||
PseudoElementType::Normal => {
|
PseudoElementType::Normal => {
|
||||||
let node = self.current_node.clone();
|
let node = self.current_node;
|
||||||
if let Some(ref node) = node {
|
if let Some(ref node) = node {
|
||||||
self.current_node = match node.get_pseudo_element_type() {
|
self.current_node = match node.get_pseudo_element_type() {
|
||||||
PseudoElementType::Before => self
|
PseudoElementType::Before => self
|
||||||
|
|
|
@ -105,9 +105,7 @@ impl RethrowError {
|
||||||
|
|
||||||
impl Clone for RethrowError {
|
impl Clone for RethrowError {
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self(RootedTraceableBox::from_box(Heap::boxed(
|
Self(RootedTraceableBox::from_box(Heap::boxed(self.0.get())))
|
||||||
self.0.get().clone(),
|
|
||||||
)))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,7 +210,7 @@ impl ModuleTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_status(&self) -> ModuleStatus {
|
pub fn get_status(&self) -> ModuleStatus {
|
||||||
self.status.borrow().clone()
|
*self.status.borrow()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_status(&self, status: ModuleStatus) {
|
pub fn set_status(&self, status: ModuleStatus) {
|
||||||
|
@ -771,7 +769,7 @@ impl ModuleTree {
|
||||||
owner.clone(),
|
owner.clone(),
|
||||||
url.clone(),
|
url.clone(),
|
||||||
visited_urls.clone(),
|
visited_urls.clone(),
|
||||||
destination.clone(),
|
destination,
|
||||||
options,
|
options,
|
||||||
Some(parent_identity.clone()),
|
Some(parent_identity.clone()),
|
||||||
false,
|
false,
|
||||||
|
@ -1164,7 +1162,7 @@ impl FetchResponseListener for ModuleContext {
|
||||||
|
|
||||||
module_tree.fetch_module_descendants(
|
module_tree.fetch_module_descendants(
|
||||||
&self.owner,
|
&self.owner,
|
||||||
self.destination.clone(),
|
self.destination,
|
||||||
&self.options,
|
&self.options,
|
||||||
ModuleIdentity::ModuleUrl(self.url.clone()),
|
ModuleIdentity::ModuleUrl(self.url.clone()),
|
||||||
);
|
);
|
||||||
|
@ -1355,7 +1353,7 @@ fn fetch_an_import_module_script_graph(
|
||||||
_ => ModuleOwner::DynamicModule(Trusted::new(&DynamicModuleOwner::new(
|
_ => ModuleOwner::DynamicModule(Trusted::new(&DynamicModuleOwner::new(
|
||||||
global,
|
global,
|
||||||
promise.clone(),
|
promise.clone(),
|
||||||
dynamic_module_id.clone(),
|
dynamic_module_id,
|
||||||
))),
|
))),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1634,7 +1632,7 @@ fn fetch_single_module_script(
|
||||||
global.set_module_map(url.clone(), module_tree);
|
global.set_module_map(url.clone(), module_tree);
|
||||||
|
|
||||||
// Step 5-6.
|
// Step 5-6.
|
||||||
let mode = match destination.clone() {
|
let mode = match destination {
|
||||||
Destination::Worker | Destination::SharedWorker if top_level_module_fetch => {
|
Destination::Worker | Destination::SharedWorker if top_level_module_fetch => {
|
||||||
RequestMode::SameOrigin
|
RequestMode::SameOrigin
|
||||||
},
|
},
|
||||||
|
@ -1648,7 +1646,7 @@ fn fetch_single_module_script(
|
||||||
|
|
||||||
// Step 7-8.
|
// Step 7-8.
|
||||||
let request = RequestBuilder::new(url.clone(), global.get_referrer())
|
let request = RequestBuilder::new(url.clone(), global.get_referrer())
|
||||||
.destination(destination.clone())
|
.destination(destination)
|
||||||
.origin(global.origin().immutable().clone())
|
.origin(global.origin().immutable().clone())
|
||||||
.parser_metadata(options.parser_metadata)
|
.parser_metadata(options.parser_metadata)
|
||||||
.integrity_metadata(options.integrity_metadata.clone())
|
.integrity_metadata(options.integrity_metadata.clone())
|
||||||
|
@ -1660,7 +1658,7 @@ fn fetch_single_module_script(
|
||||||
data: vec![],
|
data: vec![],
|
||||||
metadata: None,
|
metadata: None,
|
||||||
url: url.clone(),
|
url: url.clone(),
|
||||||
destination: destination.clone(),
|
destination: destination,
|
||||||
options,
|
options,
|
||||||
status: Ok(()),
|
status: Ok(()),
|
||||||
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Resource),
|
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Resource),
|
||||||
|
@ -1723,7 +1721,7 @@ pub(crate) fn fetch_inline_module_script(
|
||||||
Ok(record) => {
|
Ok(record) => {
|
||||||
module_tree.append_handler(
|
module_tree.append_handler(
|
||||||
owner.clone(),
|
owner.clone(),
|
||||||
ModuleIdentity::ScriptId(script_id.clone()),
|
ModuleIdentity::ScriptId(script_id),
|
||||||
options.clone(),
|
options.clone(),
|
||||||
);
|
);
|
||||||
module_tree.set_record(record);
|
module_tree.set_record(record);
|
||||||
|
@ -1749,7 +1747,7 @@ pub(crate) fn fetch_inline_module_script(
|
||||||
Err(exception) => {
|
Err(exception) => {
|
||||||
module_tree.set_rethrow_error(exception);
|
module_tree.set_rethrow_error(exception);
|
||||||
module_tree.set_status(ModuleStatus::Finished);
|
module_tree.set_status(ModuleStatus::Finished);
|
||||||
global.set_inline_module_map(script_id.clone(), module_tree);
|
global.set_inline_module_map(script_id, module_tree);
|
||||||
owner.notify_owner_to_finish(ModuleIdentity::ScriptId(script_id), options);
|
owner.notify_owner_to_finish(ModuleIdentity::ScriptId(script_id), options);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -2788,7 +2788,7 @@ impl ScriptThread {
|
||||||
..
|
..
|
||||||
}) => {
|
}) => {
|
||||||
// If we have an existing window that is being navigated:
|
// If we have an existing window that is being navigated:
|
||||||
if let Some(window) = self.documents.borrow().find_window(id.clone()) {
|
if let Some(window) = self.documents.borrow().find_window(*id) {
|
||||||
let window_proxy = window.window_proxy();
|
let window_proxy = window.window_proxy();
|
||||||
// https://html.spec.whatwg.org/multipage/
|
// https://html.spec.whatwg.org/multipage/
|
||||||
// #navigating-across-documents:delaying-load-events-mode-2
|
// #navigating-across-documents:delaying-load-events-mode-2
|
||||||
|
@ -3817,7 +3817,7 @@ impl ScriptThread {
|
||||||
/// Instructs the constellation to fetch the document that will be loaded. Stores the InProgressLoad
|
/// Instructs the constellation to fetch the document that will be loaded. Stores the InProgressLoad
|
||||||
/// argument until a notification is received that the fetch is complete.
|
/// argument until a notification is received that the fetch is complete.
|
||||||
fn pre_page_load(&self, mut incomplete: InProgressLoad, load_data: LoadData) {
|
fn pre_page_load(&self, mut incomplete: InProgressLoad, load_data: LoadData) {
|
||||||
let id = incomplete.pipeline_id.clone();
|
let id = incomplete.pipeline_id;
|
||||||
let req_init = RequestBuilder::new(load_data.url.clone(), load_data.referrer)
|
let req_init = RequestBuilder::new(load_data.url.clone(), load_data.referrer)
|
||||||
.method(load_data.method)
|
.method(load_data.method)
|
||||||
.destination(Destination::Document)
|
.destination(Destination::Document)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue