Title: [212116] trunk/Source
Revision
212116
Author
bb...@apple.com
Date
2017-02-10 09:29:36 -0800 (Fri, 10 Feb 2017)

Log Message

[Cocoa] Web Inspector: generate an NS_ENUM containing platforms supported by the protocol code generator
https://bugs.webkit.org/show_bug.cgi?id=168019
<rdar://problem/28718990>

Reviewed by Joseph Pecoraro.

Source/_javascript_Core:

It's useful to have an symbolic value (not a string) for each of the supported platform values.
Generate this once per protocol for the Objective-C bindings. Covered by existing tests.

* inspector/scripts/codegen/generate_objc_header.py:
(ObjCHeaderGenerator.generate_output):
(ObjCHeaderGenerator._generate_enum_for_platforms):
Create an NS_ENUM for Platform values in Platforms.

* inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py:
(ObjCProtocolTypeConversionsHeaderGenerator.generate_output):
(ObjCProtocolTypeConversionsHeaderGenerator._generate_enum_conversion_for_platforms):
Add type conversion/parsing methods for the newly added enum.

* inspector/scripts/codegen/generator.py:
(Generator.stylized_name_for_enum_value):
(Generator.stylized_name_for_enum_value.replaceCallback):
Support arbitrary special-cased substrings in enums, not just all-caps. Add 'IOS' and 'MacOS'.

* inspector/scripts/codegen/models.py:
(Platforms):
Use lower-case string values for platform names, to avoid guesswork.

(Platforms.__metaclass__):
(Platforms.__metaclass__.__iter__):
Make it possible to iterate over Platform instances of Platforms.

* inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result:
* inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result:
* inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result:
* inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result:
* inspector/scripts/tests/generic/expected/domain-availability.json-result:
* inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result:
* inspector/scripts/tests/generic/expected/enum-values.json-result:
* inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result:
* inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result:
* inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result:
* inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result:
* inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result:
* inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result:
* inspector/scripts/tests/generic/expected/worker-supported-domains.json-result:
* inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result:
* inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result:
Rebaseline results.

Source/WebKit2:

* UIProcess/Automation/Automation.json: Fix the platform values to be lowercase.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (212115 => 212116)


