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
Allow embedders to provide user agent string #25672
Closed
+65
−72
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
88f48d4
Make default_user_agent_string a method on the EmbedderMethods trait …
mediremi 4ba38af
Fix typo in comment
mediremi fe744f5
Fix passing of user_agent to create_constellation
mediremi 6329649
Add default implementation of EmbedderMethods::default_user_agent_string
mediremi 6e43434
Fix constellation
mediremi 8a03db7
Fix formatting
mediremi 910745e
Remove -u option
mediremi 4405d3a
Update user agent strings to those from #25669
mediremi File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.
| @@ -182,6 +182,48 @@ 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 { | ||
| #[cfg(all(target_os = "linux", target_arch = "x86_64"))] | ||
| const UA_STRING: &'static str = | ||
| "Mozilla/5.0 (X11; Linux x86_64; rv:72.0) Servo/1.0 Firefox/72.0"; | ||
| #[cfg(all(target_os = "linux", not(target_arch = "x86_64")))] | ||
| const UA_STRING: &'static str = | ||
| "Mozilla/5.0 (X11; Linux i686; rv:72.0) Servo/1.0 Firefox/72.0"; | ||
|
|
||
| #[cfg(all(target_os = "windows", target_arch = "x86_64"))] | ||
| const UA_STRING: &'static str = | ||
| "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:72.0) Servo/1.0 Firefox/72.0"; | ||
| #[cfg(all(target_os = "windows", not(target_arch = "x86_64")))] | ||
| 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"))] | ||
|
||
| const UA_STRING: &'static str = | ||
| "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:72.0) Servo/1.0 Firefox/72.0"; | ||
|
|
||
| #[cfg(target_os = "android")] | ||
| const UA_STRING: &'static str = | ||
| "Mozilla/5.0 (Android; Mobile; rv:68.0) Servo/1.0 Firefox/68.0"; | ||
|
|
||
| #[cfg(target_os = "ios")] | ||
| const UA_STRING: &'static str = | ||
| "Mozilla/5.0 (iPhone; CPU iPhone OS 13_3 like Mac OS X; rv:72.0) Servo/1.0 Firefox/72.0"; | ||
|
|
||
| #[cfg(not(any( | ||
| target_os = "linux", | ||
| target_os = "windows", | ||
| target_os = "macos", | ||
| target_os = "android", | ||
| target_os = "ios" | ||
| )))] | ||
| // 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"; | ||
paulrouget
Contributor
|
||
|
|
||
| UA_STRING | ||
| } | ||
| } | ||
|
|
||
| #[derive(Clone, Copy, Debug)] | ||
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.
I don’t think the
allis necessary here.