Transitioned to about:failure instead of having the URL in

Constellation.
This commit is contained in:
Lars Bergstrom 2013-09-12 10:50:37 -07:00
parent 26ec02226e
commit d6231a18ef
2 changed files with 45 additions and 33 deletions

View file

@ -381,8 +381,7 @@ impl Constellation {
let size = self.compositor_chan.get_size();
from_value(Size2D(size.width as uint, size.height as uint))
});
// FIXME(lbergstrom): this should be in/relative-to the servo binary
let failure = ~"../src/test/html/failure.html";
let failure = ~"about:failure";
let url = make_url(failure, None);
pipeline.load(url);

View file

@ -16,9 +16,11 @@ Create a URL object from a string. Does various helpful browsery things like
is based off the current url
*/
// TODO: about:failure->
pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
let schm = url::get_scheme(str_url);
let str_url = if schm.is_err() {
let str_url = match schm {
Err(_) => {
if current_url.is_none() {
// Assume we've been given a file path. If it's absolute just return
// it, otherwise make it absolute with the cwd.
@ -50,8 +52,19 @@ pub fn make_url(str_url: ~str, current_url: Option<Url>) -> Url {
current_url.scheme + "://" + current_url.host + path
}
}
} else {
str_url
},
Ok((scheme, page)) => {
match scheme {
~"about" => {
match page {
~"failure" => ~"file://" + os::getcwd().push("../src/test/html/failure.html").to_str(),
// TODO: handle the rest of the about: pages
_ => str_url
}
},
_ => str_url
}
}
};
// FIXME: Need to handle errors