Skip to content
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
merged 1 commit into from Aug 11, 2015
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -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";

This comment has been minimized.

Copy link
@eddyb

eddyb Aug 18, 2015

Contributor

IMO, concat! would make this much nicer.

This comment has been minimized.

Copy link
@eddyb

eddyb Aug 18, 2015

Contributor

On a second note, providing the string in the first place might be cumbersome (possibly by defining a macro). YMMV.


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.
You can’t perform that action at this time.