Bug 241322

Summary: Mobile Safari desktop mode user agent reports a different macOS version than Safari on Mac
Product: WebKit Reporter: Nitin Seshadri <apps>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, ap, bfulgham, gsnedders, luming_yin, thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: iPhone / iPad   
OS: All   
See Also: https://bugs.webkit.org/show_bug.cgi?id=217364
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description Nitin Seshadri 2022-06-05 19:27:37 PDT
When Mobile Safari is set to request the desktop website in iOS and iPadOS, it reports a user agent string with the macOS version as 10.15.6:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15

On the other hand, Safari on Mac always reports the macOS version as 10.15.7:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.5 Safari/605.1.15

This inconsistency should be fixed (i.e. Mobile Safari should report 10.15.7 in desktop mode) because it could make it easier for a website to detect whether the visitor is using Mac Safari or is using Mobile Safari, defeating the purpose of desktop mode.
Comment 1 Nitin Seshadri 2022-06-05 20:02:15 PDT
Created attachment 460042 [details]
Patch
Comment 2 Sam Sneddon [:gsnedders] 2022-06-06 05:05:15 PDT
This has repeatedly bugged me (after all, it provides another way to sniff for iOS v. macOS), but I've never taken the small amount of time to actually fix this. (Thanks Nitin!)
Comment 3 Alexey Proskuryakov 2022-06-06 09:47:34 PDT
Thank you for the patch!

Would you be willing to re-submit it with a commit message? It cannot be landed without one. `webkit-patch upload` would include the commit message, and you can confirm that its format matches existing landed commits.

It looks like https://webkit.org/contributing-code/ is currently out of date, we need to fix it ASAP.
Comment 4 Nitin Seshadri 2022-06-06 12:44:55 PDT
Created attachment 460050 [details]
Patch
Comment 5 Nitin Seshadri 2022-06-06 12:45:27 PDT
(In reply to Alexey Proskuryakov from comment #3)
> Would you be willing to re-submit it with a commit message? It cannot be
> landed without one. `webkit-patch upload` would include the commit message,
> and you can confirm that its format matches existing landed commits.

done!
Comment 6 Alexey Proskuryakov 2022-06-06 14:29:18 PDT
Sorry, it's not quite it yet (needs a "Reviewed by NOBODY (OOPS!)" line, otherwise tooling that replaces it with an actual reviewer name won't work).

I think that if you reset, run `git-webkit setup`, and re-commit, the correct template should be generated.
Comment 7 Nitin Seshadri 2022-06-06 15:18:37 PDT
Created attachment 460054 [details]
Patch
Comment 8 Nitin Seshadri 2022-06-06 15:19:23 PDT
(In reply to Alexey Proskuryakov from comment #6)
> Sorry, it's not quite it yet (needs a "Reviewed by NOBODY (OOPS!)" line,
> otherwise tooling that replaces it with an actual reviewer name won't work).
> 
> I think that if you reset, run `git-webkit setup`, and re-commit, the
> correct template should be generated.
Should be fixed now.
Comment 9 Alexey Proskuryakov 2022-06-06 15:57:15 PDT
Comment on attachment 460054 [details]
Patch

Let's see what happens!
Comment 10 EWS 2022-06-06 17:16:04 PDT
Committed r295305 (251347@main): <https://commits.webkit.org/251347@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 460054 [details].
Comment 11 Radar WebKit Bug Importer 2022-06-06 17:17:16 PDT
<rdar://problem/94474123>