Pass URL to Browser::new(), delegate url checking logic to third party

Use Option instead of ServoUrl for url in opts

Cleaner mapping from parse_url to url_opt

Add comment about url parsing error

Print reason for parsing error

Remove comment about warning

Add home url when openning new browser window in CEF

Fix merge error
This commit is contained in:
Sadman Kazi 2017-04-23 20:17:36 -04:00
parent a6b3bf1517
commit 708c561ae6
4 changed files with 29 additions and 23 deletions

View file

@ -122,7 +122,7 @@ pub struct Browser<Window: WindowMethods + 'static> {
}
impl<Window> Browser<Window> where Window: WindowMethods + 'static {
pub fn new(window: Rc<Window>) -> Browser<Window> {
pub fn new(window: Rc<Window>, target_url: ServoUrl) -> Browser<Window> {
// Global configuration options, parsed from the command line.
let opts = opts::get();
@ -203,7 +203,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
// as the navigation context.
let (constellation_chan, sw_senders) = create_constellation(opts.user_agent.clone(),
opts.config_dir.clone(),
opts.url.clone(),
target_url,
compositor_proxy.clone_compositor_proxy(),
time_profiler_chan.clone(),
mem_profiler_chan.clone(),
@ -287,7 +287,7 @@ fn create_compositor_channel(event_loop_waker: Box<compositor_thread::EventLoopW
fn create_constellation(user_agent: Cow<'static, str>,
config_dir: Option<PathBuf>,
url: Option<ServoUrl>,
url: ServoUrl,
compositor_proxy: CompositorProxy,
time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: mem::ProfilerChan,
@ -337,9 +337,7 @@ fn create_constellation(user_agent: Cow<'static, str>,
constellation_chan.send(ConstellationMsg::SetWebVRThread(webvr_thread)).unwrap();
}
if let Some(url) = url {
constellation_chan.send(ConstellationMsg::InitLoadUrl(url)).unwrap();
};
constellation_chan.send(ConstellationMsg::InitLoadUrl(url)).unwrap();
// channels to communicate with Service Worker Manager
let sw_senders = SWManagerSenders {