RESOLVED FIXED 76146
NodeIterator loses track of the reference node when the reference node is removed from the document (IETC ni_removeReferenceNode)
https://bugs.webkit.org/show_bug.cgi?id=76146
Summary NodeIterator loses track of the reference node when the reference node is rem...
Adam Barth
Reported 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)
Attachments
Patch (5.85 KB, patch)
2012-01-11 21:38 PST, Adam Barth
no flags
Adam Barth
Comment 1 2012-01-11 21:38:49 PST
Ryosuke Niwa
Comment 2 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?
Adam Barth
Comment 3 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!
Darin Adler
Comment 4 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.
Adam Barth
Comment 5 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.
Adam Barth
Comment 6 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.
WebKit Review Bot
Comment 7 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>
WebKit Review Bot
Comment 8 2012-01-12 15:18:56 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.