Diff
Modified: trunk/Source/WebCore/ChangeLog (152396 => 152397)
--- trunk/Source/WebCore/ChangeLog 2013-07-04 10:03:42 UTC (rev 152396)
+++ trunk/Source/WebCore/ChangeLog 2013-07-04 12:10:45 UTC (rev 152397)
@@ -1,3 +1,15 @@
+2013-07-04 Brian Holt <[email protected]>
+
+ [ATK] Leak: AtkAttributeSet* should be freed
+ https://bugs.webkit.org/show_bug.cgi?id=118307
+
+ Reviewed by Christophe Dumez.
+
+ Use AtkAttributeSet* instead of GSList*.
+
+ * accessibility/atk/WebKitAccessibleWrapperAtk.cpp:
+ (webkitAccessibleGetObjectLocale):
+
2013-07-04 Mario Sanchez Prada <[email protected]>
[ATK] Do not expose '\n' for wrapped lines with ATK_TEXT_BOUNDARY_CHAR
Modified: trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp (152396 => 152397)
--- trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp 2013-07-04 10:03:42 UTC (rev 152396)
+++ trunk/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp 2013-07-04 12:10:45 UTC (rev 152397)
@@ -811,14 +811,13 @@
const gchar* locale = 0;
AtkAttributeSet* textAttributes = atk_text_get_default_attributes(ATK_TEXT(object));
- for (GSList* attributes = textAttributes; attributes; attributes = attributes->next) {
+ for (AtkAttributeSet* attributes = textAttributes; attributes; attributes = attributes->next) {
AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
if (!strcmp(atkAttribute->name, atk_text_attribute_get_name(ATK_TEXT_ATTR_LANGUAGE))) {
locale = cacheAndReturnAtkProperty(object, AtkCachedDocumentLocale, String::fromUTF8(atkAttribute->value));
break;
}
}
-
atk_attribute_set_free(textAttributes);
return locale;
Modified: trunk/Tools/ChangeLog (152396 => 152397)
--- trunk/Tools/ChangeLog 2013-07-04 10:03:42 UTC (rev 152396)
+++ trunk/Tools/ChangeLog 2013-07-04 12:10:45 UTC (rev 152397)
@@ -1,3 +1,26 @@
+2013-07-04 Brian Holt <[email protected]>
+
+ [ATK] Leak: AtkAttributeSet* should be freed
+ https://bugs.webkit.org/show_bug.cgi?id=118307
+
+ Reviewed by Christophe Dumez.
+
+ Fixed memory leaks for AtkAttributeSet by calling
+ atk_attribute_set_free().
+
+ * DumpRenderTree/atk/AccessibilityControllerAtk.cpp:
+ (AccessibilityController::childElementById):
+ * DumpRenderTree/atk/AccessibilityUIElementAtk.cpp:
+ (getAtkAttributeSetAsString):
+ (AccessibilityUIElement::allAttributes):
+ (AccessibilityUIElement::stringAttributeValue):
+ * WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp:
+ (WTR::childElementById):
+ * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp:
+ (WTR::getAtkAttributeSetAsString):
+ (WTR::AccessibilityUIElement::allAttributes):
+ (WTR::AccessibilityUIElement::stringAttributeValue):
+
2013-07-03 David Farler <[email protected]>
Add Makefile to WebKitLauncher
Modified: trunk/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp (152396 => 152397)
--- trunk/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp 2013-07-04 10:03:42 UTC (rev 152396)
+++ trunk/Tools/DumpRenderTree/atk/AccessibilityControllerAtk.cpp 2013-07-04 12:10:45 UTC (rev 152397)
@@ -93,16 +93,21 @@
if (!ATK_IS_OBJECT(parent))
return 0;
- AtkAttributeSet* attributeSet = atk_object_get_attributes(parent);
- for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) {
+ bool parentFound = false;
+ AtkAttributeSet* attributeSet(atk_object_get_attributes(parent));
+ for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
if (!strcmp(attribute->name, "html-id")) {
if (!strcmp(attribute->value, id))
- return parent;
+ parentFound = true;
break;
}
}
+ atk_attribute_set_free(attributeSet);
+ if (parentFound)
+ return parent;
+
int childCount = atk_object_get_n_accessible_children(parent);
for (int i = 0; i < childCount; i++) {
AtkObject* result = childElementById(atk_object_ref_accessible_child(parent, i), id);
Modified: trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp (152396 => 152397)
--- trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp 2013-07-04 10:03:42 UTC (rev 152396)
+++ trunk/Tools/DumpRenderTree/atk/AccessibilityUIElementAtk.cpp 2013-07-04 12:10:45 UTC (rev 152397)
@@ -292,27 +292,29 @@
return 0;
}
-gchar* attributeSetToString(AtkAttributeSet* attributeSet)
+static char* getAtkAttributeSetAsString(AtkObject* accessible)
{
GString* str = g_string_new(0);
- for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) {
+
+ AtkAttributeSet* attributeSet = atk_object_get_attributes(accessible);
+ for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL));
g_string_append(str, attributeData.get());
if (attributes->next)
g_string_append(str, ", ");
}
+ atk_attribute_set_free(attributeSet);
return g_string_free(str, FALSE);
}
JSStringRef AccessibilityUIElement::allAttributes()
{
- if (!m_element)
+ if (!m_element || !ATK_IS_OBJECT(m_element))
return JSStringCreateWithCharacters(0, 0);
- ASSERT(ATK_IS_OBJECT(m_element));
- GOwnPtr<gchar> attributeData(attributeSetToString(atk_object_get_attributes(ATK_OBJECT(m_element))));
+ GOwnPtr<char> attributeData(getAtkAttributeSetAsString(ATK_OBJECT(m_element)));
return JSStringCreateWithUTF8CString(attributeData.get());
}
@@ -802,13 +804,21 @@
if (atkAttributeName.isEmpty())
return JSStringCreateWithCharacters(0, 0);
- for (GSList* atkAttributes = atk_object_get_attributes(ATK_OBJECT(m_element)); atkAttributes; atkAttributes = atkAttributes->next) {
- AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(atkAttributes->data);
- if (!strcmp(atkAttribute->name, atkAttributeName.utf8().data()))
- return JSStringCreateWithUTF8CString(atkAttribute->value);
+ const char* attributeValue = 0;
+ AtkAttributeSet* attributeSet = atk_object_get_attributes(ATK_OBJECT(m_element));
+ for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
+ AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
+ if (!strcmp(atkAttribute->name, atkAttributeName.utf8().data())) {
+ attributeValue = atkAttribute->value;
+ break;
+ }
}
+ JSStringRef jsString = attributeValue
+ ? JSStringCreateWithUTF8CString(attributeValue)
+ : JSStringCreateWithCharacters(0, 0);
+ atk_attribute_set_free(attributeSet);
- return JSStringCreateWithCharacters(0, 0);
+ return jsString;
}
double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp (152396 => 152397)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp 2013-07-04 10:03:42 UTC (rev 152396)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityControllerAtk.cpp 2013-07-04 12:10:45 UTC (rev 152397)
@@ -155,16 +155,21 @@
if (!ATK_IS_OBJECT(parent))
return 0;
+ bool parentFound = false;
AtkAttributeSet* attributeSet = atk_object_get_attributes(parent);
- for (GSList* attributes = attributeSet; attributes; attributes = attributes->next) {
+ for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
if (!strcmp(attribute->name, "html-id")) {
if (!strcmp(attribute->value, id))
- return parent;
+ parentFound = true;
break;
}
}
+ atk_attribute_set_free(attributeSet);
+ if (parentFound)
+ return parent;
+
int childCount = atk_object_get_n_accessible_children(parent);
for (int i = 0; i < childCount; i++) {
AtkObject* result = childElementById(atk_object_ref_accessible_child(parent, i), id);
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp (152396 => 152397)
--- trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp 2013-07-04 10:03:42 UTC (rev 152396)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp 2013-07-04 12:10:45 UTC (rev 152397)
@@ -53,30 +53,20 @@
return attributeString == "AXPlaceholderValue" ? "placeholder-text" : String();
}
-static void attributesClear(AtkAttributeSet* attributesSet)
+static char* getAtkAttributeSetAsString(AtkObject* accessible)
{
- for (GSList* attributes = attributesSet; attributes; attributes = attributes->next) {
- AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
- g_free(atkAttribute->name);
- g_free(atkAttribute->value);
- g_free(atkAttribute);
- }
-}
-
-static gchar* attributeSetToString(AtkAttributeSet* attributeSet)
-{
- GOwnPtr<GSList> atkAttributes(attributeSet);
GString* str = g_string_new(0);
- for (GSList* attributes = atkAttributes.get(); attributes; attributes = attributes->next) {
+
+ AtkAttributeSet* attributeSet = atk_object_get_attributes(accessible);
+ for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
AtkAttribute* attribute = static_cast<AtkAttribute*>(attributes->data);
GOwnPtr<gchar> attributeData(g_strconcat(attribute->name, ":", attribute->value, NULL));
g_string_append(str, attributeData.get());
if (attributes->next)
g_string_append(str, ", ");
}
+ atk_attribute_set_free(attributeSet);
- attributesClear(atkAttributes.get());
-
return g_string_free(str, FALSE);
}
@@ -470,7 +460,7 @@
if (!m_element || !ATK_IS_OBJECT(m_element.get()))
return JSStringCreateWithCharacters(0, 0);
- GOwnPtr<gchar> attributeData(attributeSetToString(atk_object_get_attributes(ATK_OBJECT(m_element.get()))));
+ GOwnPtr<char> attributeData(getAtkAttributeSetAsString(ATK_OBJECT(m_element.get())));
return JSStringCreateWithUTF8CString(attributeData.get());
}
@@ -483,19 +473,21 @@
if (atkAttributeName.isNull())
return JSStringCreateWithCharacters(0, 0);
- GOwnPtr<gchar> attributeValue;
- GOwnPtr<GSList> objectAttributes(atk_object_get_attributes(ATK_OBJECT(m_element.get())));
- for (GSList* attributes = objectAttributes.get(); attributes; attributes = attributes->next) {
+ const char* attributeValue = 0;
+ AtkAttributeSet* attributeSet = atk_object_get_attributes(ATK_OBJECT(m_element.get()));
+ for (AtkAttributeSet* attributes = attributeSet; attributes; attributes = attributes->next) {
AtkAttribute* atkAttribute = static_cast<AtkAttribute*>(attributes->data);
if (!strcmp(atkAttribute->name, atkAttributeName.utf8().data())) {
- attributeValue.set(g_strdup(atkAttribute->value));
+ attributeValue = atkAttribute->value;
break;
}
}
+ JSStringRef jsString = attributeValue
+ ? JSStringCreateWithUTF8CString(attributeValue)
+ : JSStringCreateWithCharacters(0, 0);
+ atk_attribute_set_free(attributeSet);
- attributesClear(objectAttributes.get());
-
- return JSStringCreateWithUTF8CString(attributeValue.get());
+ return jsString;
}
double AccessibilityUIElement::numberAttributeValue(JSStringRef attribute)