Bug 590771 - Tests. r=sicking a=tests
authorMounir Lamouri <mounir.lamouri@gmail.com>
Thu, 16 Dec 2010 12:01:47 -0800
changeset 59456 be885fbb66c20f8da9e5edee801ead21d2695e24
parent 59455 a01537c0bf1987f12f67b6834b2f3b72241ca64c
child 59457 60f75da9765ba157842be703fe894c80a60993bd
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewerssicking, tests
bugs590771
milestone2.0b9pre
Bug 590771 - Tests. r=sicking a=tests
content/base/test/Makefile.in
content/base/test/test_bug590771.html
content/html/content/test/test_bug546995.html
layout/reftests/bugs/557087-1.html
layout/reftests/bugs/557087-2.html
--- a/content/base/test/Makefile.in
+++ b/content/base/test/Makefile.in
@@ -446,16 +446,17 @@ include $(topsrcdir)/config/rules.mk
 		file_bug604660-3.js \
 		file_bug604660-4.js \
 		file_bug604660-5.xml \
 		file_bug604660-6.xsl \
 		test_bug605982.html \
 		test_bug606729.html \
 		test_treewalker_nextsibling.xml \
 		test_bug614058.html \
+		test_bug590771.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_bug590771.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=590771
+-->
+<head>
+  <title>Test for Bug 590771</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=590771">Mozilla Bug 590771</a>
+<p id="display"></p>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 590771 **/
+
+function test1()
+{
+  var attr = document.createAttribute("foo");
+  attr.value = "bar";
+  var ni = document.createNodeIterator(attr, -1, null, false);
+  ni.nextNode();
+  ni.nextNode();
+  is(ni.referenceNode, attr.firstChild,
+      "iterator should be on the first child attribute");
+
+  attr.removeChild(attr.firstChild);
+  is(ni.referenceNode, attr,
+     "iterator should be on the attribute now");
+}
+
+function test2()
+{
+  var attr = document.createAttribute("foo");
+  attr.value = "bar";
+  var ni = document.createNodeIterator(attr, -1, null, false);
+  ni.nextNode();
+  ni.nextNode();
+  is(ni.referenceNode, attr.firstChild,
+      "iterator should be on the first child attribute");
+
+  attr.value = "";
+  is(ni.referenceNode, attr,
+     "iterator should be on the attribute now");
+}
+
+function test3()
+{
+  var attr = document.createAttribute("foo");
+  attr.value = "bar";
+  var node = document.createElement("div");
+  node.setAttributeNode(attr);
+  var ni = document.createNodeIterator(attr, -1, null, false);
+  ni.nextNode();
+  ni.nextNode();
+  is(ni.referenceNode, attr.firstChild,
+      "iterator should be on the first child attribute");
+
+  node.setAttribute("foo", "");
+  is(ni.referenceNode, attr,
+     "iterator should be on the attribute now");
+}
+
+test1();
+test2();
+test3();
+
+</script>
+</pre>
+</body>
+</html>