Auto merge of #17312 - sadmansk:fix/broken_windows_build, r=paulrouget

Fix parsing of shell.homepage

<!-- Please describe your changes on the following line: -->
This should fix the nightly builds crashing, although I don't know how to verify whether my fixes worked since I don't know how to test packaging. Any pointers on how to do that would be highly appreciated.

@paulrouget Please let me know if there are any problems with these changes.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #17290
<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17312)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-06-16 18:36:11 -07:00 committed by GitHub
commit 91bdc50e10

View file

@ -35,7 +35,7 @@ use servo::Browser;
use servo::compositing::windowing::WindowEvent; use servo::compositing::windowing::WindowEvent;
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
use servo::config; use servo::config;
use servo::config::opts::{self, ArgumentParsingResult}; use servo::config::opts::{self, ArgumentParsingResult, parse_url_or_filename};
use servo::config::servo_version; use servo::config::servo_version;
use servo::servo_config::prefs::PREFS; use servo::servo_config::prefs::PREFS;
use servo::servo_url::ServoUrl; use servo::servo_url::ServoUrl;
@ -147,9 +147,13 @@ fn main() {
// If the url is not provided, we fallback to the homepage in PREFS, // If the url is not provided, we fallback to the homepage in PREFS,
// or a blank page in case the homepage is not set either. // or a blank page in case the homepage is not set either.
let target_url = opts::get().url.clone() let cwd = env::current_dir().unwrap();
.unwrap_or(ServoUrl::parse(PREFS.get("shell.homepage").as_string() let cmdline_url = opts::get().url.clone();
.unwrap_or("about:blank")).unwrap()); let pref_url = PREFS.get("shell.homepage").as_string()
.and_then(|str| parse_url_or_filename(&cwd, str).ok());
let blank_url = ServoUrl::parse("about:blank").ok();
let target_url = cmdline_url.or(pref_url).or(blank_url).unwrap();
// Our wrapper around `Browser` that also implements some // Our wrapper around `Browser` that also implements some
// callbacks required by the glutin window implementation. // callbacks required by the glutin window implementation.