mirror of
https://github.com/servo/servo.git
synced 2025-06-24 00:54:32 +01:00
Add url getter to Page and fix users of Page url with it.(fixes #1762)
This commit is contained in:
parent
94a12469f0
commit
8fc5ba5dc6
5 changed files with 13 additions and 7 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<()> {
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue