Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (199004 => 199005)
--- trunk/Source/_javascript_Core/ChangeLog 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-04-04 14:30:35 UTC (rev 199005)
@@ -1,3 +1,60 @@
+2016-04-04 Carlos Garcia Campos <[email protected]>
+
+ REGRESSION(r198792): [GTK] Inspector crashes in Inspector::Protocol::getEnumConstantValue since r198792
+ https://bugs.webkit.org/show_bug.cgi?id=155745
+ <rdar://problem/25289456>
+
+ Reviewed by Brian Burg.
+
+ 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 _javascript_Core 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 _javascript_Core, 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:
+
2016-04-04 Csaba Osztrogonác <[email protected]>
Unreviewed ARM buildfix after r198981.
Modified: trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/agents/InspectorDebuggerAgent.cpp 2016-04-04 14:30:35 UTC (rev 199005)
@@ -216,19 +216,19 @@
static bool breakpointActionTypeForString(const String& typeString, ScriptBreakpointActionType* output)
{
- if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Log)) {
+ if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Log)) {
*output = ScriptBreakpointActionTypeLog;
return true;
}
- if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Evaluate)) {
+ if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Evaluate)) {
*output = ScriptBreakpointActionTypeEvaluate;
return true;
}
- if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Sound)) {
+ if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Sound)) {
*output = ScriptBreakpointActionTypeSound;
return true;
}
- if (typeString == Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Probe)) {
+ if (typeString == Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::Debugger::BreakpointAction::Type::Probe)) {
*output = ScriptBreakpointActionTypeProbe;
return true;
}
Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/cpp_generator.py (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/codegen/cpp_generator.py 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/cpp_generator.py 2016-04-04 14:30:35 UTC (rev 199005)
@@ -50,6 +50,9 @@
def protocol_name(self):
return self.model().framework.setting('protocol_group', '')
+ def helpers_namespace(self):
+ return '%sHelpers' % self.protocol_name()
+
# Miscellaneous text manipulation routines.
@staticmethod
def cpp_getter_method_for_type(_type):
Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py 2016-04-04 14:30:35 UTC (rev 199005)
@@ -145,6 +145,7 @@
'parameterKey': parameter.parameter_name,
'parameterName': parameter.parameter_name,
'parameterType': CppGenerator.cpp_type_for_stack_in_parameter(parameter),
+ 'helpersNamespace': self.helpers_namespace(),
}
formal_parameters.append('%s %s' % (CppGenerator.cpp_type_for_formal_async_parameter(parameter), parameter.parameter_name))
@@ -157,7 +158,7 @@
out_parameter_assignments.append(' if (%(parameterName)s)' % param_args)
out_parameter_assignments.append(' jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s);' % param_args)
elif parameter.type.is_enum():
- out_parameter_assignments.append(' jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), Inspector::Protocol::getEnumConstantValue(%(parameterName)s));' % param_args)
+ out_parameter_assignments.append(' jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), Inspector::Protocol::%(helpersNamespace)s::getEnumConstantValue(%(parameterName)s));' % param_args)
else:
out_parameter_assignments.append(' jsonMessage->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), %(parameterName)s);' % param_args)
@@ -238,7 +239,7 @@
'parameterKey': parameter.parameter_name,
'parameterName': parameter.parameter_name,
'keyedSetMethod': CppGenerator.cpp_setter_method_for_type(parameter.type),
-
+ 'helpersNamespace': self.helpers_namespace(),
}
out_parameter_declarations.append(' %(parameterType)s out_%(parameterName)s;' % param_args)
@@ -250,7 +251,7 @@
out_parameter_assignments.append(' if (out_%(parameterName)s)' % param_args)
out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s);' % param_args)
elif parameter.type.is_enum():
- out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), Inspector::Protocol::getEnumConstantValue(out_%(parameterName)s));' % param_args)
+ out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), Inspector::Protocol::%(helpersNamespace)s::getEnumConstantValue(out_%(parameterName)s));' % param_args)
else:
out_parameter_assignments.append(' result->%(keyedSetMethod)s(ASCIILiteral("%(parameterKey)s"), out_%(parameterName)s);' % param_args)
Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py 2016-04-04 14:30:35 UTC (rev 199005)
@@ -85,7 +85,7 @@
if parameter.is_optional and not CppGenerator.should_pass_by_copy_for_return_type(parameter.type):
parameter_value = '*' + parameter_value
if parameter.type.is_enum():
- parameter_value = 'Inspector::Protocol::getEnumConstantValue(%s)' % parameter_value
+ parameter_value = 'Inspector::Protocol::%s::getEnumConstantValue(%s)' % (self.helpers_namespace(), parameter_value)
parameter_args = {
'parameterType': CppGenerator.cpp_type_for_stack_out_parameter(parameter),
Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_protocol_types_header.py (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_protocol_types_header.py 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_protocol_types_header.py 2016-04-04 14:30:35 UTC (rev 199005)
@@ -55,35 +55,22 @@
'<wtf/Assertions.h>',
])
- export_macro = self.model().framework.setting('export_macro', None)
-
header_args = {
'includes': '\n'.join(['#include ' + header for header in sorted(headers)]),
'typedefs': '',
}
- return_type = 'String'
- return_type_with_export_macro = [return_type]
- if export_macro is not None:
- return_type_with_export_macro[:0] = [export_macro]
-
sections = []
sections.append(self.generate_license())
sections.append(Template(CppTemplates.HeaderPrelude).substitute(None, **header_args))
sections.append('namespace Protocol {')
sections.append(self._generate_forward_declarations(domains))
sections.append(self._generate_typedefs(domains))
- sections.append('%s getEnumConstantValue(int code);' % ' '.join(return_type_with_export_macro))
- sections.append('\n'.join([
- 'template<typename T> %s getEnumConstantValue(T enumValue)' % return_type,
- '{',
- ' return getEnumConstantValue(static_cast<int>(enumValue));',
- '}']))
-
+ sections.extend(self._generate_enum_constant_value_conversion_methods())
builder_sections = map(self._generate_builders_for_domain, domains)
sections.extend(filter(lambda section: len(section) > 0, builder_sections))
sections.append(self._generate_forward_declarations_for_binding_traits())
- sections.append(self._generate_declarations_for_enum_conversion_methods())
+ sections.extend(self._generate_declarations_for_enum_conversion_methods())
sections.append('} // namespace Protocol')
sections.append(Template(CppTemplates.HeaderPostlude).substitute(None, **header_args))
return "\n\n".join(sections)
@@ -162,6 +149,29 @@
lines.append('} // %s' % domain.domain_name)
return self.wrap_with_guard_for_domain(domain, '\n'.join(lines))
+ def _generate_enum_constant_value_conversion_methods(self):
+ if not self.assigned_enum_values():
+ return []
+
+ return_type = 'String'
+ return_type_with_export_macro = [return_type]
+ export_macro = self.model().framework.setting('export_macro', None)
+ if export_macro is not None:
+ return_type_with_export_macro[:0] = [export_macro]
+
+ lines = []
+ lines.append('namespace %s {' % self.helpers_namespace())
+ lines.append('\n'.join([
+ '%s getEnumConstantValue(int code);' % ' '.join(return_type_with_export_macro),
+ '',
+ 'template<typename T> %s getEnumConstantValue(T enumValue)' % return_type,
+ '{',
+ ' return getEnumConstantValue(static_cast<int>(enumValue));',
+ '}',
+ ]))
+ lines.append('} // namespace %s' % self.helpers_namespace())
+ return lines
+
def _generate_builders_for_domain(self, domain):
sections = []
@@ -281,7 +291,8 @@
'camelName': ucfirst(type_member.member_name),
'keyedSet': CppGenerator.cpp_setter_method_for_type(type_member.type),
'name': type_member.member_name,
- 'parameterType': CppGenerator.cpp_type_for_type_member(type_member)
+ 'parameterType': CppGenerator.cpp_type_for_type_member(type_member),
+ 'helpersNamespace': self.helpers_namespace(),
}
lines = []
@@ -291,7 +302,7 @@
lines.append(' COMPILE_ASSERT(!(STATE & %(camelName)sSet), property_%(name)s_already_set);' % setter_args)
if isinstance(type_member.type, EnumType):
- lines.append(' m_result->%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));' % setter_args)
+ lines.append(' m_result->%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::%(helpersNamespace)s::getEnumConstantValue(value));' % setter_args)
else:
lines.append(' m_result->%(keyedSet)s(ASCIILiteral("%(name)s"), value);' % setter_args)
lines.append(' return castState<%(camelName)sSet>();' % setter_args)
@@ -303,7 +314,8 @@
'camelName': ucfirst(type_member.member_name),
'keyedSet': CppGenerator.cpp_setter_method_for_type(type_member.type),
'name': type_member.member_name,
- 'parameterType': CppGenerator.cpp_type_for_type_member(type_member)
+ 'parameterType': CppGenerator.cpp_type_for_type_member(type_member),
+ 'helpersNamespace': self.helpers_namespace(),
}
lines = []
@@ -311,7 +323,7 @@
lines.append(' void set%(camelName)s(%(parameterType)s value)' % setter_args)
lines.append(' {')
if isinstance(type_member.type, EnumType):
- lines.append(' InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));' % setter_args)
+ lines.append(' InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), Inspector::Protocol::%(helpersNamespace)s::getEnumConstantValue(value));' % setter_args)
elif CppGenerator.should_use_references_for_type(type_member.type):
lines.append(' InspectorObjectBase::%(keyedSet)s(ASCIILiteral("%(name)s"), WTFMove(value));' % setter_args)
else:
@@ -355,6 +367,8 @@
def _generate_declarations_for_enum_conversion_methods(self):
sections = []
sections.append('\n'.join([
+ 'namespace %s {' % self.helpers_namespace(),
+ '',
'template<typename ProtocolEnumType>',
'Optional<ProtocolEnumType> parseEnumValueFromString(const String&);',
]))
@@ -362,6 +376,7 @@
def return_type_with_export_macro(cpp_protocol_type):
enum_return_type = 'Optional<%s>' % cpp_protocol_type
result_terms = [enum_return_type]
+ export_macro = self.model().framework.setting('export_macro', None)
if export_macro is not None:
result_terms[:0] = [export_macro]
return ' '.join(result_terms)
@@ -381,7 +396,6 @@
domain_lines = []
domain_lines.append("// Enums in the '%s' Domain" % domain.domain_name)
- export_macro = self.model().framework.setting('export_macro', None)
for enum_type in enum_types:
cpp_protocol_type = CppGenerator.cpp_protocol_type_for_type(enum_type)
domain_lines.append('template<>')
@@ -398,4 +412,9 @@
sections.append(self.wrap_with_guard_for_domain(domain, '\n'.join(domain_lines)))
- return '\n\n'.join(sections)
+ if len(sections) == 1:
+ return [] # No real sections to emit, just the namespace and template declaration. Skip.
+
+ sections.append('} // namespace %s' % self.helpers_namespace())
+
+ return ['\n\n'.join(sections)]
Modified: trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py 2016-04-04 14:30:35 UTC (rev 199005)
@@ -63,9 +63,7 @@
sections.append(self.generate_license())
sections.append(Template(CppTemplates.ImplementationPrelude).substitute(None, **header_args))
sections.append('namespace Protocol {')
- sections.append(self._generate_enum_mapping())
- enum_parser_sections = map(self._generate_enum_conversion_methods_for_domain, domains)
- sections.extend(filter(lambda section: len(section) > 0, enum_parser_sections))
+ sections.extend(self._generate_enum_mapping_and_conversion_methods(domains))
sections.append(self._generate_open_field_names())
builder_sections = map(self._generate_builders_for_domain, domains)
sections.extend(filter(lambda section: len(section) > 0, builder_sections))
@@ -77,6 +75,9 @@
# Private methods.
def _generate_enum_mapping(self):
+ if not self.assigned_enum_values():
+ return []
+
lines = []
lines.append('static const char* const enum_constant_values[] = {')
lines.extend([' "%s",' % enum_value for enum_value in self.assigned_enum_values()])
@@ -85,7 +86,7 @@
lines.append('String getEnumConstantValue(int code) {')
lines.append(' return enum_constant_values[code];')
lines.append('}')
- return '\n'.join(lines)
+ return ['\n'.join(lines)]
def _generate_enum_conversion_methods_for_domain(self, domain):
@@ -142,6 +143,18 @@
return self.wrap_with_guard_for_domain(domain, '\n'.join(lines))
+ def _generate_enum_mapping_and_conversion_methods(self, domains):
+ sections = []
+ sections.append('namespace %s {' % self.helpers_namespace())
+ sections.extend(self._generate_enum_mapping())
+ enum_parser_sections = map(self._generate_enum_conversion_methods_for_domain, domains)
+ sections.extend(filter(lambda section: len(section) > 0, enum_parser_sections))
+ if len(sections) == 1:
+ return [] # No declarations to emit, just the namespace.
+
+ sections.append('} // namespace %s' % self.helpers_namespace())
+ return sections
+
def _generate_open_field_names(self):
lines = []
for domain in self.domains_to_generate():
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-async-attribute.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -429,8 +429,8 @@
result->setInteger(ASCIILiteral("databaseId"), out_databaseId);
result->setObject(ASCIILiteral("sqlError"), out_sqlError);
result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
- result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(out_screenColor));
- result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(out_printColor));
+ result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_screenColor));
+ result->setString(ASCIILiteral("printColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_printColor));
}
if (!error.length())
m_backendDispatcher->sendResponse(requestId, WTFMove(result));
@@ -450,9 +450,9 @@
jsonMessage->setValue(ASCIILiteral("payload"), payload);
jsonMessage->setInteger(ASCIILiteral("databaseId"), databaseId);
jsonMessage->setObject(ASCIILiteral("sqlError"), sqlError);
- jsonMessage->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(screenColor));
+ jsonMessage->setString(ASCIILiteral("screenColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(screenColor));
jsonMessage->setArray(ASCIILiteral("alternateColors"), alternateColors);
- jsonMessage->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(printColor));
+ jsonMessage->setString(ASCIILiteral("printColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(printColor));
CallbackBase::sendSuccess(WTFMove(jsonMessage));
}
@@ -633,6 +633,8 @@
} // Database
// End of typedefs.
+namespace TestHelpers {
+
String getEnumConstantValue(int code);
template<typename T> String getEnumConstantValue(T enumValue)
@@ -640,6 +642,8 @@
return getEnumConstantValue(static_cast<int>(enumValue));
}
+} // namespace TestHelpers
+
namespace Database {
/* */
enum class PrimaryColors {
@@ -716,6 +720,8 @@
+namespace TestHelpers {
+
template<typename ProtocolEnumType>
Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
@@ -723,6 +729,8 @@
template<>
Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String&);
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
@@ -769,6 +777,8 @@
namespace Protocol {
+namespace TestHelpers {
+
static const char* const enum_constant_values[] = {
"red",
"green",
@@ -800,8 +810,10 @@
}
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -375,9 +375,9 @@
result->setValue(ASCIILiteral("payload"), out_payload);
result->setInteger(ASCIILiteral("databaseId"), out_databaseId);
result->setObject(ASCIILiteral("sqlError"), out_sqlError);
- result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::getEnumConstantValue(out_screenColor));
+ result->setString(ASCIILiteral("screenColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_screenColor));
result->setArray(ASCIILiteral("alternateColors"), out_alternateColors);
- result->setString(ASCIILiteral("printColor"), Inspector::Protocol::getEnumConstantValue(out_printColor));
+ result->setString(ASCIILiteral("printColor"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_printColor));
}
if (!error.length())
m_backendDispatcher->sendResponse(requestId, WTFMove(result));
@@ -534,6 +534,8 @@
} // Database
// End of typedefs.
+namespace TestHelpers {
+
String getEnumConstantValue(int code);
template<typename T> String getEnumConstantValue(T enumValue)
@@ -541,6 +543,8 @@
return getEnumConstantValue(static_cast<int>(enumValue));
}
+} // namespace TestHelpers
+
namespace Database {
/* */
enum class PrimaryColors {
@@ -617,6 +621,8 @@
+namespace TestHelpers {
+
template<typename ProtocolEnumType>
Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
@@ -624,6 +630,8 @@
template<>
Optional<Inspector::Protocol::Database::PrimaryColors> parseEnumValueFromString<Inspector::Protocol::Database::PrimaryColors>(const String&);
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
@@ -670,6 +678,8 @@
namespace Protocol {
+namespace TestHelpers {
+
static const char* const enum_constant_values[] = {
"red",
"green",
@@ -701,8 +711,10 @@
}
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -641,18 +641,8 @@
} // Network2
// End of typedefs.
-String getEnumConstantValue(int code);
-template<typename T> String getEnumConstantValue(T enumValue)
-{
- return getEnumConstantValue(static_cast<int>(enumValue));
-}
-
-
-template<typename ProtocolEnumType>
-Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
-
} // namespace Protocol
} // namespace Inspector
@@ -699,15 +689,8 @@
namespace Protocol {
-static const char* const enum_constant_values[] = {
-};
-String getEnumConstantValue(int code) {
- return enum_constant_values[code];
-}
-
-
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/enum-values.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/enum-values.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/enum-values.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -270,7 +270,7 @@
m_agent->commandWithEnumReturnValue(error, &out_returnValue);
if (!error.length())
- result->setString(ASCIILiteral("returnValue"), Inspector::Protocol::getEnumConstantValue(out_returnValue));
+ result->setString(ASCIILiteral("returnValue"), Inspector::Protocol::TestHelpers::getEnumConstantValue(out_returnValue));
if (!error.length())
m_backendDispatcher->sendResponse(requestId, WTFMove(result));
@@ -384,7 +384,7 @@
Ref<InspectorObject> jsonMessage = InspectorObject::create();
jsonMessage->setString(ASCIILiteral("method"), ASCIILiteral("EventDomain.eventWithEnumParameter"));
Ref<InspectorObject> paramsObject = InspectorObject::create();
- paramsObject->setString(ASCIILiteral("parameter"), Inspector::Protocol::getEnumConstantValue(parameter));
+ paramsObject->setString(ASCIILiteral("parameter"), Inspector::Protocol::TestHelpers::getEnumConstantValue(parameter));
jsonMessage->setObject(ASCIILiteral("params"), WTFMove(paramsObject));
m_frontendRouter.sendEvent(jsonMessage->toJSONString());
@@ -445,6 +445,8 @@
+namespace TestHelpers {
+
String getEnumConstantValue(int code);
template<typename T> String getEnumConstantValue(T enumValue)
@@ -452,6 +454,8 @@
return getEnumConstantValue(static_cast<int>(enumValue));
}
+} // namespace TestHelpers
+
namespace TypeDomain {
/* */
enum class TypeDomainEnum {
@@ -464,6 +468,8 @@
+namespace TestHelpers {
+
template<typename ProtocolEnumType>
Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
@@ -471,6 +477,8 @@
template<>
Optional<Inspector::Protocol::TypeDomain::TypeDomainEnum> parseEnumValueFromString<Inspector::Protocol::TypeDomain::TypeDomainEnum>(const String&);
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
@@ -517,6 +525,8 @@
namespace Protocol {
+namespace TestHelpers {
+
static const char* const enum_constant_values[] = {
"shared",
"red",
@@ -551,8 +561,10 @@
}
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/events-with-optional-parameters.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/events-with-optional-parameters.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/events-with-optional-parameters.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -391,13 +391,6 @@
} // Database
// End of typedefs.
-String getEnumConstantValue(int code);
-
-template<typename T> String getEnumConstantValue(T enumValue)
-{
- return getEnumConstantValue(static_cast<int>(enumValue));
-}
-
namespace Database {
/* Database error. */
class Error : public Inspector::InspectorObjectBase {
@@ -468,9 +461,6 @@
-template<typename ProtocolEnumType>
-Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
-
} // namespace Protocol
} // namespace Inspector
@@ -517,15 +507,8 @@
namespace Protocol {
-static const char* const enum_constant_values[] = {
-};
-String getEnumConstantValue(int code) {
- return enum_constant_values[code];
-}
-
-
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -439,13 +439,6 @@
-String getEnumConstantValue(int code);
-
-template<typename T> String getEnumConstantValue(T enumValue)
-{
- return getEnumConstantValue(static_cast<int>(enumValue));
-}
-
#if PLATFORM(WEB_TYPES)
namespace Network2 {
class NetworkError : public Inspector::InspectorObjectBase {
@@ -517,9 +510,6 @@
-template<typename ProtocolEnumType>
-Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
-
} // namespace Protocol
} // namespace Inspector
@@ -566,15 +556,8 @@
namespace Protocol {
-static const char* const enum_constant_values[] = {
-};
-String getEnumConstantValue(int code) {
- return enum_constant_values[code];
-}
-
-
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/same-type-id-different-domain.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/same-type-id-different-domain.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/same-type-id-different-domain.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -327,18 +327,8 @@
} // Runtime2
// End of typedefs.
-String getEnumConstantValue(int code);
-template<typename T> String getEnumConstantValue(T enumValue)
-{
- return getEnumConstantValue(static_cast<int>(enumValue));
-}
-
-
-template<typename ProtocolEnumType>
-Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
-
} // namespace Protocol
} // namespace Inspector
@@ -385,15 +375,8 @@
namespace Protocol {
-static const char* const enum_constant_values[] = {
-};
-String getEnumConstantValue(int code) {
- return enum_constant_values[code];
-}
-
-
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -322,6 +322,8 @@
+namespace TestHelpers {
+
String getEnumConstantValue(int code);
template<typename T> String getEnumConstantValue(T enumValue)
@@ -329,6 +331,8 @@
return getEnumConstantValue(static_cast<int>(enumValue));
}
+} // namespace TestHelpers
+
namespace Runtime {
/* Key path. */
class KeyPath : public Inspector::InspectorObjectBase {
@@ -366,7 +370,7 @@
Builder<STATE | TypeSet>& setType(Type value)
{
COMPILE_ASSERT(!(STATE & TypeSet), property_type_already_set);
- m_result->setString(ASCIILiteral("type"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));
+ m_result->setString(ASCIILiteral("type"), Inspector::Protocol::TestHelpers::getEnumConstantValue(value));
return castState<TypeSet>();
}
@@ -406,6 +410,8 @@
+namespace TestHelpers {
+
template<typename ProtocolEnumType>
Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
@@ -413,6 +419,8 @@
template<>
Optional<Inspector::Protocol::Runtime::KeyPath::Type> parseEnumValueFromString<Inspector::Protocol::Runtime::KeyPath::Type>(const String&);
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
@@ -459,6 +467,8 @@
namespace Protocol {
+namespace TestHelpers {
+
static const char* const enum_constant_values[] = {
"null",
"string",
@@ -486,8 +496,10 @@
}
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -322,18 +322,8 @@
} // Runtime
// End of typedefs.
-String getEnumConstantValue(int code);
-template<typename T> String getEnumConstantValue(T enumValue)
-{
- return getEnumConstantValue(static_cast<int>(enumValue));
-}
-
-
-template<typename ProtocolEnumType>
-Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
-
} // namespace Protocol
} // namespace Inspector
@@ -380,15 +370,8 @@
namespace Protocol {
-static const char* const enum_constant_values[] = {
-};
-String getEnumConstantValue(int code) {
- return enum_constant_values[code];
-}
-
-
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-array-type.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-array-type.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-array-type.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -338,6 +338,8 @@
} // Runtime
// End of typedefs.
+namespace TestHelpers {
+
String getEnumConstantValue(int code);
template<typename T> String getEnumConstantValue(T enumValue)
@@ -345,6 +347,8 @@
return getEnumConstantValue(static_cast<int>(enumValue));
}
+} // namespace TestHelpers
+
namespace Debugger {
/* */
enum class Reason {
@@ -356,6 +360,8 @@
+namespace TestHelpers {
+
template<typename ProtocolEnumType>
Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
@@ -363,6 +369,8 @@
template<>
Optional<Inspector::Protocol::Debugger::Reason> parseEnumValueFromString<Inspector::Protocol::Debugger::Reason>(const String&);
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
@@ -409,6 +417,8 @@
namespace Protocol {
+namespace TestHelpers {
+
static const char* const enum_constant_values[] = {
"Died",
"Fainted",
@@ -436,8 +446,10 @@
}
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-enum-type.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-enum-type.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-enum-type.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -327,6 +327,8 @@
+namespace TestHelpers {
+
String getEnumConstantValue(int code);
template<typename T> String getEnumConstantValue(T enumValue)
@@ -334,6 +336,8 @@
return getEnumConstantValue(static_cast<int>(enumValue));
}
+} // namespace TestHelpers
+
namespace Runtime {
/* */
enum class FarmAnimals {
@@ -353,6 +357,8 @@
+namespace TestHelpers {
+
template<typename ProtocolEnumType>
Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
@@ -362,6 +368,8 @@
template<>
Optional<Inspector::Protocol::Runtime::TwoLeggedAnimals> parseEnumValueFromString<Inspector::Protocol::Runtime::TwoLeggedAnimals>(const String&);
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
@@ -408,6 +416,8 @@
namespace Protocol {
+namespace TestHelpers {
+
static const char* const enum_constant_values[] = {
"Pigs",
"Cows",
@@ -456,8 +466,10 @@
}
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-object-type.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-object-type.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-declaration-object-type.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -334,13 +334,6 @@
} // Database
// End of typedefs.
-String getEnumConstantValue(int code);
-
-template<typename T> String getEnumConstantValue(T enumValue)
-{
- return getEnumConstantValue(static_cast<int>(enumValue));
-}
-
namespace Database {
/* Database error. */
class Error : public Inspector::InspectorObjectBase {
@@ -796,9 +789,6 @@
-template<typename ProtocolEnumType>
-Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
-
} // namespace Protocol
} // namespace Inspector
@@ -845,15 +835,8 @@
namespace Protocol {
-static const char* const enum_constant_values[] = {
-};
-String getEnumConstantValue(int code) {
- return enum_constant_values[code];
-}
-
-
} // namespace Protocol
} // namespace Inspector
Modified: trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result (199004 => 199005)
--- trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/_javascript_Core/inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result 2016-04-04 14:30:35 UTC (rev 199005)
@@ -335,6 +335,8 @@
} // Test
// End of typedefs.
+namespace TestHelpers {
+
String getEnumConstantValue(int code);
template<typename T> String getEnumConstantValue(T enumValue)
@@ -342,6 +344,8 @@
return getEnumConstantValue(static_cast<int>(enumValue));
}
+} // namespace TestHelpers
+
namespace Test {
/* A dummy type that requires runtime casts, and forces non-primitive referenced types to also emit runtime cast helpers. */
class TypeNeedingCast : public Inspector::InspectorObjectBase {
@@ -391,7 +395,7 @@
Builder<STATE | AnimalsSet>& setAnimals(Inspector::Protocol::Test::CastedAnimals value)
{
COMPILE_ASSERT(!(STATE & AnimalsSet), property_animals_already_set);
- m_result->setString(ASCIILiteral("animals"), Inspector::Protocol::getEnumConstantValue(static_cast<int>(value)));
+ m_result->setString(ASCIILiteral("animals"), Inspector::Protocol::TestHelpers::getEnumConstantValue(value));
return castState<AnimalsSet>();
}
@@ -575,6 +579,8 @@
#endif // !ASSERT_DISABLED
};
+namespace TestHelpers {
+
template<typename ProtocolEnumType>
Optional<ProtocolEnumType> parseEnumValueFromString(const String&);
@@ -584,6 +590,8 @@
template<>
Optional<Inspector::Protocol::Test::CastedAnimals> parseEnumValueFromString<Inspector::Protocol::Test::CastedAnimals>(const String&);
+} // namespace TestHelpers
+
} // namespace Protocol
} // namespace Inspector
@@ -630,6 +638,8 @@
namespace Protocol {
+namespace TestHelpers {
+
static const char* const enum_constant_values[] = {
"Ducks",
"Hens",
@@ -678,8 +688,10 @@
}
+} // namespace TestHelpers
+
#if !ASSERT_DISABLED
void BindingTraits<Inspector::Protocol::Test::CastedAnimals>::assertValueHasExpectedType(Inspector::InspectorValue* value)
{
Modified: trunk/Source/WebCore/ChangeLog (199004 => 199005)
--- trunk/Source/WebCore/ChangeLog 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/WebCore/ChangeLog 2016-04-04 14:30:35 UTC (rev 199005)
@@ -1,3 +1,18 @@
+2016-04-04 Carlos Garcia Campos <[email protected]>
+
+ REGRESSION(r198792): [GTK] Inspector crashes in Inspector::Protocol::getEnumConstantValue since r198792
+ https://bugs.webkit.org/show_bug.cgi?id=155745
+ <rdar://problem/25289456>
+
+ Reviewed by Brian Burg.
+
+ Use Inspector::Protocol::AutomationEnums namespace for getEnumConstantValue().
+
+ * inspector/InspectorDOMAgent.cpp:
+ (WebCore::InspectorDOMAgent::buildObjectForAccessibilityProperties):
+ * inspector/InspectorTimelineAgent.cpp:
+ (WebCore::InspectorTimelineAgent::addRecordToTimeline):
+
2016-04-04 Antti Koivisto <[email protected]>
Avoid double traversal in RenderTreeUpdater for slot roots
Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (199004 => 199005)
--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp 2016-04-04 14:30:35 UTC (rev 199005)
@@ -1669,9 +1669,9 @@
String ariaRelevantAttrValue = axObject->ariaLiveRegionRelevant();
if (!ariaRelevantAttrValue.isEmpty()) {
// FIXME: Pass enum values rather than strings once unblocked. http://webkit.org/b/133711
- String ariaRelevantAdditions = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Additions);
- String ariaRelevantRemovals = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Removals);
- String ariaRelevantText = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Text);
+ String ariaRelevantAdditions = Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Additions);
+ String ariaRelevantRemovals = Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Removals);
+ String ariaRelevantText = Inspector::Protocol::InspectorHelpers::getEnumConstantValue(Inspector::Protocol::DOM::LiveRegionRelevant::Text);
liveRegionRelevant = Inspector::Protocol::Array<String>::create();
const SpaceSplitString& values = SpaceSplitString(ariaRelevantAttrValue, true);
// @aria-relevant="all" is exposed as ["additions","removals","text"], in order.
Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (199004 => 199005)
--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp 2016-04-04 14:30:35 UTC (rev 199005)
@@ -477,7 +477,7 @@
void InspectorTimelineAgent::addRecordToTimeline(RefPtr<InspectorObject>&& record, TimelineRecordType type)
{
ASSERT_ARG(record, record);
- record->setString("type", Inspector::Protocol::getEnumConstantValue(toProtocol(type)));
+ record->setString("type", Inspector::Protocol::InspectorHelpers::getEnumConstantValue(toProtocol(type)));
if (m_recordStack.isEmpty()) {
auto recordObject = BindingTraits<Inspector::Protocol::Timeline::TimelineEvent>::runtimeCast(WTFMove(record));
Modified: trunk/Source/WebKit2/ChangeLog (199004 => 199005)
--- trunk/Source/WebKit2/ChangeLog 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/WebKit2/ChangeLog 2016-04-04 14:30:35 UTC (rev 199005)
@@ -1,3 +1,23 @@
+2016-04-04 Carlos Garcia Campos <[email protected]>
+
+ REGRESSION(r198792): [GTK] Inspector crashes in Inspector::Protocol::getEnumConstantValue since r198792
+ https://bugs.webkit.org/show_bug.cgi?id=155745
+ <rdar://problem/25289456>
+
+ Reviewed by Brian Burg.
+
+ 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):
+
2016-04-04 Emanuele Aina <[email protected]>
Fix WEB_PROCESS_CMD_PREFIX and NETWORK_PROCESS_CMD_PREFIX after r196500
Modified: trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp (199004 => 199005)
--- trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/WebKit2/UIProcess/Automation/WebAutomationSession.cpp 2016-04-04 14:30:35 UTC (rev 199005)
@@ -43,7 +43,7 @@
#define FAIL_WITH_PREDEFINED_ERROR_MESSAGE(messageName) \
do { \
auto enumValue = Inspector::Protocol::Automation::ErrorMessage::messageName; \
- errorString = Inspector::Protocol::getEnumConstantValue(enumValue); \
+ errorString = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(enumValue); \
return; \
} while (false)
@@ -364,7 +364,7 @@
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(WindowNotFound);
if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page->pageID()))
- callback->sendFailure(Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
+ callback->sendFailure(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
page->loadRequest(WebCore::URL(WebCore::URL(), url));
@@ -377,7 +377,7 @@
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(WindowNotFound);
if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page->pageID()))
- callback->sendFailure(Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
+ callback->sendFailure(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
page->goBack();
@@ -390,7 +390,7 @@
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(WindowNotFound);
if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page->pageID()))
- callback->sendFailure(Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
+ callback->sendFailure(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
page->goForward();
@@ -403,7 +403,7 @@
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(WindowNotFound);
if (auto callback = m_pendingNavigationInBrowsingContextCallbacksPerPage.take(page->pageID()))
- callback->sendFailure(Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
+ callback->sendFailure(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::Timeout));
m_pendingNavigationInBrowsingContextCallbacksPerPage.set(page->pageID(), WTFMove(callback));
const bool reloadFromOrigin = false;
@@ -703,11 +703,11 @@
WebCore::IntPoint viewPosition = WebCore::IntPoint(static_cast<int>(x), static_cast<int>(y));
- auto parsedInteraction = Inspector::Protocol::parseEnumValueFromString<Inspector::Protocol::Automation::MouseInteraction>(mouseInteractionString);
+ auto parsedInteraction = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseInteraction>(mouseInteractionString);
if (!parsedInteraction)
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
- auto parsedButton = Inspector::Protocol::parseEnumValueFromString<Inspector::Protocol::Automation::MouseButton>(mouseButtonString);
+ auto parsedButton = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::MouseButton>(mouseButtonString);
if (!parsedButton)
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
@@ -717,7 +717,7 @@
if (!it->get()->asString(modifierString))
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
- auto parsedModifier = Inspector::Protocol::parseEnumValueFromString<Inspector::Protocol::Automation::KeyModifier>(modifierString);
+ auto parsedModifier = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::KeyModifier>(modifierString);
if (!parsedModifier)
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
WebEvent::Modifiers enumValue = protocolModifierToWebEventModifier(parsedModifier.value());
@@ -757,14 +757,14 @@
String interactionTypeString;
if (!interactionObject->getString(ASCIILiteral("type"), interactionTypeString))
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
- auto interactionType = Inspector::Protocol::parseEnumValueFromString<Inspector::Protocol::Automation::KeyboardInteractionType>(interactionTypeString);
+ auto interactionType = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::KeyboardInteractionType>(interactionTypeString);
if (!interactionType)
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
String virtualKeyString;
bool foundVirtualKey = interactionObject->getString(ASCIILiteral("key"), virtualKeyString);
if (foundVirtualKey) {
- auto virtualKey = Inspector::Protocol::parseEnumValueFromString<Inspector::Protocol::Automation::VirtualKey>(virtualKeyString);
+ auto virtualKey = Inspector::Protocol::AutomationHelpers::parseEnumValueFromString<Inspector::Protocol::Automation::VirtualKey>(virtualKeyString);
if (!virtualKey)
FAIL_WITH_PREDEFINED_ERROR_MESSAGE(InvalidParameter);
@@ -826,7 +826,7 @@
String base64EncodedData = platformGetBase64EncodedPNGData(imageDataHandle);
if (base64EncodedData.isEmpty()) {
- callback->sendFailure(Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::InternalError));
+ callback->sendFailure(Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::InternalError));
return;
}
Modified: trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp (199004 => 199005)
--- trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp 2016-04-04 13:40:10 UTC (rev 199004)
+++ trunk/Source/WebKit2/WebProcess/Automation/WebAutomationSessionProxy.cpp 2016-04-04 14:30:35 UTC (rev 199005)
@@ -144,11 +144,11 @@
if (resultIsErrorName) {
if (result->string() == "_javascript_Timeout") {
- String errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::_javascript_Timeout);
+ String errorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::_javascript_Timeout);
automationSessionProxy->didEvaluateJavaScriptFunction(frameID, callbackID, String(), errorType);
} else {
ASSERT_NOT_REACHED();
- String errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::InternalError);
+ String errorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::InternalError);
automationSessionProxy->didEvaluateJavaScriptFunction(frameID, callbackID, String(), errorType);
}
} else
@@ -218,7 +218,7 @@
JSValueUnprotect(frame.jsContext(), scriptObject);
String errorMessage = ASCIILiteral("Callback was not called before the unload event.");
- String errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::_javascript_Error);
+ String errorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::_javascript_Error);
auto pendingFrameCallbacks = m_webFramePendingEvaluateJavaScriptCallbacksMap.take(frameID);
for (uint64_t callbackID : pendingFrameCallbacks)
@@ -258,14 +258,14 @@
if (!exception)
return;
- String errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::_javascript_Error);
+ String errorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::_javascript_Error);
JSRetainPtr<JSStringRef> exceptionMessage;
if (JSValueIsObject(context, exception)) {
JSValueRef nameValue = JSObjectGetProperty(context, const_cast<JSObjectRef>(exception), toJSString(ASCIILiteral("name")).get(), nullptr);
JSRetainPtr<JSStringRef> exceptionName(Adopt, JSValueToStringCopy(context, nameValue, nullptr));
if (exceptionName->string() == "NodeNotFound")
- errorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::NodeNotFound);
+ errorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::NodeNotFound);
JSValueRef messageValue = JSObjectGetProperty(context, const_cast<JSObjectRef>(exception), toJSString(ASCIILiteral("message")).get(), nullptr);
exceptionMessage.adopt(JSValueToStringCopy(context, messageValue, nullptr));
@@ -290,7 +290,7 @@
void WebAutomationSessionProxy::resolveChildFrameWithOrdinal(uint64_t frameID, uint32_t ordinal, uint64_t callbackID)
{
- String frameNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
+ String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
WebFrame* frame = WebProcess::singleton().webFrame(frameID);
if (!frame) {
@@ -321,7 +321,7 @@
void WebAutomationSessionProxy::resolveChildFrameWithNodeHandle(uint64_t frameID, const String& nodeHandle, uint64_t callbackID)
{
- String frameNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
+ String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
WebFrame* frame = WebProcess::singleton().webFrame(frameID);
if (!frame) {
@@ -352,7 +352,7 @@
void WebAutomationSessionProxy::resolveChildFrameWithName(uint64_t frameID, const String& name, uint64_t callbackID)
{
- String frameNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
+ String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
WebFrame* frame = WebProcess::singleton().webFrame(frameID);
if (!frame) {
@@ -383,7 +383,7 @@
void WebAutomationSessionProxy::resolveParentFrame(uint64_t frameID, uint64_t callbackID)
{
- String frameNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
+ String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
WebFrame* frame = WebProcess::singleton().webFrame(frameID);
if (!frame) {
@@ -423,8 +423,8 @@
void WebAutomationSessionProxy::computeElementLayout(uint64_t frameID, String nodeHandle, bool scrollIntoViewIfNeeded, bool useViewportCoordinates, uint64_t callbackID)
{
- String frameNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
- String nodeNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::NodeNotFound);
+ String frameNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::FrameNotFound);
+ String nodeNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::NodeNotFound);
WebFrame* frame = WebProcess::singleton().webFrame(frameID);
if (!frame) {
@@ -465,7 +465,7 @@
void WebAutomationSessionProxy::takeScreenshot(uint64_t pageID, uint64_t callbackID)
{
ShareableBitmap::Handle handle;
- String windowNotFoundErrorType = Inspector::Protocol::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound);
+ String windowNotFoundErrorType = Inspector::Protocol::AutomationHelpers::getEnumConstantValue(Inspector::Protocol::Automation::ErrorMessage::WindowNotFound);
WebPage* page = WebProcess::singleton().webPage(pageID);
if (!page) {