New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pass URL to Browser::new(), delegate url checking logic to 3rd party #16477
Changes from all commits
File filter...
Jump to…
| @@ -480,7 +480,7 @@ const DEFAULT_USER_AGENT: UserAgent = UserAgent::Desktop; | ||
| pub fn default_opts() -> Opts { | ||
| Opts { | ||
| is_running_problem_test: false, | ||
| url: Some(ServoUrl::parse("about:blank").unwrap()), | ||
| url: None, | ||
| tile_size: 512, | ||
| device_pixels_per_px: None, | ||
| time_profiling: None, | ||
| @@ -631,11 +631,10 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { | ||
| } | ||
|
|
||
| let cwd = env::current_dir().unwrap(); | ||
| let homepage_pref = PREFS.get("shell.homepage"); | ||
| let url_opt = if !opt_match.free.is_empty() { | ||
| Some(&opt_match.free[0][..]) | ||
| } else { | ||
| homepage_pref.as_string() | ||
| None | ||
paulrouget
Contributor
|
||
| }; | ||
| let is_running_problem_test = | ||
| url_opt | ||
| @@ -645,16 +644,11 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { | ||
| url.starts_with("http://web-platform.test:8000/_mozilla/mozilla/canvas/") || | ||
| url.starts_with("http://web-platform.test:8000/_mozilla/css/canvas_over_area.html")); | ||
|
|
||
| let url = match url_opt { | ||
| Some(url_string) => { | ||
| parse_url_or_filename(&cwd, url_string) | ||
| .unwrap_or_else(|()| args_fail("URL parsing failed")) | ||
| }, | ||
| None => { | ||
| print_usage(app_name, &opts); | ||
| args_fail("servo asks that you provide a URL") | ||
| } | ||
| }; | ||
| let url_opt = url_opt.and_then(|url_string| parse_url_or_filename(&cwd, url_string) | ||
| .or_else(|error| { | ||
| warn!("URL parsing failed ({:?}).", error); | ||
| Err(error) | ||
| }).ok()); | ||
|
|
||
| let tile_size: usize = match opt_match.opt_str("s") { | ||
| Some(tile_size_str) => tile_size_str.parse() | ||
| @@ -775,7 +769,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult { | ||
|
|
||
| let opts = Opts { | ||
| is_running_problem_test: is_running_problem_test, | ||
| url: Some(url), | ||
| url: url_opt, | ||
| tile_size: tile_size, | ||
| device_pixels_per_px: device_pixels_per_px, | ||
| time_profiling: time_profiling, | ||
| @@ -9,6 +9,8 @@ use interfaces::{CefBrowser, CefBrowserHost, CefClient, CefFrame, CefRequestCont | ||||
| use interfaces::{cef_browser_t, cef_browser_host_t, cef_client_t, cef_frame_t}; | ||||
| use interfaces::{cef_request_context_t}; | ||||
| use servo::Browser; | ||||
| use servo::servo_config::prefs::PREFS; | ||||
paulrouget
Contributor
|
||||
| use servo::servo_url::ServoUrl; | ||||
| use types::{cef_browser_settings_t, cef_string_t, cef_window_info_t, cef_window_handle_t}; | ||||
| use window; | ||||
| use wrappers::CefWrap; | ||||
| @@ -130,7 +132,9 @@ impl ServoCefBrowser { | ||||
| let (glutin_window, servo_browser) = if window_info.windowless_rendering_enabled == 0 { | ||||
| let parent_window = glutin_app::WindowID::new(window_info.parent_window as *mut _); | ||||
| let glutin_window = glutin_app::create_window(Some(parent_window)); | ||||
| let servo_browser = Browser::new(glutin_window.clone()); | ||||
| let home_url = ServoUrl::parse(PREFS.get("shell.homepage").as_string() | ||||
| .unwrap_or("about:blank")).unwrap(); | ||||
| let servo_browser = Browser::new(glutin_window.clone(), home_url); | ||||
paulrouget
Contributor
|
||||
| unsafe { browser.downcast().frame.set_url(CefWrap::to_rust(url)); } |
Flag: what should the url_opt be set to if it can't be parsed from the cmdline?