Reviewed by John.
<rdar://problem/
5156801> REGRESSION: Crash when deleting table content in Leopard Mail
* editing/deleting/
5156801-expected.checksum: Added.
* editing/deleting/
5156801-expected.png: Added.
* editing/deleting/
5156801-expected.txt: Added.
* editing/deleting/
5156801.html: Added.
WebCore:
Reviewed by John.
REGRESSION: Crash when deleting table content in Leopard Mail
* editing/DeleteSelectionCommand.cpp:
(WebCore::DeleteSelectionCommand::handleGeneralDelete): Use a RefPtr
for the next node to delete, in case it is destroyed when the
current node is deleted. In the crash reported in the radar, we
crash because the next node is the div that holds the delete button
and it's destroyed when the node that contains the selection is removed.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@24120
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-07-09 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by John.
+
+ <rdar://problem/5156801> REGRESSION: Crash when deleting table content in Leopard Mail
+
+ * editing/deleting/5156801-expected.checksum: Added.
+ * editing/deleting/5156801-expected.png: Added.
+ * editing/deleting/5156801-expected.txt: Added.
+ * editing/deleting/5156801.html: Added.
+
2007-07-09 Anders Carlsson <andersca@apple.com>
Reviewed by Oliver.
--- /dev/null
+c003f0a32c771dbd0cced1f565e43caf
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+ RenderBlock {P} at (0,0) size 784x36
+ RenderText {#text} at (0,0) size 779x36
+ text run at (0,0) width 779: "This tests for a bug where delete would crash if a node just after the selection to delete is removed in a DOMNodeRemoved"
+ text run at (0,18) width 349: "event handler for the last node in the selection to delete."
+ RenderBlock {DIV} at (0,52) size 784x18
+ RenderText {#text} at (0,0) size 21x18
+ text run at (0,0) width 21: "foo"
+ RenderInline {SPAN} at (0,0) size 8x18
+ RenderText {#text} at (21,0) size 8x18
+ text run at (21,0) width 8: "x"
+ RenderInline {SPAN} at (0,0) size 8x18
+ RenderText {#text} at (29,0) size 8x18
+ text run at (29,0) width 8: "y"
--- /dev/null
+<p>This tests for a bug where delete would crash if a node just after the selection to delete is removed in a DOMNodeRemoved event handler for the last node in the selection to delete.</p>
+<div contenteditable="true">foo<span id="foo">x</span><span id="removeme">y</span></div>
+
+<script>
+function removeHandler() {
+ var removeme = document.getElementById("removeme");
+ removeme.parentNode.removeChild(removeme);
+}
+
+document.getElementById("foo").addEventListener("DOMNodeRemoved", removeHandler);
+</script>
+2007-07-09 Justin Garcia <justin.garcia@apple.com>
+
+ Reviewed by John.
+
+ REGRESSION: Crash when deleting table content in Leopard Mail
+
+ * editing/DeleteSelectionCommand.cpp:
+ (WebCore::DeleteSelectionCommand::handleGeneralDelete): Use a RefPtr
+ for the next node to delete, in case it is destroyed when the
+ current node is deleted. In the crash reported in the radar, we
+ crash because the next node is the div that holds the delete button
+ and it's destroyed when the node that contains the selection is removed.
+
2007-07-09 Adam Treat <adam@staikos.net>
Reviewed by George Staikos.
// traverseNextSibling just blew past the end position, so stop deleting
node = 0;
} else if (!m_downstreamEnd.node()->isDescendantOf(node)) {
- Node *nextNode = node->traverseNextSibling();
+ RefPtr<Node> nextNode = node->traverseNextSibling();
// if we just removed a node from the end container, update end position so the
// check above will work
if (node->parentNode() == m_downstreamEnd.node()) {
m_downstreamEnd = Position(m_downstreamEnd.node(), m_downstreamEnd.offset() - 1);
}
removeNode(node);
- node = nextNode;
+ node = nextNode.get();
} else {
Node* n = node->lastDescendant();
if (m_downstreamEnd.node() == n && m_downstreamEnd.offset() >= n->caretMaxOffset()) {