Bug 185386 - webkitpy: Don't pass "platform" string to VersionNameMap member functions
Summary: webkitpy: Don't pass "platform" string to VersionNameMap member functions
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-07 11:15 PDT by Daniel Bates
Modified: 2018-05-10 08:25 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2018-05-07 11:15:12 PDT
VersionNameMap is confusing to use. One of the issues is that various VersionNameMap functions, including the constructor, take a "platform" that could either be a string that represents the OS name (e.g. High Sierra) or a PlatformInfo object. You need to read the code of each function to know what data type the function argument named "platform" should be.

Expect a PlatformInfo object to be passed for "platform":

VersionNameMap.__init__()
VersionNameMap.map()

Expect a string for "platform":

VersionNameMap.to_name()
VersionNameMap.names()
VersionNameMap.mapping_for_platform()

On another note, it seems weird that VersionNameMap is instantiated with a PlatformInfo for the purpose of querying the platform for the OS name and its member functions can also take an OS name to override the OS name computed in the constructor.
Comment 1 Jonathan Bedard 2018-05-07 11:54:05 PDT
I'm very much open to changing these names.  Possible candidate:
    platform_info and platform_name


As for why we allow overriding the os_name, it's for iOS.  When doing iOS simulator and device testing, we need to retrieve information about the version before we've instantiated the PlatformInfo object for the device.  So we need to extract iOS version information from a Mac VersionNameMap.
Comment 2 Jonathan Bedard 2018-05-10 08:25:41 PDT
This change will be blocked by <https://bugs.webkit.org/show_bug.cgi?id=185387>.