webkitpy: Don't pass "platform" string to VersionNameMap member functions
https://bugs.webkit.org/show_bug.cgi?id=185386
Summary webkitpy: Don't pass "platform" string to VersionNameMap member functions
Daniel Bates
Reported 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.
Attachments
Jonathan Bedard
Comment 1 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.
Jonathan Bedard
Comment 2 2018-05-10 08:25:41 PDT
This change will be blocked by <https://bugs.webkit.org/show_bug.cgi?id=185387>.
Note You need to log in before you can comment on or make changes to this bug.