diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-26 01:53:40 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2017-09-26 09:49:10 +0200 |
commit | f87c2a8d7616112ca924e30292db2d244cf87eec (patch) | |
tree | 7344afe7ec0ec1ac7d1d13f5385111ee9c4be332 /components/script/dom/xmlhttprequest.rs | |
parent | 577370746e2ce3da7fa25a20b8e1bbeed319df65 (diff) | |
download | servo-f87c2a8d7616112ca924e30292db2d244cf87eec.tar.gz servo-f87c2a8d7616112ca924e30292db2d244cf87eec.zip |
Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>,
where Root<T> will be able to handle all the things that need to be
rooted that have a stable traceable address that doesn't move for the
whole lifetime of the root. Stay tuned.
Diffstat (limited to 'components/script/dom/xmlhttprequest.rs')
-rw-r--r-- | components/script/dom/xmlhttprequest.rs | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 16c14cb2e5b..4b9b2b45a4c 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -16,7 +16,7 @@ use dom::bindings::error::{Error, ErrorResult, Fallible}; use dom::bindings::inheritance::Castable; use dom::bindings::refcounted::Trusted; use dom::bindings::reflector::{DomObject, reflect_dom_object}; -use dom::bindings::root::{Dom, MutNullableDom, Root}; +use dom::bindings::root::{Dom, DomRoot, MutNullableDom}; use dom::bindings::str::{ByteString, DOMString, USVString, is_token}; use dom::blob::{Blob, BlobImpl}; use dom::document::{Document, HasBrowsingContext, IsHTMLDocument}; @@ -203,14 +203,14 @@ impl XMLHttpRequest { referrer_policy: referrer_policy, } } - pub fn new(global: &GlobalScope) -> Root<XMLHttpRequest> { + pub fn new(global: &GlobalScope) -> DomRoot<XMLHttpRequest> { reflect_dom_object(box XMLHttpRequest::new_inherited(global), global, XMLHttpRequestBinding::Wrap) } // https://xhr.spec.whatwg.org/#constructors - pub fn Constructor(global: &GlobalScope) -> Fallible<Root<XMLHttpRequest>> { + pub fn Constructor(global: &GlobalScope) -> Fallible<DomRoot<XMLHttpRequest>> { Ok(XMLHttpRequest::new(global)) } @@ -289,7 +289,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest { fn Open_(&self, method: ByteString, url: USVString, async: bool, username: Option<USVString>, password: Option<USVString>) -> ErrorResult { // Step 1 - if let Some(window) = Root::downcast::<Window>(self.global()) { + if let Some(window) = DomRoot::downcast::<Window>(self.global()) { if !window.Document().is_fully_active() { return Err(Error::InvalidState); } @@ -481,8 +481,8 @@ impl XMLHttpRequestMethods for XMLHttpRequest { } // https://xhr.spec.whatwg.org/#the-upload-attribute - fn Upload(&self) -> Root<XMLHttpRequestUpload> { - Root::from_ref(&*self.upload) + fn Upload(&self) -> DomRoot<XMLHttpRequestUpload> { + DomRoot::from_ref(&*self.upload) } // https://xhr.spec.whatwg.org/#the-send()-method @@ -570,7 +570,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest { // preference is enabled, we allow bypassing the CORS check. // This is a temporary measure until we figure out Servo privilege // story. See https://github.com/servo/servo/issues/9582 - if let Some(win) = Root::downcast::<Window>(self.global()) { + if let Some(win) = DomRoot::downcast::<Window>(self.global()) { let is_root_pipeline = win.parent_info().is_none(); is_root_pipeline && PREFS.is_mozbrowser_enabled() } else { @@ -811,7 +811,7 @@ impl XMLHttpRequestMethods for XMLHttpRequest { } // https://xhr.spec.whatwg.org/#the-responsexml-attribute - fn GetResponseXML(&self) -> Fallible<Option<Root<Document>>> { + fn GetResponseXML(&self) -> Fallible<Option<DomRoot<Document>>> { // TODO(#2823): Until [Exposed] is implemented, this attribute needs to return null // explicitly in the worker scope. if self.global().is::<WorkerGlobalScope>() { @@ -1088,7 +1088,7 @@ impl XMLHttpRequest { } // https://xhr.spec.whatwg.org/#blob-response - fn blob_response(&self) -> Root<Blob> { + fn blob_response(&self) -> DomRoot<Blob> { // Step 1 if let Some(response) = self.response_blob.get() { return response; @@ -1104,7 +1104,7 @@ impl XMLHttpRequest { } // https://xhr.spec.whatwg.org/#document-response - fn document_response(&self) -> Option<Root<Document>> { + fn document_response(&self) -> Option<DomRoot<Document>> { // Step 1 let response = self.response_xml.get(); if response.is_some() { @@ -1114,7 +1114,7 @@ impl XMLHttpRequest { let mime_type = self.final_mime_type(); // TODO: prescan the response to determine encoding if final charset is null let charset = self.final_charset().unwrap_or(UTF_8); - let temp_doc: Root<Document>; + let temp_doc: DomRoot<Document>; match mime_type { Some(Mime(mime::TopLevel::Text, mime::SubLevel::Html, _)) => { // Step 5 @@ -1181,7 +1181,7 @@ impl XMLHttpRequest { self.response_json.get() } - fn document_text_html(&self) -> Root<Document> { + fn document_text_html(&self) -> DomRoot<Document> { let charset = self.final_charset().unwrap_or(UTF_8); let wr = self.global(); let decoded = charset.decode(&self.response.borrow(), DecoderTrap::Replace).unwrap(); @@ -1194,7 +1194,7 @@ impl XMLHttpRequest { document } - fn handle_xml(&self) -> Root<Document> { + fn handle_xml(&self) -> DomRoot<Document> { let charset = self.final_charset().unwrap_or(UTF_8); let wr = self.global(); let decoded = charset.decode(&self.response.borrow(), DecoderTrap::Replace).unwrap(); @@ -1207,7 +1207,7 @@ impl XMLHttpRequest { document } - fn new_doc(&self, is_html_document: IsHTMLDocument) -> Root<Document> { + fn new_doc(&self, is_html_document: IsHTMLDocument) -> DomRoot<Document> { let wr = self.global(); let win = wr.as_window(); let doc = win.Document(); |