Changeset 199005 in webkit


Ignore:
Timestamp:
Apr 4, 2016 7:30:35 AM (8 years ago)
Author:
commit-queue@webkit.org
Message:

REGRESSION(r198792): [GTK] Inspector crashes in Inspector::Protocol::getEnumConstantValue since r198792
https://bugs.webkit.org/show_bug.cgi?id=155745
<rdar://problem/25289456>

Patch by Carlos Garcia Campos <cgarcia@igalia.com> on 2016-04-04
Reviewed by Brian Burg.

Source/JavaScriptCore:

The problem is that we are generating the Inspector::Protocol::getEnumConstantValue() method and the
enum_constant_values array for every framework that has enum values. So, in case of GTK port we have two
implementations, one for the inspector in JavaScriptCore and another one for Web Automation in WebKit2, but when
using the inspector in WebKit2 we always end up using the one in WebKit2. Since the enum_constant_values array
is smaller in WebKit2 than the one in JavaScriptCore, we crash every time we receive an enum value higher than
the array size. We need to disambiguate the getEnumConstantValue() generated and used for every framework, so we
can use a specific namespace for the enum conversion methods.

  • inspector/agents/InspectorDebuggerAgent.cpp:

(Inspector::breakpointActionTypeForString): Use Inspector::Protocol::InspectorHelpers.

  • inspector/scripts/codegen/cpp_generator.py:

(CppGenerator.helpers_namespace): Return the namespace name that should be used for the helper methods.

  • inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:

(CppBackendDispatcherImplementationGenerator._generate_async_dispatcher_class_for_domain): Use
CppGenerator.helpers_namespace() to use the right namespace when using getEnumConstantValue().
(CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): Ditto.

  • inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:

(CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event): Ditto.

  • inspector/scripts/codegen/generate_cpp_protocol_types_header.py:

(CppProtocolTypesHeaderGenerator.generate_output): Move declaration of getEnumConstantValue to a helper function.
(_generate_enum_constant_value_conversion_methods): Do not emit any code if there aren't enums and ensure all
conversion methods are declared inside the helpers namespace.
(_generate_builder_setter_for_member): Use CppGenerator.helpers_namespace() to use the right namespace when
using getEnumConstantValue().
(_generate_unchecked_setter_for_member): Ditto.
(_generate_declarations_for_enum_conversion_methods): Return a list instead of a string so that we can return an
empty list in case of not emitting any code. The caller will use extend() that has no effect when an empty list
is passed.

  • inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:

(CppProtocolTypesImplementationGenerator.generate_output): Use the new helper function to generate both the enum
mapping and conversion methods inside the helpers namespace.
(CppProtocolTypesImplementationGenerator._generate_enum_mapping): Return a list instead of a string so that we
can return an empty list in case of not emitting any code.
(CppProtocolTypesImplementationGenerator._generate_enum_mapping_and_conversion_methods): Ensure we only emit
code when there are enum values, and it's generated inside the helpers namespace.

  • inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
  • inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
  • inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
  • inspector/scripts/tests/expected/enum-values.json-result:
  • inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
  • inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
  • inspector/scripts/tests/expected/same-type-id-different-domain.json-result:
  • inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result:
  • inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result:
  • inspector/scripts/tests/expected/type-declaration-array-type.json-result:
  • inspector/scripts/tests/expected/type-declaration-enum-type.json-result:
  • inspector/scripts/tests/expected/type-declaration-object-type.json-result:
  • inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:

Source/WebCore:

Use Inspector::Protocol::AutomationEnums namespace for getEnumConstantValue().

  • inspector/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):

  • inspector/InspectorTimelineAgent.cpp:

(WebCore::InspectorTimelineAgent::addRecordToTimeline):

Source/WebKit2:

Use Inspector::Protocol::AutomationEnums namespace for getEnumConstantValue().

  • UIProcess/Automation/WebAutomationSession.cpp:
  • WebProcess/Automation/WebAutomationSessionProxy.cpp:

(WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame):
(WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
(WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
(WebKit::WebAutomationSessionProxy::resolveParentFrame):
(WebKit::WebAutomationSessionProxy::computeElementLayout):

Location:
trunk/Source
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r198999 r199005  
     12016-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r198792): [GTK] Inspector crashes in Inspector::Protocol::getEnumConstantValue since r198792
     4        https://bugs.webkit.org/show_bug.cgi?id=155745
     5        <rdar://problem/25289456>
     6
     7        Reviewed by Brian Burg.
     8
     9        The problem is that we are generating the Inspector::Protocol::getEnumConstantValue() method and the
     10        enum_constant_values array for every framework that has enum values. So, in case of GTK port we have two
     11        implementations, one for the inspector in JavaScriptCore and another one for Web Automation in WebKit2, but when
     12        using the inspector in WebKit2 we always end up using the one in WebKit2. Since the enum_constant_values array
     13        is smaller in WebKit2 than the one in JavaScriptCore, we crash every time we receive an enum value higher than
     14        the array size. We need to disambiguate the getEnumConstantValue() generated and used for every framework, so we
     15        can use a specific namespace for the enum conversion methods.
     16
     17        * inspector/agents/InspectorDebuggerAgent.cpp:
     18        (Inspector::breakpointActionTypeForString): Use Inspector::Protocol::InspectorHelpers.
     19        * inspector/scripts/codegen/cpp_generator.py:
     20        (CppGenerator.helpers_namespace): Return the namespace name that should be used for the helper methods.
     21        * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py:
     22        (CppBackendDispatcherImplementationGenerator._generate_async_dispatcher_class_for_domain): Use
     23        CppGenerator.helpers_namespace() to use the right namespace when using getEnumConstantValue().
     24        (CppBackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): Ditto.
     25        * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py:
     26        (CppFrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event): Ditto.
     27        * inspector/scripts/codegen/generate_cpp_protocol_types_header.py:
     28        (CppProtocolTypesHeaderGenerator.generate_output): Move declaration of getEnumConstantValue to a helper function.
     29        (_generate_enum_constant_value_conversion_methods): Do not emit any code if there aren't enums and ensure all
     30        conversion methods are declared inside the helpers namespace.
     31        (_generate_builder_setter_for_member): Use CppGenerator.helpers_namespace() to use the right namespace when
     32        using getEnumConstantValue().
     33        (_generate_unchecked_setter_for_member): Ditto.
     34        (_generate_declarations_for_enum_conversion_methods): Return a list instead of a string so that we can return an
     35        empty list in case of not emitting any code. The caller will use extend() that has no effect when an empty list
     36        is passed.
     37        * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py:
     38        (CppProtocolTypesImplementationGenerator.generate_output): Use the new helper function to generate both the enum
     39        mapping and conversion methods inside the helpers namespace.
     40        (CppProtocolTypesImplementationGenerator._generate_enum_mapping): Return a list instead of a string so that we
     41        can return an empty list in case of not emitting any code.
     42        (CppProtocolTypesImplementationGenerator._generate_enum_mapping_and_conversion_methods): Ensure we only emit
     43        code when there are enum values, and it's generated inside the helpers namespace.
     44        * inspector/scripts/tests/expected/commands-with-async-attribute.json-result:
     45        * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result:
     46        * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result:
     47        * inspector/scripts/tests/expected/enum-values.json-result:
     48        * inspector/scripts/tests/expected/events-with-optional-parameters.json-result:
     49        * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result:
     50        * inspector/scripts/tests/expected/same-type-id-different-domain.json-result:
     51        * inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result:
     52        * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result:
     53        * inspector/scripts/tests/expected/type-declaration-array-type.json-result:
     54        * inspector/scripts/tests/expected/type-declaration-enum-type.json-result:
     55        * inspector/scripts/tests/expected/type-declaration-object-type.json-result:
     56        * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result:
     57
    1582016-04-04  Csaba Osztrogonác  <ossy@webkit.org>
    259
  • trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp

    r198648 r199005  
    217217static bool breakpointActionTypeForString(const String& typeString, ScriptBreakpointActionType* output)
    218218{
    219     if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Log)) {
     219    if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Log)) {
    220220        *output = ScriptBreakpointActionTypeLog;
    221221        return true;
    222222    }
    223     if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Evaluate)) {
     223    if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Evaluate)) {
    224224        *output = ScriptBreakpointActionTypeEvaluate;
    225225        return true;
    226226    }
    227     if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Sound)) {
     227    if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Sound)) {
    228228        *output = ScriptBreakpointActionTypeSound;
    229229        return true;
    230230    }
    231     if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Probe)) {
     231    if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Probe)) {
    232232        *output = ScriptBreakpointActionTypeProbe;
    233233        return true;
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/cpp_generator.py

    r198678 r199005  
    5151        return self.model().framework.setting('protocol_group', '')
    5252
     53    def helpers_namespace(self):
     54        return '%sHelpers' % self.protocol_name()
     55
    5356    # Miscellaneous text manipulation routines.
    5457    @staticmethod
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py

    r198678 r199005  
    146146                'parameterName': parameter.parameter_name,
    147147                'parameterType': CppGenerator.cpp_type_for_stack_in_parameter(parameter),
     148                'helpersNamespace': self.helpers_namespace(),
    148149            }
    149150
     
    158159                    out_parameter_assignments.append('        jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s);' % param_args)
    159160            elif parameter.type.is_enum():
    160                 out_parameter_assignments.append('    jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), Inspector::Protocol::getEnumConstantValue(%(parameterName)s));' % param_args)
     161                out_parameter_assignments.append('    jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), Inspector::Protocol::%(helpersNamespace)s::getEnumConstantValue(%(parameterName)s));' % param_args)
    161162            else:
    162163                out_parameter_assignments.append('    jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s);' % param_args)
     
    239240                    'parameterName': parameter.parameter_name,
    240241                    'keyedSetMethod': CppGenerator.cpp_setter_method_for_type(parameter.type),
    241 
     242                    'helpersNamespace': self.helpers_namespace(),
    242243                }
    243244
     
    251252                        out_parameter_assignments.append('            result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s);' % param_args)
    252253                elif parameter.type.is_enum():
    253                     out_parameter_assignments.append('        result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), Inspector::Protocol::getEnumConstantValue(out_%(parameterName)s));' % param_args)
     254                    out_parameter_assignments.append('        result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), Inspector::Protocol::%(helpersNamespace)s::getEnumConstantValue(out_%(parameterName)s));' % param_args)
    254255                else:
    255256                    out_parameter_assignments.append('        result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s);' % param_args)
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py

    r198678 r199005  
    8686                parameter_value = '*' + parameter_value
    8787            if parameter.type.is_enum():
    88                 parameter_value = 'Inspector::Protocol::getEnumConstantValue(%s)' % parameter_value
     88                parameter_value = 'Inspector::Protocol::%s::getEnumConstantValue(%s)' % (self.helpers_namespace(), parameter_value)
    8989
    9090            parameter_args = {
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_header.py

    r198752 r199005  
    5656        ])
    5757
    58         export_macro = self.model().framework.setting('export_macro', None)
    59 
    6058        header_args = {
    6159            'includes': '\n'.join(['#include ' + header for header in sorted(headers)]),
    6260            'typedefs': '',
    6361        }
    64 
    65         return_type = 'String'
    66         return_type_with_export_macro = [return_type]
    67         if export_macro is not None:
    68             return_type_with_export_macro[:0] = [export_macro]
    6962
    7063        sections = []
     
    7467        sections.append(self._generate_forward_declarations(domains))
    7568        sections.append(self._generate_typedefs(domains))
    76         sections.append('%s getEnumConstantValue(int code);' % ' '.join(return_type_with_export_macro))
    77         sections.append('\n'.join([
    78             'template<typename T> %s getEnumConstantValue(T enumValue)' % return_type,
    79             '{',
    80             '    return getEnumConstantValue(static_cast<int>(enumValue));',
    81             '}']))
    82 
     69        sections.extend(self._generate_enum_constant_value_conversion_methods())
    8370        builder_sections = map(self._generate_builders_for_domain, domains)
    8471        sections.extend(filter(lambda section: len(section) > 0, builder_sections))
    8572        sections.append(self._generate_forward_declarations_for_binding_traits())
    86         sections.append(self._generate_declarations_for_enum_conversion_methods())
     73        sections.extend(self._generate_declarations_for_enum_conversion_methods())
    8774        sections.append('} // namespace Protocol')
    8875        sections.append(Template(CppTemplates.HeaderPostlude).substitute(None, **header_args))
     
    162149        lines.append('} // %s' % domain.domain_name)
    163150        return self.wrap_with_guard_for_domain(domain, '\n'.join(lines))
     151
     152    def _generate_enum_constant_value_conversion_methods(self):
     153        if not self.assigned_enum_values():
     154            return []
     155
     156        return_type = 'String'
     157        return_type_with_export_macro = [return_type]
     158        export_macro = self.model().framework.setting('export_macro', None)
     159        if export_macro is not None:
     160            return_type_with_export_macro[:0] = [export_macro]
     161
     162        lines = []
     163        lines.append('namespace %s {' % self.helpers_namespace())
     164        lines.append('\n'.join([
     165            '%s getEnumConstantValue(int code);' % ' '.join(return_type_with_export_macro),
     166            '',
     167            'template<typename T> %s getEnumConstantValue(T enumValue)' % return_type,
     168            '{',
     169            '    return getEnumConstantValue(static_cast<int>(enumValue));',
     170            '}',
     171        ]))
     172        lines.append('} // namespace %s' % self.helpers_namespace())
     173        return lines
    164174
    165175    def _generate_builders_for_domain(self, domain):
     
    282292            'keyedSet': CppGenerator.cpp_setter_method_for_type(type_member.type),
    283293            'name': type_member.member_name,
    284             'parameterType': CppGenerator.cpp_type_for_type_member(type_member)
     294            'parameterType': CppGenerator.cpp_type_for_type_member(type_member),
     295            'helpersNamespace': self.helpers_namespace(),
    285296        }
    286297
     
    292303
    293304        if isinstance(type_member.type, EnumType):
    294             lines.append('            m_result->%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));' % setter_args)
     305            lines.append('            m_result->%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::%(helpersNamespace)s::getEnumConstantValue(value));' % setter_args)
    295306        else:
    296307            lines.append('            m_result->%(keyedSet)s(ASCIILiteral("%(name)s"), value);' % setter_args)
     
    304315            'keyedSet': CppGenerator.cpp_setter_method_for_type(type_member.type),
    305316            'name': type_member.member_name,
    306             'parameterType': CppGenerator.cpp_type_for_type_member(type_member)
     317            'parameterType': CppGenerator.cpp_type_for_type_member(type_member),
     318            'helpersNamespace': self.helpers_namespace(),
    307319        }
    308320
     
    312324        lines.append('    {')
    313325        if isinstance(type_member.type, EnumType):
    314             lines.append('        InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));' % setter_args)
     326            lines.append('        InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::%(helpersNamespace)s::getEnumConstantValue(value));' % setter_args)
    315327        elif CppGenerator.should_use_references_for_type(type_member.type):
    316328            lines.append('        InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), WTFMove(value));' % setter_args)
     
    356368        sections = []
    357369        sections.append('\n'.join([
     370            'namespace %s {' % self.helpers_namespace(),
     371            '',
    358372            'template<typename ProtocolEnumType>',
    359373            'Optional<ProtocolEnumType> parseEnumValueFromString(const String&);',
     
    363377            enum_return_type = 'Optional<%s>' % cpp_protocol_type
    364378            result_terms = [enum_return_type]
     379            export_macro = self.model().framework.setting('export_macro', None)
    365380            if export_macro is not None:
    366381                result_terms[:0] = [export_macro]
     
    382397            domain_lines = []
    383398            domain_lines.append("// Enums in the '%s' Domain" % domain.domain_name)
    384             export_macro = self.model().framework.setting('export_macro', None)
    385399            for enum_type in enum_types:
    386400                cpp_protocol_type = CppGenerator.cpp_protocol_type_for_type(enum_type)
     
    399413            sections.append(self.wrap_with_guard_for_domain(domain, '\n'.join(domain_lines)))
    400414
    401         return '\n\n'.join(sections)
     415        if len(sections) == 1:
     416            return [] # No real sections to emit, just the namespace and template declaration. Skip.
     417
     418        sections.append('} // namespace %s' % self.helpers_namespace())
     419
     420        return ['\n\n'.join(sections)]
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py

    r198752 r199005  
    6464        sections.append(Template(CppTemplates.ImplementationPrelude).substitute(None, **header_args))
    6565        sections.append('namespace Protocol {')
    66         sections.append(self._generate_enum_mapping())
    67         enum_parser_sections = map(self._generate_enum_conversion_methods_for_domain, domains)
    68         sections.extend(filter(lambda section: len(section) > 0, enum_parser_sections))
     66        sections.extend(self._generate_enum_mapping_and_conversion_methods(domains))
    6967        sections.append(self._generate_open_field_names())
    7068        builder_sections = map(self._generate_builders_for_domain, domains)
     
    7876
    7977    def _generate_enum_mapping(self):
     78        if not self.assigned_enum_values():
     79            return []
     80
    8081        lines = []
    8182        lines.append('static const char* const enum_constant_values[] = {')
     
    8687        lines.append('    return enum_constant_values[code];')
    8788        lines.append('}')
    88         return '\n'.join(lines)
     89        return ['\n'.join(lines)]
    8990
    9091    def _generate_enum_conversion_methods_for_domain(self, domain):
     
    142143
    143144        return self.wrap_with_guard_for_domain(domain, '\n'.join(lines))
     145
     146    def _generate_enum_mapping_and_conversion_methods(self, domains):
     147        sections = []
     148        sections.append('namespace %s {' % self.helpers_namespace())
     149        sections.extend(self._generate_enum_mapping())
     150        enum_parser_sections = map(self._generate_enum_conversion_methods_for_domain, domains)
     151        sections.extend(filter(lambda section: len(section) > 0, enum_parser_sections))
     152        if len(sections) == 1:
     153            return []  # No declarations to emit, just the namespace.
     154
     155        sections.append('} // namespace %s' % self.helpers_namespace())
     156        return sections
    144157
    145158    def _generate_open_field_names(self):
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-async-attribute.json-result

    r198752 r199005  
    430430        result->setObject(ASCIILiteral("sqlError"), out_sqlError);
    431431        result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
    432         result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(out_screenColor));
    433         result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(out_printColor));
     432        result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_screenColor));
     433        result->setString(ASCIILiteral("printColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_printColor));
    434434    }
    435435    if (!error.length())
     
    451451    jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId);
    452452    jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError);
    453     jsonMessage->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(screenColor));
     453    jsonMessage->setString(ASCIILiteral("screenColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(screenColor));
    454454    jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors);
    455     jsonMessage->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(printColor));
     455    jsonMessage->setString(ASCIILiteral("printColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(printColor));
    456456    CallbackBase::sendSuccess(WTFMove(jsonMessage));
    457457}
     
    634634// End of typedefs.
    635635
     636namespace TestHelpers {
     637
    636638String getEnumConstantValue(int code);
    637639
     
    640642    return getEnumConstantValue(static_cast<int>(enumValue));
    641643}
     644
     645} // namespace TestHelpers
    642646
    643647namespace Database {
     
    717721
    718722
     723namespace TestHelpers {
     724
    719725template<typename ProtocolEnumType>
    720726Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
     
    723729template<>
    724730Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String&);
     731
     732} // namespace TestHelpers
    725733
    726734} // namespace Protocol
     
    770778namespace Protocol {
    771779
     780namespace TestHelpers {
     781
    772782static const char* const enum_constant_values[] = {
    773783    "red",
     
    800810}
    801811
     812
     813} // namespace TestHelpers
    802814
    803815
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result

    r198752 r199005  
    376376        result->setInteger(ASCIILiteral("databaseId"), out_databaseId);
    377377        result->setObject(ASCIILiteral("sqlError"), out_sqlError);
    378         result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(out_screenColor));
     378        result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_screenColor));
    379379        result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
    380         result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(out_printColor));
     380        result->setString(ASCIILiteral("printColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_printColor));
    381381    }
    382382    if (!error.length())
     
    535535// End of typedefs.
    536536
     537namespace TestHelpers {
     538
    537539String getEnumConstantValue(int code);
    538540
     
    541543    return getEnumConstantValue(static_cast<int>(enumValue));
    542544}
     545
     546} // namespace TestHelpers
    543547
    544548namespace Database {
     
    618622
    619623
     624namespace TestHelpers {
     625
    620626template<typename ProtocolEnumType>
    621627Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
     
    625631Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String&);
    626632
     633} // namespace TestHelpers
     634
    627635} // namespace Protocol
    628636
     
    670678
    671679namespace Protocol {
     680
     681namespace TestHelpers {
    672682
    673683static const char* const enum_constant_values[] = {
     
    701711}
    702712
     713
     714} // namespace TestHelpers
    703715
    704716
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result

    r198752 r199005  
    642642// End of typedefs.
    643643
    644 String getEnumConstantValue(int code);
    645 
    646 template<typename T> String getEnumConstantValue(T enumValue)
    647 {
    648     return getEnumConstantValue(static_cast<int>(enumValue));
    649 }
    650 
    651 
    652 
    653 template<typename ProtocolEnumType>
    654 Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
     644
    655645
    656646} // namespace Protocol
     
    699689
    700690namespace Protocol {
    701 
    702 static const char* const enum_constant_values[] = {
    703 };
    704 
    705 String getEnumConstantValue(int code) {
    706     return enum_constant_values[code];
    707 }
    708691
    709692
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/enum-values.json-result

    r198752 r199005  
    271271
    272272    if (!error.length())
    273         result->setString(ASCIILiteral("returnValue"), Inspector::Protocol::getEnumConstantValue(out_returnValue));
     273        result->setString(ASCIILiteral("returnValue"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_returnValue));
    274274
    275275    if (!error.length())
     
    385385    jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("EventDomain.eventWithEnumParameter"));
    386386    Ref<InspectorObject> paramsObject = InspectorObject::create();
    387     paramsObject->setString(ASCIILiteral("parameter"), Inspector::Protocol::getEnumConstantValue(parameter));
     387    paramsObject->setString(ASCIILiteral("parameter"), Inspector::Protocol::TestHelpers::getEnumConstantValue(parameter));
    388388    jsonMessage->setObject(ASCIILiteral("params"), WTFMove(paramsObject));
    389389
     
    446446
    447447
     448namespace TestHelpers {
     449
    448450String getEnumConstantValue(int code);
    449451
     
    452454    return getEnumConstantValue(static_cast<int>(enumValue));
    453455}
     456
     457} // namespace TestHelpers
    454458
    455459namespace TypeDomain {
     
    465469
    466470
     471namespace TestHelpers {
     472
    467473template<typename ProtocolEnumType>
    468474Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
     
    472478Optional<Inspector::Protocol::TypeDomain::TypeDomainEnum> parseEnumValueFromString<Inspector::Protocol::TypeDomain::TypeDomainEnum>(const String&);
    473479
     480} // namespace TestHelpers
     481
    474482} // namespace Protocol
    475483
     
    517525
    518526namespace Protocol {
     527
     528namespace TestHelpers {
    519529
    520530static const char* const enum_constant_values[] = {
     
    552562
    553563
     564} // namespace TestHelpers
     565
    554566
    555567
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/events-with-optional-parameters.json-result

    r198752 r199005  
    392392// End of typedefs.
    393393
    394 String getEnumConstantValue(int code);
    395 
    396 template<typename T> String getEnumConstantValue(T enumValue)
    397 {
    398     return getEnumConstantValue(static_cast<int>(enumValue));
    399 }
    400 
    401394namespace Database {
    402395/* Database error. */
     
    469462
    470463
    471 template<typename ProtocolEnumType>
    472 Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
    473 
    474464} // namespace Protocol
    475465
     
    517507
    518508namespace Protocol {
    519 
    520 static const char* const enum_constant_values[] = {
    521 };
    522 
    523 String getEnumConstantValue(int code) {
    524     return enum_constant_values[code];
    525 }
    526509
    527510
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result

    r198752 r199005  
    440440
    441441
    442 String getEnumConstantValue(int code);
    443 
    444 template<typename T> String getEnumConstantValue(T enumValue)
    445 {
    446     return getEnumConstantValue(static_cast<int>(enumValue));
    447 }
    448 
    449442#if PLATFORM(WEB_TYPES)
    450443namespace Network2 {
     
    518511
    519512
    520 template<typename ProtocolEnumType>
    521 Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
    522 
    523513} // namespace Protocol
    524514
     
    566556
    567557namespace Protocol {
    568 
    569 static const char* const enum_constant_values[] = {
    570 };
    571 
    572 String getEnumConstantValue(int code) {
    573     return enum_constant_values[code];
    574 }
    575558
    576559
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/same-type-id-different-domain.json-result

    r198752 r199005  
    328328// End of typedefs.
    329329
    330 String getEnumConstantValue(int code);
    331 
    332 template<typename T> String getEnumConstantValue(T enumValue)
    333 {
    334     return getEnumConstantValue(static_cast<int>(enumValue));
    335 }
    336 
    337 
    338 
    339 template<typename ProtocolEnumType>
    340 Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
     330
    341331
    342332} // namespace Protocol
     
    385375
    386376namespace Protocol {
    387 
    388 static const char* const enum_constant_values[] = {
    389 };
    390 
    391 String getEnumConstantValue(int code) {
    392     return enum_constant_values[code];
    393 }
    394377
    395378
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result

    r198752 r199005  
    323323
    324324
     325namespace TestHelpers {
     326
    325327String getEnumConstantValue(int code);
    326328
     
    329331    return getEnumConstantValue(static_cast<int>(enumValue));
    330332}
     333
     334} // namespace TestHelpers
    331335
    332336namespace Runtime {
     
    367371        {
    368372            COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
    369             m_result->setString(ASCIILiteral("type"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));
     373            m_result->setString(ASCIILiteral("type"), Inspector::Protocol::TestHelpers::getEnumConstantValue(value));
    370374            return castState<TypeSet>();
    371375        }
     
    407411
    408412
     413namespace TestHelpers {
     414
    409415template<typename ProtocolEnumType>
    410416Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
     
    414420Optional<Inspector::Protocol::Runtime::KeyPath::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::KeyPath::Type>(const String&);
    415421
     422} // namespace TestHelpers
     423
    416424} // namespace Protocol
    417425
     
    459467
    460468namespace Protocol {
     469
     470namespace TestHelpers {
    461471
    462472static const char* const enum_constant_values[] = {
     
    486496}
    487497
     498
     499} // namespace TestHelpers
    488500
    489501
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result

    r198752 r199005  
    323323// End of typedefs.
    324324
    325 String getEnumConstantValue(int code);
    326 
    327 template<typename T> String getEnumConstantValue(T enumValue)
    328 {
    329     return getEnumConstantValue(static_cast<int>(enumValue));
    330 }
    331 
    332 
    333 
    334 template<typename ProtocolEnumType>
    335 Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
     325
    336326
    337327} // namespace Protocol
     
    380370
    381371namespace Protocol {
    382 
    383 static const char* const enum_constant_values[] = {
    384 };
    385 
    386 String getEnumConstantValue(int code) {
    387     return enum_constant_values[code];
    388 }
    389372
    390373
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-array-type.json-result

    r198752 r199005  
    339339// End of typedefs.
    340340
     341namespace TestHelpers {
     342
    341343String getEnumConstantValue(int code);
    342344
     
    345347    return getEnumConstantValue(static_cast<int>(enumValue));
    346348}
     349
     350} // namespace TestHelpers
    347351
    348352namespace Debugger {
     
    357361
    358362
     363namespace TestHelpers {
     364
    359365template<typename ProtocolEnumType>
    360366Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
     
    364370Optional<Inspector::Protocol::Debugger::Reason> parseEnumValueFromString<Inspector::Protocol::Debugger::Reason>(const String&);
    365371
     372} // namespace TestHelpers
     373
    366374} // namespace Protocol
    367375
     
    409417
    410418namespace Protocol {
     419
     420namespace TestHelpers {
    411421
    412422static const char* const enum_constant_values[] = {
     
    437447
    438448
     449} // namespace TestHelpers
     450
    439451
    440452
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-enum-type.json-result

    r198752 r199005  
    328328
    329329
     330namespace TestHelpers {
     331
    330332String getEnumConstantValue(int code);
    331333
     
    334336    return getEnumConstantValue(static_cast<int>(enumValue));
    335337}
     338
     339} // namespace TestHelpers
    336340
    337341namespace Runtime {
     
    354358
    355359
     360namespace TestHelpers {
     361
    356362template<typename ProtocolEnumType>
    357363Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
     
    363369Optional<Inspector::Protocol::Runtime::TwoLeggedAnimals> parseEnumValueFromString<Inspector::Protocol::Runtime::TwoLeggedAnimals>(const String&);
    364370
     371} // namespace TestHelpers
     372
    365373} // namespace Protocol
    366374
     
    408416
    409417namespace Protocol {
     418
     419namespace TestHelpers {
    410420
    411421static const char* const enum_constant_values[] = {
     
    456466}
    457467
     468
     469} // namespace TestHelpers
    458470
    459471
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/type-declaration-object-type.json-result

    r198752 r199005  
    334334} // Database
    335335// End of typedefs.
    336 
    337 String getEnumConstantValue(int code);
    338 
    339 template<typename T> String getEnumConstantValue(T enumValue)
    340 {
    341     return getEnumConstantValue(static_cast<int>(enumValue));
    342 }
    343336
    344337namespace Database {
     
    797790
    798791
    799 template<typename ProtocolEnumType>
    800 Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
    801 
    802792} // namespace Protocol
    803793
     
    845835
    846836namespace Protocol {
    847 
    848 static const char* const enum_constant_values[] = {
    849 };
    850 
    851 String getEnumConstantValue(int code) {
    852     return enum_constant_values[code];
    853 }
    854837
    855838
  • trunk/Source/JavaScriptCore/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result

    r198752 r199005  
    336336// End of typedefs.
    337337
     338namespace TestHelpers {
     339
    338340String getEnumConstantValue(int code);
    339341
     
    342344    return getEnumConstantValue(static_cast<int>(enumValue));
    343345}
     346
     347} // namespace TestHelpers
    344348
    345349namespace Test {
     
    392396        {
    393397            COMPILE_ASSERT(!(STATE & AnimalsSet), property_animals_already_set);
    394             m_result->setString(ASCIILiteral("animals"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));
     398            m_result->setString(ASCIILiteral("animals"), Inspector::Protocol::TestHelpers::getEnumConstantValue(value));
    395399            return castState<AnimalsSet>();
    396400        }
     
    576580};
    577581
     582namespace TestHelpers {
     583
    578584template<typename ProtocolEnumType>
    579585Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
     
    585591Optional<Inspector::Protocol::Test::CastedAnimals> parseEnumValueFromString<Inspector::Protocol::Test::CastedAnimals>(const String&);
    586592
     593} // namespace TestHelpers
     594
    587595} // namespace Protocol
    588596
     
    630638
    631639namespace Protocol {
     640
     641namespace TestHelpers {
    632642
    633643static const char* const enum_constant_values[] = {
     
    678688}
    679689
     690
     691} // namespace TestHelpers
    680692
    681693
  • trunk/Source/WebCore/ChangeLog

    r199004 r199005  
     12016-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r198792): [GTK] Inspector crashes in Inspector::Protocol::getEnumConstantValue since r198792
     4        https://bugs.webkit.org/show_bug.cgi?id=155745
     5        <rdar://problem/25289456>
     6
     7        Reviewed by Brian Burg.
     8
     9        Use Inspector::Protocol::AutomationEnums namespace for getEnumConstantValue().
     10
     11        * inspector/InspectorDOMAgent.cpp:
     12        (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
     13        * inspector/InspectorTimelineAgent.cpp:
     14        (WebCore::InspectorTimelineAgent::addRecordToTimeline):
     15
    1162016-04-04  Antti Koivisto  <antti@apple.com>
    217
  • trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp

    r198254 r199005  
    16701670                if (!ariaRelevantAttrValue.isEmpty()) {
    16711671                    // FIXME: Pass enum values rather than strings once unblocked. http://webkit.org/b/133711
    1672                     String ariaRelevantAdditions = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Additions);
    1673                     String ariaRelevantRemovals = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Removals);
    1674                     String ariaRelevantText = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Text);
     1672                    String ariaRelevantAdditions = Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Additions);
     1673                    String ariaRelevantRemovals = Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Removals);
     1674                    String ariaRelevantText = Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Text);
    16751675                    liveRegionRelevant = Inspector::Protocol::Array<String>::create();
    16761676                    const SpaceSplitString& values = SpaceSplitString(ariaRelevantAttrValue, true);
  • trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp

    r198850 r199005  
    478478{
    479479    ASSERT_ARG(record, record);
    480     record->setString("type", Inspector::Protocol::getEnumConstantValue(toProtocol(type)));
     480    record->setString("type", Inspector::Protocol::InspectorHelpers::getEnumConstantValue(toProtocol(type)));
    481481
    482482    if (m_recordStack.isEmpty()) {
  • trunk/Source/WebKit2/ChangeLog

    r199002 r199005  
     12016-04-04  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        REGRESSION(r198792): [GTK] Inspector crashes in Inspector::Protocol::getEnumConstantValue since r198792
     4        https://bugs.webkit.org/show_bug.cgi?id=155745
     5        <rdar://problem/25289456>
     6
     7        Reviewed by Brian Burg.
     8
     9        Use Inspector::Protocol::AutomationEnums namespace for getEnumConstantValue().
     10
     11        * UIProcess/Automation/WebAutomationSession.cpp:
     12        * WebProcess/Automation/WebAutomationSessionProxy.cpp:
     13        (WebKit::WebAutomationSessionProxy::didClearWindowObjectForFrame):
     14        (WebKit::WebAutomationSessionProxy::evaluateJavaScriptFunction):
     15        (WebKit::WebAutomationSessionProxy::resolveChildFrameWithOrdinal):
     16        (WebKit::WebAutomationSessionProxy::resolveChildFrameWithNodeHandle):
     17        (WebKit::WebAutomationSessionProxy::resolveChildFrameWithName):
     18        (WebKit::WebAutomationSessionProxy::resolveParentFrame):
     19        (WebKit::WebAutomationSessionProxy::computeElementLayout):
     20
    1212016-04-04  Emanuele Aina  <emanuele.aina@collabora.com>
    222
  • trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp

    r198918 r199005  
    4444do { \
    4545    auto enumValue = Inspector::Protocol::Automation::ErrorMessage::messageName; \
    46     errorString = Inspector::Protocol::getEnumConstantValue(enumValue); \
     46    errorString = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(enumValue); \
    4747    return; \
    4848} while (false)
     
    365365
    366366    if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page->pageID()))
    367         callback->sendFailure(Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
     367        callback->sendFailure(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
    368368    m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
    369369
     
    378378
    379379    if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page->pageID()))
    380         callback->sendFailure(Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
     380        callback->sendFailure(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
    381381    m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
    382382
     
    391391
    392392    if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page->pageID()))
    393         callback->sendFailure(Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
     393        callback->sendFailure(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
    394394    m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
    395395
     
    404404
    405405    if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page->pageID()))
    406         callback->sendFailure(Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
     406        callback->sendFailure(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
    407407    m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
    408408
     
    704704    WebCore::IntPoint viewPosition = WebCore::IntPoint(static_cast<int>(x), static_cast<int>(y));
    705705
    706     auto parsedInteraction = Inspector::Protocol::parseEnumValueFromString<Inspector::Protocol::Automation::MouseInteraction>(mouseInteractionString);
     706    auto parsedInteraction = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseInteraction>(mouseInteractionString);
    707707    if (!parsedInteraction)
    708708        FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
    709709
    710     auto parsedButton = Inspector::Protocol::parseEnumValueFromString<Inspector::Protocol::Automation::MouseButton>(mouseButtonString);
     710    auto parsedButton = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseButton>(mouseButtonString);
    711711    if (!parsedButton)
    712712        FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
     
    718718            FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
    719719
    720         auto parsedModifier = Inspector::Protocol::parseEnumValueFromString<Inspector::Protocol::Automation::KeyModifier>(modifierString);
     720        auto parsedModifier = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::KeyModifier>(modifierString);
    721721        if (!parsedModifier)
    722722            FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
     
    758758        if (!interactionObject->getString(ASCIILiteral("type"), interactionTypeString))
    759759            FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
    760         auto interactionType = Inspector::Protocol::parseEnumValueFromString<Inspector::Protocol::Automation::KeyboardInteractionType>(interactionTypeString);
     760        auto interactionType = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::KeyboardInteractionType>(interactionTypeString);
    761761        if (!interactionType)
    762762            FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
     
    765765        bool foundVirtualKey = interactionObject->getString(ASCIILiteral("key"), virtualKeyString);
    766766        if (foundVirtualKey) {
    767             auto virtualKey = Inspector::Protocol::parseEnumValueFromString<Inspector::Protocol::Automation::VirtualKey>(virtualKeyString);
     767            auto virtualKey = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::VirtualKey>(virtualKeyString);
    768768            if (!virtualKey)
    769769                FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
     
    827827    String base64EncodedData = platformGetBase64EncodedPNGData(imageDataHandle);
    828828    if (base64EncodedData.isEmpty()) {
    829         callback->sendFailure(Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::InternalError));
     829        callback->sendFailure(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::InternalError));
    830830        return;
    831831    }
  • trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp

    r198913 r199005  
    145145    if (resultIsErrorName) {
    146146        if (result->string() == "JavaScriptTimeout") {
    147             String errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::JavaScriptTimeout);
     147            String errorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::JavaScriptTimeout);
    148148            automationSessionProxy->didEvaluateJavaScriptFunction(frameID, callbackID, String(), errorType);
    149149        } else {
    150150            ASSERT_NOT_REACHED();
    151             String errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::InternalError);
     151            String errorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::InternalError);
    152152            automationSessionProxy->didEvaluateJavaScriptFunction(frameID, callbackID, String(), errorType);
    153153        }
     
    219219
    220220    String errorMessage = ASCIILiteral("Callback was not called before the unload event.");
    221     String errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::JavaScriptError);
     221    String errorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::JavaScriptError);
    222222
    223223    auto pendingFrameCallbacks = m_webFramePendingEvaluateJavaScriptCallbacksMap.take(frameID);
     
    259259        return;
    260260
    261     String errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::JavaScriptError);
     261    String errorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::JavaScriptError);
    262262
    263263    JSRetainPtr<JSStringRef> exceptionMessage;
     
    266266        JSRetainPtr<JSStringRef> exceptionName(Adopt, JSValueToStringCopy(context, nameValue, nullptr));
    267267        if (exceptionName->string() == "NodeNotFound")
    268             errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::NodeNotFound);
     268            errorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::NodeNotFound);
    269269
    270270        JSValueRef messageValue = JSObjectGetProperty(context, const_cast<JSObjectRef>(exception), toJSString(ASCIILiteral("message")).get(), nullptr);
     
    291291void WebAutomationSessionProxy::resolveChildFrameWithOrdinal(uint64_t frameID, uint32_t ordinal, uint64_t callbackID)
    292292{
    293     String frameNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
     293    String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
    294294
    295295    WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     
    322322void WebAutomationSessionProxy::resolveChildFrameWithNodeHandle(uint64_t frameID, const String& nodeHandle, uint64_t callbackID)
    323323{
    324     String frameNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
     324    String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
    325325
    326326    WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     
    353353void WebAutomationSessionProxy::resolveChildFrameWithName(uint64_t frameID, const String& name, uint64_t callbackID)
    354354{
    355     String frameNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
     355    String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
    356356
    357357    WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     
    384384void WebAutomationSessionProxy::resolveParentFrame(uint64_t frameID, uint64_t callbackID)
    385385{
    386     String frameNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
     386    String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
    387387
    388388    WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     
    424424void WebAutomationSessionProxy::computeElementLayout(uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, bool useViewportCoordinates, uint64_t callbackID)
    425425{
    426     String frameNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
    427     String nodeNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::NodeNotFound);
     426    String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
     427    String nodeNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::NodeNotFound);
    428428
    429429    WebFrame* frame = WebProcess::singleton().webFrame(frameID);
     
    466466{
    467467    ShareableBitmap::Handle handle;
    468     String windowNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound);
     468    String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound);
    469469
    470470    WebPage* page = WebProcess::singleton().webPage(pageID);
Note: See TracChangeset for help on using the changeset viewer.