Bug 174182 - [iOS] User agent string incorrectly says "iPhone" instead of "iPad" on newer iPads
Summary: [iOS] User agent string incorrectly says "iPhone" instead of "iPad" on newer ...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-07-05 15:41 PDT by Chris Dumez
Modified: 2017-07-05 20:11 PDT (History)
4 users (show)

See Also:


Attachments
Patch (2.68 KB, patch)
2017-07-05 16:04 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (3.17 KB, patch)
2017-07-05 16:19 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (3.05 KB, patch)
2017-07-05 16:50 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (3.04 KB, patch)
2017-07-05 17:05 PDT, Chris Dumez
commit-queue: commit-queue-
Details | Formatted Diff | Diff
Patch for landing (3.03 KB, patch)
2017-07-05 18:23 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-07-05 15:41:12 PDT
User agent string incorrectly says "iPhone" instead of "iPad" on newer iPads.
Comment 1 Chris Dumez 2017-07-05 15:41:29 PDT
<rdar://problem/32868369>
Comment 2 Chris Dumez 2017-07-05 16:04:07 PDT
Created attachment 314661 [details]
Patch
Comment 3 Chris Dumez 2017-07-05 16:19:34 PDT
Created attachment 314663 [details]
Patch
Comment 4 Tim Horton 2017-07-05 16:36:33 PDT
Comment on attachment 314663 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=314663&action=review

> Source/WebCore/page/ios/UserAgentIOS.mm:45
> +    bool isClassicOnPad = deviceClass() == MGDeviceClassiPad && [[getUIApplicationClass() sharedApplication] _isClassic];
> +    return isClassicOnPad && [getUIApplicationClass() _classicMode] != UIApplicationSceneClassicModeOriginalPad;

I think (for reasons explained on IRC) we should go with something that does this:

if (is classic) {
    if (is UIApplicationSceneClassicModeOriginalPad)
        return @"iPad"
    return @"iPhone"
}
... return deviceName
Comment 5 Chris Dumez 2017-07-05 16:50:13 PDT
Created attachment 314667 [details]
Patch
Comment 6 Tim Horton 2017-07-05 16:55:28 PDT
Comment on attachment 314667 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=314667&action=review

> Source/WebCore/page/ios/UserAgentIOS.mm:49
> +    return isClassic() && [getUIApplicationClass() _classicMode] == UIApplicationSceneClassicModeOriginalPad;

Technically no reason to check isClassic here because it just checks that _classicMode is not the "none" mode :P
Comment 7 Chris Dumez 2017-07-05 17:05:44 PDT
Created attachment 314669 [details]
Patch
Comment 8 WebKit Commit Bot 2017-07-05 17:12:36 PDT
Comment on attachment 314669 [details]
Patch

Rejecting attachment 314669 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-03', 'validate-changelog', '--check-oops', '--non-interactive', 314669, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

ChangeLog entry in Source/WebCore/ChangeLog contains OOPS!.

Full output: http://webkit-queues.webkit.org/results/4059537
Comment 9 Chris Dumez 2017-07-05 18:23:09 PDT
Created attachment 314673 [details]
Patch for landing
Comment 10 WebKit Commit Bot 2017-07-05 19:01:33 PDT
Comment on attachment 314673 [details]
Patch for landing

Clearing flags on attachment: 314673

Committed r219177: <http://trac.webkit.org/changeset/219177>
Comment 11 WebKit Commit Bot 2017-07-05 19:01:35 PDT
All reviewed patches have been landed.  Closing bug.
Comment 12 Chris Dumez 2017-07-05 20:11:26 PDT
Follow-up build fixes:
https://trac.webkit.org/r219183 & https://trac.webkit.org/r219184