diff options
author | Patrick Walton <pcwalton@mimiga.net> | 2015-07-28 19:08:35 -0700 |
---|---|---|
committer | Patrick Walton <pcwalton@mimiga.net> | 2015-09-24 18:54:53 -0700 |
commit | 5dce5f0c970124610e0a6e4db0f44bdb5ca7cdd8 (patch) | |
tree | fe5a211ae050f2a5aa79e8d606ffcf46d557c792 /components/script/dom/document.rs | |
parent | 4d1be2f56cd7a37c4c803ba12733fca55b57d4de (diff) | |
download | servo-5dce5f0c970124610e0a6e4db0f44bdb5ca7cdd8.tar.gz servo-5dce5f0c970124610e0a6e4db0f44bdb5ca7cdd8.zip |
script: Stop copying the document URL.
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r-- | components/script/dom/document.rs | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index 70849da483f..db4c72af8dc 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -226,7 +226,6 @@ impl CollectionFilter for AppletsFilter { } } - impl Document { #[inline] pub fn loader(&self) -> Ref<DocumentLoader> { @@ -269,16 +268,16 @@ impl Document { } // https://dom.spec.whatwg.org/#concept-document-url - pub fn url(&self) -> Url { - self.url.clone() + pub fn url<'a>(&'a self) -> &'a Url { + &self.url } // https://html.spec.whatwg.org/multipage/#fallback-base-url - pub fn fallback_base_url(&self) -> Url { + pub fn fallback_base_url<'a>(&'a self) -> Url { // Step 1: iframe srcdoc (#4767). // Step 2: about:blank with a creator browsing context. // Step 3. - self.url() + self.url().clone() } // https://html.spec.whatwg.org/multipage/#document-base-url @@ -1735,7 +1734,7 @@ impl DocumentMethods for Document { } let window = self.window.root(); let (tx, rx) = ipc::channel().unwrap(); - let _ = window.r().resource_task().send(GetCookiesForUrl(url, tx, NonHTTP)); + let _ = window.r().resource_task().send(GetCookiesForUrl((*url).clone(), tx, NonHTTP)); let cookies = rx.recv().unwrap(); Ok(cookies.unwrap_or("".to_owned())) } @@ -1744,11 +1743,11 @@ impl DocumentMethods for Document { fn SetCookie(&self, cookie: DOMString) -> ErrorResult { //TODO: ignore for cookie-averse Document let url = self.url(); - if !is_scheme_host_port_tuple(&url) { + if !is_scheme_host_port_tuple(url) { return Err(Security); } let window = self.window.root(); - let _ = window.r().resource_task().send(SetCookiesForUrl(url, cookie, NonHTTP)); + let _ = window.r().resource_task().send(SetCookiesForUrl((*url).clone(), cookie, NonHTTP)); Ok(()) } |