script: Stop copying the document URL.

This commit is contained in:
Patrick Walton 2015-07-28 19:08:35 -07:00
parent 4d1be2f56c
commit 5dce5f0c97
8 changed files with 19 additions and 16 deletions

View file

@ -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(())
}