Diff
Modified: branches/safari-534.54-branch/LayoutTests/ChangeLog (105214 => 105215)
--- branches/safari-534.54-branch/LayoutTests/ChangeLog 2012-01-18 00:50:43 UTC (rev 105214)
+++ branches/safari-534.54-branch/LayoutTests/ChangeLog 2012-01-18 00:54:18 UTC (rev 105215)
@@ -1,3 +1,17 @@
+2011-1-17 Lucas Forschler <[email protected]>
+
+ Merge 96973
+
+ 2011-10-07 Chris Fleizach <[email protected]>
+
+ Bug 69562 - AccessibilityImageMapLink holds onto it's parent even after it's been freed
+ https://bugs.webkit.org/show_bug.cgi?id=69562
+
+ Reviewed by Darin Adler.
+
+ * accessibility/image-map-update-parent-crash-expected.txt: Added.
+ * accessibility/image-map-update-parent-crash.html: Added.
+
2012-01-16 Filip Pizlo <[email protected]>
Merge 105107.
Copied: branches/safari-534.54-branch/LayoutTests/accessibility/image-map-update-parent-crash-expected.txt (from rev 96973, trunk/LayoutTests/accessibility/image-map-update-parent-crash-expected.txt) (0 => 105215)
--- branches/safari-534.54-branch/LayoutTests/accessibility/image-map-update-parent-crash-expected.txt (rev 0)
+++ branches/safari-534.54-branch/LayoutTests/accessibility/image-map-update-parent-crash-expected.txt 2012-01-18 00:54:18 UTC (rev 105215)
@@ -0,0 +1,6 @@
+This tests that an image map's hold on it's parent will be cleared if the parent goes away.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
Copied: branches/safari-534.54-branch/LayoutTests/accessibility/image-map-update-parent-crash.html (from rev 96973, trunk/LayoutTests/accessibility/image-map-update-parent-crash.html) (0 => 105215)
--- branches/safari-534.54-branch/LayoutTests/accessibility/image-map-update-parent-crash.html (rev 0)
+++ branches/safari-534.54-branch/LayoutTests/accessibility/image-map-update-parent-crash.html 2012-01-18 00:54:18 UTC (rev 105215)
@@ -0,0 +1,54 @@
+<html>
+<head>
+<link rel="stylesheet" href=""
+<script src=""
+
+<script>
+
+if (window.layoutTestController)
+ layoutTestController.waitUntilDone();
+
+function buildAccessibilityTree(accessibilityObject, indent) {
+ var count = accessibilityObject.childrenCount;
+ for (var i = 0; i < count; ++i) {
+ if (!buildAccessibilityTree(accessibilityObject.childAtIndex(i), indent + 1))
+ return false;
+ }
+
+ return true;
+}
+
+function runAXTest() {
+
+
+ description("This tests that an image map's hold on it's parent will be cleared if the parent goes away.");
+
+ // First access all children using AX
+ buildAccessibilityTree(accessibilityController.rootElement, 0);
+
+ var child = document.getElementById('img'); child.parentNode.removeChild(child);
+
+ // Now verify we haven't crashed.
+ buildAccessibilityTree(accessibilityController.rootElement, 0);
+
+ if (window.layoutTestController)
+ layoutTestController.notifyDone();
+}
+</script>
+
+</head>
+<body>
+
+<map name="map">
+<div id="o7"></div>
+<area id="o20" href=""
+
+<img id="img" usemap=""
+
+<script>setTimeout("runAXTest();", 1);</script>
+
+<p id="description"></p>
+<div id="console"></div>
+
+</body>
+</html>
Modified: branches/safari-534.54-branch/Source/WebCore/ChangeLog (105214 => 105215)
--- branches/safari-534.54-branch/Source/WebCore/ChangeLog 2012-01-18 00:50:43 UTC (rev 105214)
+++ branches/safari-534.54-branch/Source/WebCore/ChangeLog 2012-01-18 00:54:18 UTC (rev 105215)
@@ -1,3 +1,41 @@
+2011-1-17 Lucas Forschler <[email protected]>
+
+ Merge 96973
+
+ 2011-10-07 Chris Fleizach <[email protected]>
+
+ Bug 69562 - AccessibilityImageMapLink holds onto it's parent even after it's been freed
+ https://bugs.webkit.org/show_bug.cgi?id=69562
+
+ Some fake objects, like AXImageMapLink, have weak references to their parent's (since they are fake objects and
+ need some connection to the parent). However, if the parent disappears before the child, then we're left with a
+ out of date reference to that parent.
+
+ The fix is to allow these elements to clear their parentage when the parent goes away.
+
+ Reviewed by Darin Adler.
+
+ Test: accessibility/image-map-update-parent-crash.html
+
+ * accessibility/AccessibilityMenuListOption.cpp:
+ (WebCore::AccessibilityMenuListOption::isVisible):
+ * accessibility/AccessibilityMenuListPopup.cpp:
+ (WebCore::AccessibilityMenuListPopup::isOffScreen):
+ (WebCore::AccessibilityMenuListPopup::isEnabled):
+ (WebCore::AccessibilityMenuListPopup::press):
+ (WebCore::AccessibilityMenuListPopup::addChildren):
+ (WebCore::AccessibilityMenuListPopup::childrenChanged):
+ * accessibility/AccessibilityMockObject.h:
+ (WebCore::AccessibilityMockObject::detachFromParent):
+ * accessibility/AccessibilityObject.cpp:
+ (WebCore::AccessibilityObject::clearChildren):
+ * accessibility/AccessibilityObject.h:
+ (WebCore::AccessibilityObject::detachFromParent):
+ * accessibility/AccessibilitySlider.cpp:
+ (WebCore::AccessibilitySliderThumb::elementRect):
+ * accessibility/AccessibilityTableColumn.cpp:
+ (WebCore::AccessibilityTableColumn::headerObjectForSection):
+
2012-01-17 Mark Rowe <[email protected]>
Merge r99649.
Modified: branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityMenuListOption.cpp (105214 => 105215)
--- branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityMenuListOption.cpp 2012-01-18 00:50:43 UTC (rev 105214)
+++ branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityMenuListOption.cpp 2012-01-18 00:54:18 UTC (rev 105215)
@@ -59,6 +59,9 @@
bool AccessibilityMenuListOption::isVisible() const
{
+ if (!m_parent)
+ return false;
+
// In a single-option select with the popup collapsed, only the selected
// item is considered visible.
return !m_parent->isOffScreen() || isSelected();
Modified: branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp (105214 => 105215)
--- branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp 2012-01-18 00:50:43 UTC (rev 105214)
+++ branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp 2012-01-18 00:54:18 UTC (rev 105215)
@@ -48,11 +48,17 @@
bool AccessibilityMenuListPopup::isOffScreen() const
{
+ if (!m_parent)
+ return true;
+
return m_parent->isCollapsed();
}
bool AccessibilityMenuListPopup::isEnabled() const
{
+ if (!m_parent)
+ return false;
+
return m_parent->isEnabled();
}
@@ -72,12 +78,18 @@
bool AccessibilityMenuListPopup::press() const
{
- m_parent->press();
+ if (!m_parent)
+ return false;
+
+ m_parent->press();
return true;
}
void AccessibilityMenuListPopup::addChildren()
{
+ if (!m_parent)
+ return;
+
Node* selectNode = m_parent->node();
if (!selectNode)
return;
@@ -101,12 +113,16 @@
AXObjectCache* cache = axObjectCache();
for (size_t i = m_children.size(); i > 0 ; --i) {
AccessibilityObject* child = m_children[i - 1].get();
- if (child->actionElement() && !child->actionElement()->attached())
+ if (child->actionElement() && !child->actionElement()->attached()) {
+ child->detachFromParent();
cache->remove(child->axObjectID());
- m_children.clear();
- m_haveChildren = false;
- addChildren();
+ }
}
+
+ m_children.clear();
+ m_haveChildren = false;
+ addChildren();
+
}
void AccessibilityMenuListPopup::didUpdateActiveOption(int optionIndex)
Modified: branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityMockObject.h (105214 => 105215)
--- branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityMockObject.h 2012-01-18 00:50:43 UTC (rev 105214)
+++ branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityMockObject.h 2012-01-18 00:54:18 UTC (rev 105215)
@@ -41,7 +41,7 @@
virtual void setParent(AccessibilityObject* parent) { m_parent = parent; };
// Must be called when the parent object clears its children.
- void detachFromParent() { m_parent = 0; }
+ virtual void detachFromParent() { m_parent = 0; }
protected:
AccessibilityObject* m_parent;
Modified: branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityObject.cpp (105214 => 105215)
--- branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityObject.cpp 2012-01-18 00:50:43 UTC (rev 105214)
+++ branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityObject.cpp 2012-01-18 00:54:18 UTC (rev 105215)
@@ -753,6 +753,11 @@
void AccessibilityObject::clearChildren()
{
+ // Some objects have weak pointers to their parents and those associations need to be detached.
+ size_t length = m_children.size();
+ for (size_t i = 0; i < length; i++)
+ m_children[i]->detachFromParent();
+
m_children.clear();
m_haveChildren = false;
}
Modified: branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityObject.h (105214 => 105215)
--- branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityObject.h 2012-01-18 00:50:43 UTC (rev 105214)
+++ branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityObject.h 2012-01-18 00:54:18 UTC (rev 105215)
@@ -470,6 +470,7 @@
virtual bool canHaveChildren() const { return true; }
virtual bool hasChildren() const { return m_haveChildren; }
virtual void updateChildrenIfNecessary();
+ virtual void detachFromParent() { }
virtual void selectedChildren(AccessibilityChildrenVector&) { }
virtual void visibleChildren(AccessibilityChildrenVector&) { }
virtual void tabChildren(AccessibilityChildrenVector&) { }
Modified: branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityTableColumn.cpp (105214 => 105215)
--- branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityTableColumn.cpp 2012-01-18 00:50:43 UTC (rev 105214)
+++ branches/safari-534.54-branch/Source/WebCore/accessibility/AccessibilityTableColumn.cpp 2012-01-18 00:54:18 UTC (rev 105215)
@@ -161,7 +161,7 @@
if (!cell)
return 0;
- return m_parent->axObjectCache()->getOrCreate(cell);
+ return axObjectCache()->getOrCreate(cell);
}
bool AccessibilityTableColumn::accessibilityIsIgnored() const