aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xmlhttprequest.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/xmlhttprequest.rs')
-rw-r--r--components/script/dom/xmlhttprequest.rs46
1 files changed, 23 insertions, 23 deletions
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index 21495b9f4b3..9c8b5b20b22 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -177,7 +177,7 @@ impl XMLHttpRequest {
timeout: Cell::new(0u32),
with_credentials: Cell::new(false),
upload: JS::from_rooted(XMLHttpRequestUpload::new(*global)),
- response_url: "".to_string(),
+ response_url: "".into_string(),
status: Cell::new(0),
status_text: DOMRefCell::new(ByteString::new(vec!())),
response: DOMRefCell::new(ByteString::new(vec!())),
@@ -542,12 +542,12 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
// If one of the event handlers below aborts the fetch by calling
// abort or open we will need the current generation id to detect it.
let gen_id = self.generation_id.get();
- self.dispatch_response_progress_event("loadstart".to_string());
+ self.dispatch_response_progress_event("loadstart".into_string());
if self.generation_id.get() != gen_id {
return Ok(());
}
if !self.upload_complete.get() {
- self.dispatch_upload_progress_event("loadstart".to_string(), Some(0));
+ self.dispatch_upload_progress_event("loadstart".into_string(), Some(0));
if self.generation_id.get() != gen_id {
return Ok(());
}
@@ -619,9 +619,9 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
buf.push_str(format!("{:u}", p).as_slice());
});
referer_url.serialize_path().map(|ref h| buf.push_str(h.as_slice()));
- self.request_headers.borrow_mut().set_raw("Referer".to_string(), vec![buf.into_bytes()]);
+ self.request_headers.borrow_mut().set_raw("Referer".into_string(), vec![buf.into_bytes()]);
},
- Ok(Some(ref req)) => self.insert_trusted_header("origin".to_string(),
+ Ok(Some(ref req)) => self.insert_trusted_header("origin".into_string(),
format!("{}", req.origin)),
_ => {}
}
@@ -721,12 +721,12 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
if ready_state == XMLHttpRequestState::XHRDone || ready_state == XMLHttpRequestState::Loading {
self.text_response().to_jsval(cx)
} else {
- "".to_string().to_jsval(cx)
+ "".into_string().to_jsval(cx)
}
},
_ if self.ready_state.get() != XMLHttpRequestState::XHRDone => NullValue(),
Json => {
- let decoded = UTF_8.decode(self.response.borrow().as_slice(), DecoderTrap::Replace).unwrap().to_string();
+ let decoded = UTF_8.decode(self.response.borrow().as_slice(), DecoderTrap::Replace).unwrap().into_string();
let decoded: Vec<u16> = decoded.as_slice().utf16_units().collect();
let mut vp = UndefinedValue();
unsafe {
@@ -748,7 +748,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> {
_empty | Text => {
match self.ready_state.get() {
XMLHttpRequestState::Loading | XMLHttpRequestState::XHRDone => Ok(self.text_response()),
- _ => Ok("".to_string())
+ _ => Ok("".into_string())
}
},
_ => Err(InvalidState)
@@ -834,7 +834,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
self.ready_state.set(rs);
let global = self.global.root();
let event = Event::new(global.root_ref(),
- "readystatechange".to_string(),
+ "readystatechange".into_string(),
EventBubbles::DoesNotBubble,
EventCancelable::Cancelable).root();
let target: JSRef<EventTarget> = EventTargetCast::from_ref(self);
@@ -868,11 +868,11 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
self.upload_complete.set(true);
// Substeps 2-4
if !self.sync.get() {
- self.dispatch_upload_progress_event("progress".to_string(), None);
+ self.dispatch_upload_progress_event("progress".into_string(), None);
return_if_fetch_was_terminated!();
- self.dispatch_upload_progress_event("load".to_string(), None);
+ self.dispatch_upload_progress_event("load".into_string(), None);
return_if_fetch_was_terminated!();
- self.dispatch_upload_progress_event("loadend".to_string(), None);
+ self.dispatch_upload_progress_event("loadend".into_string(), None);
return_if_fetch_was_terminated!();
}
// Part of step 13, send() (processing response)
@@ -900,7 +900,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
self.change_ready_state(XMLHttpRequestState::Loading);
return_if_fetch_was_terminated!();
}
- self.dispatch_response_progress_event("progress".to_string());
+ self.dispatch_response_progress_event("progress".into_string());
}
},
XHRProgress::Done(_) => {
@@ -916,11 +916,11 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
self.change_ready_state(XMLHttpRequestState::XHRDone);
return_if_fetch_was_terminated!();
// Subsubsteps 10-12
- self.dispatch_response_progress_event("progress".to_string());
+ self.dispatch_response_progress_event("progress".into_string());
return_if_fetch_was_terminated!();
- self.dispatch_response_progress_event("load".to_string());
+ self.dispatch_response_progress_event("load".into_string());
return_if_fetch_was_terminated!();
- self.dispatch_response_progress_event("loadend".to_string());
+ self.dispatch_response_progress_event("loadend".into_string());
},
XHRProgress::Errored(_, e) => {
self.send_flag.set(false);
@@ -937,18 +937,18 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
let upload_complete: &Cell<bool> = &self.upload_complete;
if !upload_complete.get() {
upload_complete.set(true);
- self.dispatch_upload_progress_event("progress".to_string(), None);
+ self.dispatch_upload_progress_event("progress".into_string(), None);
return_if_fetch_was_terminated!();
- self.dispatch_upload_progress_event(errormsg.to_string(), None);
+ self.dispatch_upload_progress_event(errormsg.into_string(), None);
return_if_fetch_was_terminated!();
- self.dispatch_upload_progress_event("loadend".to_string(), None);
+ self.dispatch_upload_progress_event("loadend".into_string(), None);
return_if_fetch_was_terminated!();
}
- self.dispatch_response_progress_event("progress".to_string());
+ self.dispatch_response_progress_event("progress".into_string());
return_if_fetch_was_terminated!();
- self.dispatch_response_progress_event(errormsg.to_string());
+ self.dispatch_response_progress_event(errormsg.into_string());
return_if_fetch_was_terminated!();
- self.dispatch_response_progress_event("loadend".to_string());
+ self.dispatch_response_progress_event("loadend".into_string());
}
}
}
@@ -1034,7 +1034,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> {
// According to Simon, decode() should never return an error, so unwrap()ing
// the result should be fine. XXXManishearth have a closer look at this later
- encoding.decode(self.response.borrow().as_slice(), DecoderTrap::Replace).unwrap().to_string()
+ encoding.decode(self.response.borrow().as_slice(), DecoderTrap::Replace).unwrap().into_string()
}
fn filter_response_headers(self) -> Headers {
// http://fetch.spec.whatwg.org/#concept-response-header-list