diff options
-rw-r--r-- | src/lib.rs | 15 | ||||
-rw-r--r-- | tests/ref/basic.list | 3 | ||||
-rw-r--r-- | tests/ref/hello_a?foo#bar.html (renamed from tests/ref/hello_a.html) | 0 |
3 files changed, 10 insertions, 8 deletions
diff --git a/src/lib.rs b/src/lib.rs index bb01ad7c739..a00d935ade3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -57,8 +57,6 @@ use std::os; use std::task::TaskBuilder; #[cfg(not(test), target_os="android")] use std::string; -#[cfg(not(test))] -use url::{Url, UrlParser}; #[cfg(not(test), target_os="android")] #[no_mangle] @@ -125,12 +123,15 @@ pub fn run(opts: opts::Opts) { font_cache_task, time_profiler_chan_clone); - let base_url = Url::from_directory_path(&os::getcwd()).unwrap(); - let mut url_parser = UrlParser::new(); - let url_parser = url_parser.base_url(&base_url); // Send the URL command to the constellation. - for url in opts.urls.iter() { - let url = url_parser.parse(url.as_slice()).ok().expect("URL parsing failed"); + let cwd = os::getcwd(); + for &url in opts.urls.iter() { + let url = match url::Url::parse(url.as_slice()) { + Ok(url) => url, + Err(url::RelativeUrlWithoutBase) + => url::Url::from_file_path(&cwd.join(url)).unwrap(), + Err(_) => fail!("URL parsing failed"), + }; let ConstellationChan(ref chan) = constellation_chan; chan.send(InitLoadUrlMsg(url)); diff --git a/tests/ref/basic.list b/tests/ref/basic.list index 9cdcdb108fb..82d2b826099 100644 --- a/tests/ref/basic.list +++ b/tests/ref/basic.list @@ -1,6 +1,7 @@ == basic_width_px.html basic_width_em.html == br.html br-ref.html -== hello_a.html hello_b.html +# `?` and `#` in the name is a test for https://github.com/servo/servo/issues/3340 +== hello_a?foo#bar.html hello_b.html == margin_a.html margin_b.html == root_pseudo_a.html root_pseudo_b.html == first_child_pseudo_a.html first_child_pseudo_b.html diff --git a/tests/ref/hello_a.html b/tests/ref/hello_a?foo#bar.html index 6ef40f0f03c..6ef40f0f03c 100644 --- a/tests/ref/hello_a.html +++ b/tests/ref/hello_a?foo#bar.html |