diff options
author | Manish Goregaokar <manishsmail@gmail.com> | 2014-05-03 19:39:11 +0530 |
---|---|---|
committer | Manish Goregaokar <manishsmail@gmail.com> | 2014-05-03 19:39:11 +0530 |
commit | a4c5df34949f47fa1a39600f72df03cdac30b54b (patch) | |
tree | 0ee4c147b3c218294408d7c49a0b65596243e23a /src/components/script | |
parent | 53777807f96e64c64f1ef995f54e630122856366 (diff) | |
download | servo-a4c5df34949f47fa1a39600f72df03cdac30b54b.tar.gz servo-a4c5df34949f47fa1a39600f72df03cdac30b54b.zip |
Use ByteString in XHR
Diffstat (limited to 'src/components/script')
-rw-r--r-- | src/components/script/dom/bindings/str.rs | 1 | ||||
-rw-r--r-- | src/components/script/dom/webidls/XMLHttpRequest.webidl | 12 | ||||
-rw-r--r-- | src/components/script/dom/xmlhttprequest.rs | 19 |
3 files changed, 17 insertions, 15 deletions
diff --git a/src/components/script/dom/bindings/str.rs b/src/components/script/dom/bindings/str.rs index b7978b4737b..e44ad6e60d9 100644 --- a/src/components/script/dom/bindings/str.rs +++ b/src/components/script/dom/bindings/str.rs @@ -2,6 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#[deriving(Encodable,Clone)] pub struct ByteString(Vec<u8>); impl ByteString { diff --git a/src/components/script/dom/webidls/XMLHttpRequest.webidl b/src/components/script/dom/webidls/XMLHttpRequest.webidl index dd3023a05ca..6d98dd37377 100644 --- a/src/components/script/dom/webidls/XMLHttpRequest.webidl +++ b/src/components/script/dom/webidls/XMLHttpRequest.webidl @@ -38,11 +38,11 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget { readonly attribute unsigned short readyState; // request - // void open(/* ByteString */ DOMString method, /* [EnsureUTF16] */ DOMString url); + // void open(ByteString method, /* [EnsureUTF16] */ DOMString url); - // void open(/* ByteString */ DOMString method, /* [EnsureUTF16] */ DOMString url, boolean async, optional /* [EnsureUTF16] */ DOMString? username = null, optional /* [EnsureUTF16] */ DOMString? password = null); + // void open(ByteString method, /* [EnsureUTF16] */ DOMString url, boolean async, optional /* [EnsureUTF16] */ DOMString? username = null, optional /* [EnsureUTF16] */ DOMString? password = null); - // void setRequestHeader(/* ByteString */ DOMString name, /* ByteString */ DOMString value); + // void setRequestHeader(ByteString name, ByteString value); attribute unsigned long timeout; attribute boolean withCredentials; readonly attribute XMLHttpRequestUpload upload; @@ -52,9 +52,9 @@ interface XMLHttpRequest : XMLHttpRequestEventTarget { // response readonly attribute DOMString responseURL; readonly attribute unsigned short status; - readonly attribute /* ByteString*/ DOMString statusText; - // DOMString? /*ByteString?*/ getResponseHeader(/*ByteString*/ DOMString name); - // DOMString /*ByteString*/ getAllResponseHeaders(); + readonly attribute ByteString statusText; + // ByteString? getResponseHeader(ByteString name); + // ByteString getAllResponseHeaders(); // void overrideMimeType(DOMString mime); attribute XMLHttpRequestResponseType responseType; // readonly attribute any response; diff --git a/src/components/script/dom/xmlhttprequest.rs b/src/components/script/dom/xmlhttprequest.rs index 86b87f33d7c..76099a4d0d0 100644 --- a/src/components/script/dom/xmlhttprequest.rs +++ b/src/components/script/dom/xmlhttprequest.rs @@ -3,6 +3,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use dom::bindings::codegen::BindingDeclarations::XMLHttpRequestBinding; +use dom::bindings::str::ByteString; use self::XMLHttpRequestBinding::XMLHttpRequestResponseType; use self::XMLHttpRequestBinding::XMLHttpRequestResponseTypeValues::_empty; use dom::bindings::codegen::InheritTypes::XMLHttpRequestDerived; @@ -33,7 +34,7 @@ pub struct XMLHttpRequest { upload: JS<XMLHttpRequestUpload>, response_url: DOMString, status: u16, - status_text: DOMString, + status_text: ByteString, response_type: XMLHttpRequestResponseType, response_text: DOMString, response_xml: Option<JS<Document>> @@ -49,7 +50,7 @@ impl XMLHttpRequest { upload: XMLHttpRequestUpload::new(owner), response_url: ~"", status: 0, - status_text: ~"", + status_text: ByteString::new(vec!()), response_type: _empty, response_text: ~"", response_xml: None @@ -66,14 +67,14 @@ impl XMLHttpRequest { pub fn ReadyState(&self) -> u16 { self.ready_state } - pub fn Open(&self, _method: DOMString, _url: DOMString) { + pub fn Open(&self, _method: ByteString, _url: DOMString) { } - pub fn Open_(&self, _method: DOMString, _url: DOMString, _async: bool, + pub fn Open_(&self, _method: ByteString, _url: DOMString, _async: bool, _username: Option<DOMString>, _password: Option<DOMString>) { } - pub fn SetRequestHeader(&self, _name: DOMString, _value: DOMString) { + pub fn SetRequestHeader(&self, _name: ByteString, _value: ByteString) { } pub fn Timeout(&self) -> u32 { @@ -103,14 +104,14 @@ impl XMLHttpRequest { pub fn Status(&self) -> u16 { self.status } - pub fn StatusText(&self) -> DOMString { + pub fn StatusText(&self) -> ByteString { self.status_text.clone() } - pub fn GetResponseHeader(&self, _name: DOMString) -> Option<DOMString> { + pub fn GetResponseHeader(&self, _name: ByteString) -> Option<ByteString> { None } - pub fn GetAllResponseHeaders(&self) -> DOMString { - ~"" + pub fn GetAllResponseHeaders(&self) -> ByteString { + ByteString::new(vec!()) } pub fn OverrideMimeType(&self, _mime: DOMString) { |