--- trunk/Source/_javascript_Core/ChangeLog	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-02-10 17:29:36 UTC (rev 212116)
@@ -1,3 +1,58 @@
+2017-02-10  Brian Burg  <bb...@apple.com>
+
+        [Cocoa] Web Inspector: generate an NS_ENUM containing platforms supported by the protocol code generator
+        https://bugs.webkit.org/show_bug.cgi?id=168019
+        <rdar://problem/28718990>
+
+        Reviewed by Joseph Pecoraro.
+
+        It's useful to have an symbolic value (not a string) for each of the supported platform values.
+        Generate this once per protocol for the Objective-C bindings. Covered by existing tests.
+
+        * inspector/scripts/codegen/generate_objc_header.py:
+        (ObjCHeaderGenerator.generate_output):
+        (ObjCHeaderGenerator._generate_enum_for_platforms):
+        Create an NS_ENUM for Platform values in Platforms.
+
+        * inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py:
+        (ObjCProtocolTypeConversionsHeaderGenerator.generate_output):
+        (ObjCProtocolTypeConversionsHeaderGenerator._generate_enum_conversion_for_platforms):
+        Add type conversion/parsing methods for the newly added enum.
+
+        * inspector/scripts/codegen/generator.py:
+        (Generator.stylized_name_for_enum_value):
+        (Generator.stylized_name_for_enum_value.replaceCallback):
+        Support arbitrary special-cased substrings in enums, not just all-caps. Add 'IOS' and 'MacOS'.
+
+        * inspector/scripts/codegen/models.py:
+        (Platforms):
+        Use lower-case string values for platform names, to avoid guesswork.
+
+        (Platforms.__metaclass__):
+        (Platforms.__metaclass__.__iter__):
+        Make it possible to iterate over Platform instances of Platforms.
+
+        * inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result:
+        * inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result:
+        * inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result:
+        * inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result:
+        * inspector/scripts/tests/generic/expected/domain-availability.json-result:
+        * inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result:
+        * inspector/scripts/tests/generic/expected/enum-values.json-result:
+        * inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result:
+        * inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result:
+        * inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result:
+        * inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result:
+        * inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result:
+        * inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result:
+        * inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result:
+        * inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result:
+        * inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result:
+        * inspector/scripts/tests/generic/expected/worker-supported-domains.json-result:
+        * inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result:
+        * inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result:
+        Rebaseline results.
+
 2017-02-09  Filip Pizlo  <fpi...@apple.com>
 
         SharedArrayBuffer does not need to be in the transfer list

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_objc_header.py (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_objc_header.py	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_objc_header.py	2017-02-10 17:29:36 UTC (rev 212116)
@@ -30,7 +30,7 @@
 from string import Template
 
 from generator import Generator, ucfirst
-from models import ObjectType, EnumType
+from models import ObjectType, EnumType, Platforms
 from objc_generator import ObjCGenerator, join_type_and_name
 from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
 
@@ -73,6 +73,7 @@
         sections.append(self.generate_license())
         sections.append(Template(ObjCTemplates.HeaderPrelude).substitute(None, **header_args))
         sections.append('\n'.join(filter(None, map(self._generate_forward_declarations, type_domains))))
+        sections.append(self._generate_enum_for_platforms())
         sections.append('\n'.join(filter(None, map(self._generate_enums, type_domains))))
         sections.append('\n'.join(filter(None, map(self._generate_types, type_domains))))
 
@@ -134,6 +135,11 @@
                 lines.append(self._generate_type_interface(domain, declaration))
         return '\n'.join(lines)
 
+    def _generate_enum_for_platforms(self):
+        objc_enum_name = '%sPlatform' % self.objc_prefix()
+        enum_values = [platform.name for platform in Platforms]
+        return self._generate_enum(objc_enum_name, enum_values)
+
     def _generate_anonymous_enum_for_declaration(self, domain, declaration):
         objc_enum_name = self.objc_enum_name_for_anonymous_enum_declaration(declaration)
         return self._generate_enum(objc_enum_name, declaration.type.enum_values())

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_objc_protocol_type_conversions_header.py	2017-02-10 17:29:36 UTC (rev 212116)
@@ -30,7 +30,7 @@
 from string import Template
 
 from generator import Generator
-from models import EnumType, Frameworks
+from models import EnumType, Frameworks, Platforms
 from objc_generator import ObjCGenerator
 from objc_generator_templates import ObjCGeneratorTemplates as ObjCTemplates
 
@@ -69,6 +69,7 @@
         sections.append(self.generate_license())
         sections.append(Template(ObjCTemplates.TypeConversionsHeaderPrelude).substitute(None, **header_args))
         sections.append(Template(ObjCTemplates.TypeConversionsHeaderStandard).substitute(None))
+        sections.append(self._generate_enum_conversion_for_platforms())
         sections.extend(map(self._generate_enum_conversion_functions, domains))
         sections.append(Template(ObjCTemplates.TypeConversionsHeaderPostlude).substitute(None, **header_args))
         return '\n\n'.join(sections)
@@ -107,6 +108,14 @@
 
         return '\n'.join(lines)
 
+    def _generate_enum_conversion_for_platforms(self):
+        objc_enum_name = '%sPlatform' % self.objc_prefix()
+        enum_values = [platform.name for platform in Platforms]
+        lines = []
+        lines.append(self._generate_enum_objc_to_protocol_string(objc_enum_name, enum_values))
+        lines.append(self._generate_enum_from_protocol_string(objc_enum_name, enum_values))
+        return '\n\n'.join(lines)
+
     def _generate_anonymous_enum_conversion_for_declaration(self, domain, declaration):
         objc_enum_name = self.objc_enum_name_for_anonymous_enum_declaration(declaration)
         enum_values = declaration.type.enum_values()

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generator.py (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generator.py	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generator.py	2017-02-10 17:29:36 UTC (rev 212116)
@@ -38,7 +38,8 @@
 def ucfirst(str):
     return str[:1].upper() + str[1:]
 
-_ALWAYS_UPPERCASED_ENUM_VALUE_SUBSTRINGS = set(['API', 'CSS', 'DOM', 'HTML', 'JIT', 'XHR', 'XML'])
+_ALWAYS_SPECIALCASED_ENUM_VALUE_SUBSTRINGS = set(['API', 'CSS', 'DOM', 'HTML', 'JIT', 'XHR', 'XML', 'IOS', 'MacOS'])
+_ALWAYS_SPECIALCASED_ENUM_VALUE_LOOKUP_TABLE = dict([(s.upper(), s) for s in _ALWAYS_SPECIALCASED_ENUM_VALUE_SUBSTRINGS])
 
 # These objects are built manually by creating and setting InspectorValues.
 # Before sending these over the protocol, their shapes are checked against the specification.
@@ -238,10 +239,10 @@
 
     @staticmethod
     def stylized_name_for_enum_value(enum_value):
-        regex = '(%s)' % "|".join(_ALWAYS_UPPERCASED_ENUM_VALUE_SUBSTRINGS)
+        regex = '(%s)' % "|".join(_ALWAYS_SPECIALCASED_ENUM_VALUE_SUBSTRINGS)
 
         def replaceCallback(match):
-            return match.group(1).upper()
+            return _ALWAYS_SPECIALCASED_ENUM_VALUE_LOOKUP_TABLE[match.group(1).upper()]
 
         # Split on hyphen, introduce camelcase, and force uppercasing of acronyms.
         subwords = map(ucfirst, enum_value.split('-'))

Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/models.py (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/codegen/models.py	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/models.py	2017-02-10 17:29:36 UTC (rev 212116)
@@ -132,11 +132,17 @@
 
 
 class Platforms:
-    All = Platform("All")
+    All = Platform("all")
     Generic = Platform("generic")
-    iOS = Platform("iOS")
-    macOS = Platform("macOS")
+    iOS = Platform("ios")
+    macOS = Platform("macos")
 
+    # Allow iteration over all platforms. See <http://stackoverflow.com/questions/5434400/>.
+    class __metaclass__(type):
+        def __iter__(self):
+            for attr in dir(Platforms):
+                if not attr.startswith("__"):
+                    yield getattr(Platforms, attr)
 
 class TypeReference:
     def __init__(self, type_kind, referenced_type_name, enum_values, array_items):

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/all/expected/definitions-with-mac-platform.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -894,9 +894,16 @@
 
 @class TestProtocolNetworkError;
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
+
 __attribute__((visibility ("default")))
 @interface TestProtocolNetworkError : RWIProtocolJSONObject
 - (instancetype)initWithPayload:(NSDictionary<NSString *, id> *)payload;
@@ -1001,8 +1008,37 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
 
+
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/commands-with-async-attribute.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -1282,7 +1282,14 @@
 
 @class TestProtocolDatabaseError;
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
+
 typedef NS_ENUM(NSInteger, TestProtocolDatabasePrimaryColors) {
     TestProtocolDatabasePrimaryColorsRed,
     TestProtocolDatabasePrimaryColorsGreen,
@@ -1420,7 +1427,36 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
+
 inline String toProtocolString(TestProtocolDatabasePrimaryColors value)
 {
     switch(value) {

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/commands-with-optional-call-return-parameters.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -1139,7 +1139,14 @@
 
 @class TestProtocolDatabaseError;
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
+
 typedef NS_ENUM(NSInteger, TestProtocolDatabasePrimaryColors) {
     TestProtocolDatabasePrimaryColorsRed,
     TestProtocolDatabasePrimaryColorsGreen,
@@ -1275,7 +1282,36 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
+
 inline String toProtocolString(TestProtocolDatabasePrimaryColors value)
 {
     switch(value) {

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/definitions-with-mac-platform.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -646,6 +646,12 @@
 
 
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
@@ -655,6 +661,7 @@
 
 
 
+
 ### End File: TestProtocol.h
 
 ### Begin File: TestProtocolInternal.h
@@ -737,6 +744,35 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
+
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/domain-availability.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/domain-availability.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/domain-availability.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -892,10 +892,17 @@
 
 
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
 
+
 @protocol TestProtocolDomainADomainHandler <NSObject>
 @required
 - (void)enableWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
@@ -991,6 +998,35 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
+
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/domains-with-varying-command-sizes.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -1149,10 +1149,17 @@
 
 
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
 
+
 @protocol TestProtocolNetwork1DomainHandler <NSObject>
 @required
 - (void)loadResource1WithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
@@ -1254,8 +1261,37 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
 
+
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/enum-values.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/enum-values.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/enum-values.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -929,7 +929,14 @@
 
 
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
+
 typedef NS_ENUM(NSInteger, TestProtocolTypeDomainEnum) {
     TestProtocolTypeDomainEnumShared,
     TestProtocolTypeDomainEnumRed,
@@ -1034,7 +1041,36 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
+
 inline String toProtocolString(TestProtocolTypeDomainEnum value)
 {
     switch(value) {

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/events-with-optional-parameters.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -882,9 +882,16 @@
 
 @class TestProtocolDatabaseError;
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
+
 __attribute__((visibility ("default")))
 @interface TestProtocolDatabaseError : RWIProtocolJSONObject
 - (instancetype)initWithPayload:(NSDictionary<NSString *, id> *)payload;
@@ -987,8 +994,37 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
 
+
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/generate-domains-with-feature-guards.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -921,9 +921,16 @@
 
 @class TestProtocolNetwork2NetworkError;
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
+
 __attribute__((visibility ("default")))
 @interface TestProtocolNetwork2NetworkError : RWIProtocolJSONObject
 - (instancetype)initWithPayload:(NSDictionary<NSString *, id> *)payload;
@@ -1028,8 +1035,37 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
 
+
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/same-type-id-different-domain.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -656,6 +656,12 @@
 
 
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
@@ -665,6 +671,7 @@
 
 
 
+
 ### End File: TestProtocol.h
 
 ### Begin File: TestProtocolInternal.h
@@ -747,10 +754,39 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
 
 
 
+
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/shadowed-optional-type-setters.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -779,7 +779,14 @@
 
 @class TestProtocolRuntimeKeyPath;
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
+
 typedef NS_ENUM(NSInteger, TestProtocolRuntimeKeyPathType) {
     TestProtocolRuntimeKeyPathTypeNull,
     TestProtocolRuntimeKeyPathTypeString,
@@ -884,7 +891,36 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
+
 inline String toProtocolString(TestProtocolRuntimeKeyPathType value)
 {
     switch(value) {

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-aliased-primitive-type.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -651,6 +651,12 @@
 
 
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
@@ -660,6 +666,7 @@
 
 
 
+
 ### End File: TestProtocol.h
 
 ### Begin File: TestProtocolInternal.h
@@ -742,8 +749,37 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
 
+
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-array-type.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -729,7 +729,14 @@
 
 
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
+
 typedef NS_ENUM(NSInteger, TestProtocolDebuggerReason) {
     TestProtocolDebuggerReasonDied,
     TestProtocolDebuggerReasonFainted,
@@ -825,7 +832,36 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
+
 inline String toProtocolString(TestProtocolDebuggerReason value)
 {
     switch(value) {

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-enum-type.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -749,7 +749,14 @@
 
 
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
+
 typedef NS_ENUM(NSInteger, TestProtocolRuntimeFarmAnimals) {
     TestProtocolRuntimeFarmAnimalsPigs,
     TestProtocolRuntimeFarmAnimalsCows,
@@ -853,7 +860,36 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
+
 inline String toProtocolString(TestProtocolRuntimeFarmAnimals value)
 {
     switch(value) {

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-declaration-object-type.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -1121,9 +1121,16 @@
 @class TestProtocolDatabaseDummyObject;
 @class TestProtocolTestParameterBundle;
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
+
 __attribute__((visibility ("default")))
 @interface TestProtocolDatabaseError : RWIProtocolJSONObject
 - (instancetype)initWithPayload:(NSDictionary<NSString *, id> *)payload;
@@ -1278,10 +1285,39 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
 
 
 
+
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/type-requiring-runtime-casts.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -1078,7 +1078,14 @@
 @class TestProtocolTestRecursiveObject1;
 @class TestProtocolTestRecursiveObject2;
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
+
 typedef NS_ENUM(NSInteger, TestProtocolTestUncastedAnimals) {
     TestProtocolTestUncastedAnimalsPigs,
     TestProtocolTestUncastedAnimalsCows,
@@ -1207,7 +1214,36 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
+
 inline String toProtocolString(TestProtocolTestUncastedAnimals value)
 {
     switch(value) {

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/worker-supported-domains.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/worker-supported-domains.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/generic/expected/worker-supported-domains.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -893,10 +893,17 @@
 
 
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
 
+
 @protocol TestProtocolDomainADomainHandler <NSObject>
 @required
 - (void)enableWithErrorCallback:(void(^)(NSString *error))errorCallback successCallback:(void(^)())successCallback;
@@ -992,6 +999,35 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
+
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/ios/expected/definitions-with-mac-platform.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -646,6 +646,12 @@
 
 
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
@@ -655,6 +661,7 @@
 
 
 
+
 ### End File: TestProtocol.h
 
 ### Begin File: TestProtocolInternal.h
@@ -737,6 +744,35 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
+
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result (212115 => 212116)


--- trunk/Source/_javascript_Core/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/mac/expected/definitions-with-mac-platform.json-result	2017-02-10 17:29:36 UTC (rev 212116)
@@ -894,9 +894,16 @@
 
 @class TestProtocolNetworkError;
 
+typedef NS_ENUM(NSInteger, TestProtocolPlatform) {
+    TestProtocolPlatformAll,
+    TestProtocolPlatformGeneric,
+    TestProtocolPlatformIOS,
+    TestProtocolPlatformMacOS,
+};
 
 
 
+
 __attribute__((visibility ("default")))
 @interface TestProtocolNetworkError : RWIProtocolJSONObject
 - (instancetype)initWithPayload:(NSDictionary<NSString *, id> *)payload;
@@ -1001,8 +1008,37 @@
 template<typename ObjCEnumType>
 ObjCEnumType fromProtocolString(const String& value);
 
+inline String toProtocolString(TestProtocolPlatform value)
+{
+    switch(value) {
+    case TestProtocolPlatformAll:
+        return ASCIILiteral("all");
+    case TestProtocolPlatformGeneric:
+        return ASCIILiteral("generic");
+    case TestProtocolPlatformIOS:
+        return ASCIILiteral("ios");
+    case TestProtocolPlatformMacOS:
+        return ASCIILiteral("macos");
+    }
+}
 
+template<>
+inline TestProtocolPlatform fromProtocolString(const String& value)
+{
+    if (value == "all")
+        return TestProtocolPlatformAll;
+    if (value == "generic")
+        return TestProtocolPlatformGeneric;
+    if (value == "ios")
+        return TestProtocolPlatformIOS;
+    if (value == "macos")
+        return TestProtocolPlatformMacOS;
+    ASSERT_NOT_REACHED();
+    return TestProtocolPlatformAll;
+}
 
+
+
 } // namespace Inspector
 
 ### End File: TestProtocolTypeConversions.h

Modified: trunk/Source/WebKit2/ChangeLog (212115 => 212116)


--- trunk/Source/WebKit2/ChangeLog	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/WebKit2/ChangeLog	2017-02-10 17:29:36 UTC (rev 212116)
@@ -1,5 +1,15 @@
 2017-02-10  Brian Burg  <bb...@apple.com>
 
+        [Cocoa] Web Inspector: generate an NS_ENUM containing platforms supported by the protocol code generator
+        https://bugs.webkit.org/show_bug.cgi?id=168019
+        <rdar://problem/28718990>
+
+        Reviewed by Joseph Pecoraro.
+
+        * UIProcess/Automation/Automation.json: Fix the platform values to be lowercase.
+
+2017-02-10  Brian Burg  <bb...@apple.com>
+
         Web Automation: fail gracefully when a screenshot cannot be encoded as base64
         https://bugs.webkit.org/show_bug.cgi?id=168095
         <rdar://problem/30297427>

Modified: trunk/Source/WebKit2/UIProcess/Automation/Automation.json (212115 => 212116)


--- trunk/Source/WebKit2/UIProcess/Automation/Automation.json	2017-02-10 17:25:36 UTC (rev 212115)
+++ trunk/Source/WebKit2/UIProcess/Automation/Automation.json	2017-02-10 17:29:36 UTC (rev 212116)
@@ -248,7 +248,7 @@
         {
             "name": "resizeWindowOfBrowsingContext",
             "description": "Resizes the window of the specified browsing context to the specified size.",
-            "platform": "macOS",
+            "platform": "macos",
             "parameters": [
                 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context to be resized." },
                 { "name": "size", "$ref": "Size", "description": "The new size for the browsing context's window." }
@@ -257,7 +257,7 @@
         {
             "name": "moveWindowOfBrowsingContext",
             "description": "Moves the window of the specified browsing context to the specified position.",
-            "platform": "macOS",
+            "platform": "macos",
             "parameters": [
                 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context to be moved." },
                 { "name": "origin", "$ref": "Point", "description": "The new origin for the browsing context's window. The position is interpreted in screen coordinate space, relative to the upper left corner of the screen." }
@@ -299,7 +299,7 @@
         {
             "name": "inspectBrowsingContext",
             "description": "Inspect the specified browsing context using Web Inspector.",
-            "platform": "macOS",
+            "platform": "macos",
             "parameters": [
                 { "name": "handle", "$ref": "BrowsingContextHandle", "description": "The handle for the browsing context that should be inspected." },
                 { "name": "enableAutoCapturing", "type": "boolean", "optional": true, "description": "If this option is present and set to true, the Web Inspector will automatically start a timeline recording of the specified browsing context once it is attached. Note that this disables the debugger for the duration of the recording." }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to