Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAllow embedders to provide user agent string #25672
Conversation
highfive
commented
Feb 1, 2020
|
Heads up! This PR modifies the following files:
|
highfive
commented
Feb 1, 2020
|
|
|
#25669 updated Servo's user agent strings. Could you please match those changes in this PR? |
0225338
to
249199c
249199c
to
4405d3a
|
So the UA is defined by (sorted by priority):
Maybe in component/servo check if the option is set (it’s also fine, even maybe better, if it happens in ports/glutin), if not, call the embedder callback. And maybe the default UA function should not live in windowing.rs but in component/servo. It would look like this: in components/servo,
|
| @@ -182,6 +182,9 @@ pub trait EmbedderMethods { | |||
|
|
|||
| /// Register services with a WebXR Registry. | |||
| fn register_webxr(&mut self, _: &mut webxr::MainThreadRegistry) {} | |||
|
|
|||
| /// Returns the default user agent string | |||
| fn default_user_agent_string(&self) -> &'static str; | |||
This comment has been minimized.
This comment has been minimized.
| const UA_STRING: &'static str = | ||
| "Mozilla/5.0 (Windows NT 10.0; rv:72.0) Servo/1.0 Firefox/72.0"; | ||
|
|
||
| #[cfg(all(target_os = "macos"))] |
This comment has been minimized.
This comment has been minimized.
| )))] | ||
| // Use OS X user agent as fallback | ||
| const UA_STRING: &'static str = | ||
| "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Servo/1.0 Firefox/72.0"; |
This comment has been minimized.
This comment has been minimized.
paulrouget
Feb 7, 2020
Contributor
That’s fine because it’s what we’ve been doing until now. But maybe we should just not have a fallback. Once we support a new platform, we would let it fail at compile time.
| Some(ref ua) if ua == "desktop" => default_user_agent_string(UserAgent::Desktop).into(), | ||
| Some(ua) => ua.into(), | ||
| None => default_user_agent_string(DEFAULT_USER_AGENT).into(), | ||
| }; |
This comment has been minimized.
This comment has been minimized.
|
|
|
This was finished in #26103. |
mediremi commentedFeb 1, 2020
•
edited
Allow embedders to provide user agent string instead of setting it in servo/components/config/opts.rs.
./mach build -ddoes not report any errors./mach test-tidydoes not report any errors