Remove call to env::current_dir from Browser

Put it in util::opts instead.
This commit is contained in:
Brian Anderson 2015-05-09 00:48:25 -07:00
parent dd04cf46d1
commit aa906a54d3
8 changed files with 18 additions and 21 deletions

View file

@ -32,7 +32,6 @@ extern crate script;
extern crate layout;
extern crate gfx;
extern crate libc;
extern crate url;
extern crate webdriver_server;
use compositing::CompositorEventListener;
@ -153,8 +152,6 @@ fn create_constellation(opts: opts::Opts,
time_profiler_chan: time::ProfilerChan,
devtools_chan: Option<Sender<devtools_traits::DevtoolsControlMsg>>,
mem_profiler_chan: mem::ProfilerChan) -> ConstellationChan {
use std::env;
let resource_task = new_resource_task(opts.user_agent.clone(), devtools_chan.clone());
let image_cache_task = new_image_cache_task(resource_task.clone());
@ -173,17 +170,9 @@ fn create_constellation(opts: opts::Opts,
storage_task);
// Send the URL command to the constellation.
let cwd = env::current_dir().unwrap();
let url = match url::Url::parse(&opts.url) {
Ok(url) => url,
Err(url::ParseError::RelativeUrlWithoutBase)
=> url::Url::from_file_path(&*cwd.join(&opts.url)).unwrap(),
Err(_) => panic!("URL parsing failed"),
};
{
let ConstellationChan(ref chan) = constellation_chan;
chan.send(ConstellationMsg::InitLoadUrl(url)).unwrap();
chan.send(ConstellationMsg::InitLoadUrl(opts.url.clone())).unwrap();
}
constellation_chan