webkitpy: Use partially disambiguated type in SimulatedDeviceManager._disambiguate_de...
authorjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jan 2018 03:31:27 +0000 (03:31 +0000)
committerjbedard@apple.com <jbedard@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 12 Jan 2018 03:31:27 +0000 (03:31 +0000)
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):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@226841 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/xcode/new_simulated_device.py

index bfc6e12..53bd92e 100644 (file)
@@ -1,3 +1,18 @@
+2018-01-11  Jonathan Bedard  <jbedard@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  <bfulgham@apple.com>
 
         REGRESSION(r219530): ResourceLoadStatisticsPersistentStorage should be read-only in ephemeral sessions
 2018-01-11  Brent Fulgham  <bfulgham@apple.com>
 
         REGRESSION(r219530): ResourceLoadStatisticsPersistentStorage should be read-only in ephemeral sessions
index 33debde..6bdd419 100644 (file)
@@ -194,32 +194,33 @@ class SimulatedDeviceManager(object):
 
     @staticmethod
     def _disambiguate_device_type(device_type):
 
     @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)
 
             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
         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:
             # 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
 
                     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:
             # 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
 
                     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):
 
     @staticmethod
     def _get_device_identifier_for_type(device_type):