auto merge of #1776 : lpy/servo/issue1762, r=jdm

see #1762
This commit is contained in:
bors-servo 2014-02-28 02:04:49 -05:00
commit 82b74a373a
5 changed files with 13 additions and 7 deletions

View file

@ -91,7 +91,7 @@ impl HTMLImageElement {
if "src" == name {
let document = self.htmlelement.element.node.owner_doc();
let window = document.get().window.get();
let url = window.page.url.as_ref().map(|&(ref url, _)| url.clone());
let url = Some(window.get_url());
self.update_image(Some(value), url);
}
}

View file

@ -75,7 +75,7 @@ impl HTMLObjectElement {
if "data" == name {
let document = self.htmlelement.element.node.owner_doc();
let window = document.get().window.clone();
let url = window.get().page.url.as_ref().map(|&(ref url, _)| url.clone());
let url = Some(window.get().get_url());
self.process_data_url(window.get().image_cache_task.clone(), url);
}
}

View file

@ -44,7 +44,7 @@ impl Location {
}
pub fn Href(&self) -> DOMString {
self.page.url.get_ref().first().to_str()
self.page.get_url().to_str()
}
pub fn SetHref(&self, _href: DOMString) -> Fallible<()> {

View file

@ -33,6 +33,7 @@ use std::ptr;
use std::to_bytes::Cb;
use extra::serialize::{Encoder, Encodable};
use extra::url::{Url};
pub enum TimerControlMsg {
TimerMessage_Fire(~TimerData),
@ -96,6 +97,9 @@ impl Window {
pub fn get_cx(&self) -> *JSObject {
self.page.js_info.get_ref().js_compartment.cx.ptr
}
pub fn get_url(&self) -> Url {
self.page.get_url()
}
}
#[unsafe_destructor]

View file

@ -261,6 +261,10 @@ impl Page {
};
}
pub fn get_url(&self) -> Url {
self.url.get_ref().first().clone()
}
/// Sends a ping to layout and waits for the response. The response will arrive when the
/// layout task has finished any pending request messages.
pub fn join_layout(&mut self) {
@ -332,7 +336,7 @@ impl Page {
let root: JS<Node> = NodeCast::from(&root);
let reflow = ~Reflow {
document_root: root.to_trusted_node_address(),
url: self.url.get_ref().first().clone(),
url: self.get_url(),
goal: goal,
window_size: self.window_size,
script_chan: script_chan,
@ -989,9 +993,7 @@ impl ScriptTask {
for href in attr.iter() {
debug!("ScriptTask: clicked on link to {:s}", href.get().Value());
let click_frag = href.get().value_ref().starts_with("#");
let base_url = page.url.as_ref().map(|&(ref url, _)| {
url.clone()
});
let base_url = Some(page.get_url());
debug!("ScriptTask: current url is {:?}", base_url);
let url = parse_url(href.get().value_ref(), base_url);