aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/xmlhttprequest.rs
diff options
context:
space:
mode:
authorKeith Yeung <kungfukeith11@gmail.com>2016-01-13 11:33:43 -0500
committerKeith Yeung <kungfukeith11@gmail.com>2016-01-16 08:51:34 -0500
commita64f832e572c67d6bee6b1e488508678fa64e059 (patch)
tree7645ef7b992cf897d7dbbc565368d71ae20b2050 /components/script/dom/xmlhttprequest.rs
parentc7e86411746d229b1f5d43ca55875f7ddda9145a (diff)
downloadservo-a64f832e572c67d6bee6b1e488508678fa64e059.tar.gz
servo-a64f832e572c67d6bee6b1e488508678fa64e059.zip
Change all DOMStrings to USV strings for XHR
Diffstat (limited to 'components/script/dom/xmlhttprequest.rs')
-rw-r--r--components/script/dom/xmlhttprequest.rs26
1 files changed, 13 insertions, 13 deletions
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index f129095bdb4..9802538d5b5 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -22,7 +22,7 @@ use dom::bindings::js::{JS, MutNullableHeap};
use dom::bindings::js::{Root, RootedReference};
use dom::bindings::refcounted::Trusted;
use dom::bindings::reflector::{Reflectable, reflect_dom_object};
-use dom::bindings::str::ByteString;
+use dom::bindings::str::{ByteString, USVString};
use dom::document::DocumentSource;
use dom::document::{Document, IsHTMLDocument};
use dom::event::{Event, EventBubbles, EventCancelable};
@@ -118,7 +118,7 @@ pub struct XMLHttpRequest {
timeout: Cell<u32>,
with_credentials: Cell<bool>,
upload: JS<XMLHttpRequestUpload>,
- response_url: DOMString,
+ response_url: String,
status: Cell<u16>,
status_text: DOMRefCell<ByteString>,
response: DOMRefCell<ByteString>,
@@ -155,7 +155,7 @@ impl XMLHttpRequest {
timeout: Cell::new(0u32),
with_credentials: Cell::new(false),
upload: JS::from_rooted(&XMLHttpRequestUpload::new(global)),
- response_url: DOMString::new(),
+ response_url: String::from(""),
status: Cell::new(0),
status_text: DOMRefCell::new(ByteString::new(vec!())),
response: DOMRefCell::new(ByteString::new(vec!())),
@@ -293,7 +293,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
}
// https://xhr.spec.whatwg.org/#the-open()-method
- fn Open(&self, method: ByteString, url: DOMString) -> ErrorResult {
+ fn Open(&self, method: ByteString, url: USVString) -> ErrorResult {
//FIXME(seanmonstar): use a Trie instead?
let maybe_method = method.as_str().and_then(|s| {
// Note: hyper tests against the uppercase versions
@@ -324,7 +324,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
// Step 6
let base = self.global().r().get_url();
- let parsed_url = match base.join(&url) {
+ let parsed_url = match base.join(&url.0) {
Ok(parsed) => parsed,
Err(_) => return Err(Error::Syntax) // Step 7
};
@@ -358,8 +358,8 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
}
// https://xhr.spec.whatwg.org/#the-open()-method
- fn Open_(&self, method: ByteString, url: DOMString, async: bool,
- _username: Option<DOMString>, _password: Option<DOMString>) -> ErrorResult {
+ fn Open_(&self, method: ByteString, url: USVString, async: bool,
+ _username: Option<USVString>, _password: Option<USVString>) -> ErrorResult {
self.sync.set(!async);
self.Open(method, url)
}
@@ -634,8 +634,8 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
}
// https://xhr.spec.whatwg.org/#the-responseurl-attribute
- fn ResponseURL(&self) -> DOMString {
- self.response_url.clone()
+ fn ResponseURL(&self) -> USVString {
+ USVString(self.response_url.clone())
}
// https://xhr.spec.whatwg.org/#the-status-attribute
@@ -745,13 +745,13 @@ impl XMLHttpRequestMethods for XMLHttpRequest {
}
// https://xhr.spec.whatwg.org/#the-responsetext-attribute
- fn GetResponseText(&self) -> Fallible<DOMString> {
+ fn GetResponseText(&self) -> Fallible<USVString> {
match self.response_type.get() {
_empty | Text => {
- Ok(DOMString::from(match self.ready_state.get() {
+ Ok(USVString(String::from(match self.ready_state.get() {
XMLHttpRequestState::Loading | XMLHttpRequestState::Done => self.text_response(),
_ => "".to_owned()
- }))
+ })))
},
_ => Err(Error::InvalidState)
}
@@ -1110,7 +1110,7 @@ impl XMLHttpRequest {
let doc = doc.r();
let docloader = DocumentLoader::new(&*doc.loader());
let base = self.global().r().get_url();
- let parsed_url = match base.join(&self.ResponseURL()) {
+ let parsed_url = match base.join(&self.ResponseURL().0) {
Ok(parsed) => Some(parsed),
Err(_) => None // Step 7
};