mirror of
https://github.com/servo/servo.git
synced 2025-06-21 07:38:59 +01:00
handle relative url's when clicking
This commit is contained in:
parent
bf4df24521
commit
ff1178f7ca
1 changed files with 7 additions and 6 deletions
|
@ -39,7 +39,8 @@ use js;
|
||||||
use servo_net::image_cache_task::ImageCacheTask;
|
use servo_net::image_cache_task::ImageCacheTask;
|
||||||
use servo_net::resource_task::ResourceTask;
|
use servo_net::resource_task::ResourceTask;
|
||||||
use servo_util::tree::TreeNodeRef;
|
use servo_util::tree::TreeNodeRef;
|
||||||
use std::net::url::{Url, from_str};
|
use servo_util::url::make_url;
|
||||||
|
use std::net::url::Url;
|
||||||
use std::net::url;
|
use std::net::url;
|
||||||
|
|
||||||
/// Messages used to control the script task.
|
/// Messages used to control the script task.
|
||||||
|
@ -559,12 +560,12 @@ impl ScriptContext {
|
||||||
for element.attrs.each |attr| {
|
for element.attrs.each |attr| {
|
||||||
if attr.name == ~"href" {
|
if attr.name == ~"href" {
|
||||||
debug!("clicked on link to %?", attr.value);
|
debug!("clicked on link to %?", attr.value);
|
||||||
let url = from_str(attr.value);
|
let current_url = match self.root_frame {
|
||||||
match url {
|
Some(ref frame) => Some(frame.url.clone()),
|
||||||
Ok(url) => self.engine_task.send(LoadUrlMsg(url)),
|
None => None
|
||||||
Err(msg) => debug!(msg)
|
|
||||||
};
|
};
|
||||||
break;
|
let url = make_url(attr.value.clone(), current_url);
|
||||||
|
self.engine_task.send(LoadUrlMsg(url));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue