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
Add the Servo User Agent strings #7143
Merged
+15
−1
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
Loading status checks…
Add the Servo User Agent strings
- Loading branch information
commit 6a4ce717cbb7c4a21e1b301f6237805a9bcb4306
| @@ -229,6 +229,18 @@ static FORCE_CPU_PAINTING: bool = true; | ||
| #[cfg(not(target_os="android"))] | ||
| static FORCE_CPU_PAINTING: bool = false; | ||
|
|
||
| #[cfg(target_os="android")] | ||
| const DEFAULT_USER_AGENT: &'static str = "Mozilla/5.0 (Android; Mobile; rv:37.0) Servo/1.0 Firefox/37.0"; | ||
|
|
||
| // FIXME: This requires https://github.com/servo/servo/issues/7138 to provide the | ||
| // correct string in Gonk builds (i.e., it will never be chosen today). | ||
| #[cfg(target_os="gonk")] | ||
| const DEFAULT_USER_AGENT: &'static str = "Mozilla/5.0 (Mobile; rv:37.0) Servo/1.0 Firefox/37.0"; | ||
|
|
||
| #[cfg(not(any(target_os="android", target_os="gonk")))] | ||
| const DEFAULT_USER_AGENT: &'static str = | ||
| "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:37.0) Servo/1.0 Firefox/37.0"; | ||
eddyb
Contributor
|
||
|
|
||
| pub fn default_opts() -> Opts { | ||
| Opts { | ||
| url: Some(Url::parse("about:blank").unwrap()), | ||
| @@ -411,6 +423,8 @@ pub fn from_cmdline_args(args: &[String]) { | ||
| } | ||
| }; | ||
|
|
||
| let user_agent = opt_match.opt_str("u").or(Some(DEFAULT_USER_AGENT.to_string())); | ||
|
|
||
| let user_stylesheets = opt_match.opt_strs("user-stylesheet").iter().map(|filename| { | ||
| let path = cwd.join(filename); | ||
| let url = Url::from_file_path(&path).unwrap(); | ||
| @@ -447,7 +461,7 @@ pub fn from_cmdline_args(args: &[String]) { | ||
| devtools_port: devtools_port, | ||
| webdriver_port: webdriver_port, | ||
| initial_window_size: initial_window_size, | ||
| user_agent: opt_match.opt_str("u"), | ||
| user_agent: user_agent, | ||
| multiprocess: opt_match.opt_present("M"), | ||
| show_debug_borders: debug_options.contains(&"show-compositor-borders"), | ||
| show_debug_fragment_borders: debug_options.contains(&"show-fragment-borders"), | ||
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
IMO,
concat!would make this much nicer.