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

Fix broken iOS UA sniff that identified iOS as macOS #1365

Merged
merged 1 commit into from
Nov 1, 2017

Conversation

rgrove
Copy link
Contributor

@rgrove rgrove commented Nov 1, 2017

UA sniffing stops at the first match when trying to determine the client's OS. Since the macOS sniff always ran before the iOS sniff and matched the string "mac os x", which is also present in iOS Safari's user agent string, IS_MAC was always true for iOS Safari and IS_IOS was always false.

The iOS sniff now runs before the macOS sniff, which prevents false positives. Existing uses of IS_MAC that should also apply to iOS have been updated to check for IS_MAC || IS_IOS.

This also re-fixes #1176 and #1177, which regressed when a recent change added IS_IOS checks that inadvertently prevented code from running on iOS.

UA sniffing stops at the first match when trying to determine the
client's OS. Since the macOS sniff always ran before the iOS sniff and
matched the string "mac os x", which is also present in iOS Safari's
user agent string, `IS_MAC` was always `true` for iOS Safari and
`IS_IOS` was always `false`.

The iOS sniff now runs before the macOS sniff, which prevents false
positives. Existing uses of `IS_MAC` that should also apply to iOS have
been updated to check for `IS_MAC || IS_IOS`.

This also re-fixes ianstormtaylor#1176 and ianstormtaylor#1177, which regressed when a recent change
added `IS_IOS` checks that inadvertently prevented code from running on
iOS.
@ianstormtaylor
Copy link
Owner

Good catch, thanks @rgrove!

@ianstormtaylor ianstormtaylor merged commit 87d8eb1 into ianstormtaylor:master Nov 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

iOS Safari: Predictive text suggestions don't seem to recognize word breaks
2 participants