Bug 625722 - Firefox freezes in Mozilla TreeWalker demo. r=sicking a=blocking2.0
authorCraig Topper <craig.topper@gmail.com>
Sat, 15 Jan 2011 11:00:50 -0800
changeset 61070 2b3bc2611e6e6ad37f604043ac4da1d0cbb08ea5
parent 61069 b7ea3d9683bad08798a619a99f13297c586fd88f
child 61071 8d52e3b68ca6d9db61f6fcf6cd1f88b1b61a3611
push idunknown
push userunknown
push dateunknown
reviewerssicking, blocking2
bugs625722
milestone2.0b10pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 625722 - Firefox freezes in Mozilla TreeWalker demo. r=sicking a=blocking2.0
content/base/src/nsTreeWalker.cpp
content/base/test/Makefile.in
content/base/test/test_bug625722.html
--- a/content/base/src/nsTreeWalker.cpp
+++ b/content/base/src/nsTreeWalker.cpp
@@ -361,22 +361,25 @@ nsresult nsTreeWalker::FirstChildInterna
 
         do {
             nsINode *sibling = aReversed ? node->GetPreviousSibling()
                                          : node->GetNextSibling();
             if (sibling) {
                 node = sibling;
                 break;
             }
+
             nsINode *parent = node->GetNodeParent();
 
             if (!parent || parent == mRoot || parent == mCurrentNode) {
                 return NS_OK;
             }
 
+            node = parent;
+
         } while (node);
     }
 
     return NS_OK;
 }
 
 /*
  * Implements NextSibling and PreviousSibling which only vary in which
--- a/content/base/test/Makefile.in
+++ b/content/base/test/Makefile.in
@@ -453,16 +453,17 @@ include $(topsrcdir)/config/rules.mk
 		test_treewalker_nextsibling.xml \
 		test_bug614058.html \
 		test_bug590771.html \
 		test_bug622117.html \
 		test_bug622246.html \
 		test_bug484396.html \
 		test_bug466080.html \
 		bug466080.sjs \
+		test_bug625722.html \
 		$(NULL)
 
 # This test fails on the Mac for some reason
 ifneq (,$(filter gtk2 windows,$(MOZ_WIDGET_TOOLKIT)))
 _TEST_FILES2 += 	test_copyimage.html \
 		$(NULL)
 endif
 
new file mode 100644
--- /dev/null
+++ b/content/base/test/test_bug625722.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=625722
+-->
+<head>
+  <title>Test for Bug 625722</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=625722">Mozilla Bug 625722</a>
+<p id="display"></p>
+<div id="content" style="display: none">
+  <span id=root><span id=A><span id=A1></span></span><span id=B></span></span>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 625722 **/
+
+function testNodeFilter(n) {
+  if (n.id == 'A' || n.id == 'A1')
+    return NodeFilter.FILTER_SKIP;
+  return NodeFilter.FILTER_ACCEPT;
+}
+
+tw = document.createTreeWalker(document.getElementById("root"),
+                               NodeFilter.SHOW_ELEMENT,
+                               testNodeFilter, false);
+
+node = tw.firstChild();
+is(node.id, 'B', "First accepted child of root not B");
+
+
+</script>
+</pre>
+</body>
+</html>