Title: [226841] trunk/Tools
Revision
226841
Author
jbed...@apple.com
Date
2018-01-11 19:31:27 -0800 (Thu, 11 Jan 2018)

Log Message

webkitpy: Use partially disambiguated type in SimulatedDeviceManager._disambiguate_device_type
https://bugs.webkit.org/show_bug.cgi?id=181538
<rdar://problem/36440580>

Reviewed by Aakash Jain.

When disambiguating a device type, it is possible that the provided device type is sufficiently
ambiguous that the comparisons against complete device types without a disambiguated hardware_family
will result in a failure to disambiguate the type.

* Scripts/webkitpy/xcode/new_simulated_device.py:
(SimulatedDeviceManager._disambiguate_device_type):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (226840 => 226841)


--- trunk/Tools/ChangeLog	2018-01-12 03:30:40 UTC (rev 226840)
+++ trunk/Tools/ChangeLog	2018-01-12 03:31:27 UTC (rev 226841)
@@ -1,3 +1,18 @@
+2018-01-11  Jonathan Bedard  <jbed...@apple.com>
+
+        webkitpy: Use partially disambiguated type in SimulatedDeviceManager._disambiguate_device_type
+        https://bugs.webkit.org/show_bug.cgi?id=181538
+        <rdar://problem/36440580>
+
+        Reviewed by Aakash Jain.
+
+        When disambiguating a device type, it is possible that the provided device type is sufficiently
+        ambiguous that the comparisons against complete device types without a disambiguated hardware_family
+        will result in a failure to disambiguate the type.
+
+        * Scripts/webkitpy/xcode/new_simulated_device.py:
+        (SimulatedDeviceManager._disambiguate_device_type):
+
 2018-01-11  Brent Fulgham  <bfulg...@apple.com>
 
         REGRESSION(r219530): ResourceLoadStatisticsPersistentStorage should be read-only in ephemeral sessions

Modified: trunk/Tools/Scripts/webkitpy/xcode/new_simulated_device.py (226840 => 226841)


--- trunk/Tools/Scripts/webkitpy/xcode/new_simulated_device.py	2018-01-12 03:30:40 UTC (rev 226840)
+++ trunk/Tools/Scripts/webkitpy/xcode/new_simulated_device.py	2018-01-12 03:31:27 UTC (rev 226841)
@@ -194,32 +194,33 @@
 
     @staticmethod
     def _disambiguate_device_type(device_type):
-        full_type = DeviceType(
+        # Copy by value since we do not want to modify the DeviceType passed in.
+        full_device_type = DeviceType(
             hardware_family=device_type.hardware_family,
             hardware_type=device_type.hardware_type,
             software_version=device_type.software_version,
             software_variant=device_type.software_variant)
 
-        runtime = SimulatedDeviceManager.get_runtime_for_device_type(device_type)
+        runtime = SimulatedDeviceManager.get_runtime_for_device_type(full_device_type)
         assert runtime is not None
-        full_type.software_version = runtime.version
+        full_device_type.software_version = runtime.version
 
-        if device_type.hardware_family is None:
+        if full_device_type.hardware_family is None:
             # We use the existing devices to determine a legal family if no family is specified
             for device in SimulatedDeviceManager.AVAILABLE_DEVICES:
-                if device.platform_device.device_type == device_type:
-                    full_type.hardware_family = device.platform_device.device_type.hardware_family
+                if device.platform_device.device_type == full_device_type:
+                    full_device_type.hardware_family = device.platform_device.device_type.hardware_family
                     break
 
-        if device_type.hardware_type is None:
+        if full_device_type.hardware_type is None:
             # Again, we use the existing devices to determine a legal hardware type
             for device in SimulatedDeviceManager.AVAILABLE_DEVICES:
-                if device.platform_device.device_type == device_type:
-                    full_type.hardware_type = device.platform_device.device_type.hardware_type
+                if device.platform_device.device_type == full_device_type:
+                    full_device_type.hardware_type = device.platform_device.device_type.hardware_type
                     break
 
-        full_type.check_consistency()
-        return full_type
+        full_device_type.check_consistency()
+        return full_device_type
 
     @staticmethod
     def _get_device_identifier_for_type(device_type):
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to