|Summary:||NodeIterator loses track of the reference node when the reference node is removed from the document (IETC ni_removeReferenceNode)|
|Product:||WebKit||Reporter:||Adam Barth <abarth>|
|Component:||New Bugs||Assignee:||Adam Barth <abarth>|
|Severity:||Normal||CC:||ap, darin, eric, webkit.review.bot|
|Version:||528+ (Nightly build)|
|Bug Depends on:|
Description Adam Barth 2012-01-11 21:33:26 PST
NodeIterator loses track of the reference node when the reference node is removed from the document (IETC ni_removeReferenceNode)
Comment 2 Ryosuke Niwa 2012-01-11 22:20:26 PST
Comment on attachment 122167 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=122167&action=review > Source/WebCore/dom/NodeIterator.cpp:185 > + while (node && node->isDescendantOf(removedNode)) > + node = node->traverseNextNode(root()); This is every inefficient way to find the next node. If node is a descendant of the removed node, then the next node should be removedNode->traverseNextSibling(), no?
Comment 3 Adam Barth 2012-01-11 23:02:26 PST
@darin: I've been told that you're the expert on this code. This function is pretty subtle. If you have a few minutes to sanity-check this patch, that would be great. Thanks!
Comment 4 Darin Adler 2012-01-12 11:11:36 PST
Comment on attachment 122167 [details] Patch I did fix quite a few bugs in this code a while back. The change in the code looks fine. I think to improve performance and correctness we’d want to add performance and correctness tests. This little-used barely-useful obscure corner of the DOM does not get a lot of attention or love.
Comment 5 Adam Barth 2012-01-12 12:17:27 PST
It looks like DOM4 has a reasonably simple specification of what to do when nodes are removed: http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#interface-nodeiterator I wonder if we can re-work our implementation to match the spec more closely.
Comment 6 Adam Barth 2012-01-12 14:05:20 PST
Comment on attachment 122167 [details] Patch I'm going to work on refactoring and adding more tests for NodeIterator in future bug.
Comment 7 WebKit Review Bot 2012-01-12 15:18:51 PST
Comment on attachment 122167 [details] Patch Clearing flags on attachment: 122167 Committed r104866: <http://trac.webkit.org/changeset/104866>
Comment 8 WebKit Review Bot 2012-01-12 15:18:56 PST
All reviewed patches have been landed. Closing bug.