Bug 838518 part 2. Fix nodeiterator callers per the API change that was made. r=smaug
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 06 Feb 2013 14:22:33 +0000
changeset 121019 adcbf76cd5860c8c360978a39a1c1c5f4ca048c0
parent 121018 e1e47cdd7b68dee9aa6b75a5d228b4af4cf895ae
child 121020 2e0f4418ad0c85db4404640e025ec4cd89c2af1b
push id22530
push userbzbarsky@mozilla.com
push dateWed, 06 Feb 2013 14:26:20 +0000
treeherdermozilla-inbound@a236893f5737 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs838518
milestone21.0a1
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 838518 part 2. Fix nodeiterator callers per the API change that was made. r=smaug
browser/devtools/markupview/test/browser_inspector_markup_mutation.js
content/base/test/test_NodeIterator_basics_filters.xhtml
content/base/test/test_NodeIterator_mutations_1.xhtml
content/base/test/test_NodeIterator_mutations_2.html
content/base/test/test_NodeIterator_mutations_3.html
content/base/test/test_bug559526.html
dom/imptests/failures/webapps/DOMCore/tests/approved/test_interfaces.html.json
dom/imptests/webapps/DOMCore/tests/approved/test_interfaces.html
js/xpconnect/tests/mochitest/test_bug446584.html
js/xpconnect/tests/mochitest/test_bug502959.html
mobile/xul/chrome/content/browser.js
--- a/browser/devtools/markupview/test/browser_inspector_markup_mutation.js
+++ b/browser/devtools/markupview/test/browser_inspector_markup_mutation.js
@@ -26,17 +26,17 @@ function test() {
 
   let inspector;
 
   // Strip whitespace from a node and its children.
   function stripWhitespace(node)
   {
     node.normalize();
     let iter = node.ownerDocument.createNodeIterator(node, NodeFilter.SHOW_TEXT + NodeFilter.SHOW_COMMENT,
-      null, false);
+      null);
 
     while ((node = iter.nextNode())) {
       node.nodeValue = node.nodeValue.replace(/\s+/g, '');
       if (node.nodeType == Node.TEXT_NODE &&
         !/[^\s]/.exec(node.nodeValue)) {
         node.parentNode.removeChild(node);
       }
     }
--- a/content/base/test/test_NodeIterator_basics_filters.xhtml
+++ b/content/base/test/test_NodeIterator_basics_filters.xhtml
@@ -49,17 +49,17 @@
                            3, 1, 4, // script and CDATA block
                            -3, -3, -3); // close close close
                                         // these aren't there
                                         // not sure why
   var found = new Array();
 
   var iterator = document.createNodeIterator(document,
                                              NodeFilter.SHOW_ALL,
-                                             null, false);
+                                             null);
   var node;
 
   // forwards
   while (node = iterator.nextNode())
     found.push(node.nodeType);
   compare_arrays(expected, found, 'basics forward');
 
   // backwards
@@ -91,17 +91,17 @@
                            1, // div#content
                            8, // comment
                            // processing instruction skipped
                            1, // pre#test
                            1, 4); // script and CDATA block
 
   found.length = 0;
   iterator = document.createNodeIterator(document, NodeFilter.SHOW_ALL,
-                                         filter, false);
+                                         filter);
 
   // forwards
   while (node = iterator.nextNode())
     found.push(node.nodeType);
   compare_arrays(expect_f, found, 'filtered forward');
 
   // backwards
   found.length = 0;
@@ -111,17 +111,17 @@
 
   function checkBadFilter(method, n) {
     var iterator =
       document.createNodeIterator(document, NodeFilter.SHOW_ALL,
                                   function() {
                                     if (n < 0)
                                       iterator.detach();
                                     return NodeFilter.FILTER_ACCEPT;
-                                  }, false);
+                                  });
     while (--n >= 0)
       iterator.nextNode();
     try {
       iterator[method]();
       ok(false, "Able to call " + method + " on a detached NodeIterator");
     } catch (x) { ok(true, x) }
   }
   checkBadFilter("nextNode", 2);
@@ -136,18 +136,17 @@
           parent = document.createElement("span");
 
       grandparent.appendChild(parent);
       parent.appendChild(document.createElement("img"));
       parent.appendChild(document.createElement("p"));
 
       return document.createNodeIterator(grandparent,
                                          NodeFilter.SHOW_ALL,
-                                         filter,
-                                         false);
+                                         filter);
     })(function filter(n) {
       if (n.nodeName != "img")
         return NodeFilter.FILTER_ACCEPT;
 
       iterator.detach();
 
       n.parentNode.parentNode.removeChild(n.parentNode);
       // Drop any node references passed into this function.
--- a/content/base/test/test_NodeIterator_mutations_1.xhtml
+++ b/content/base/test/test_NodeIterator_mutations_1.xhtml
@@ -54,17 +54,17 @@
     var root = $('root1');
     var A = $('A');
     var B = $('B');
     var C = $('C');
     var D = $('D');
     var E = $('E');
 
     var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
-					       null, false);
+					       null);
     check(iterator.nextNode(), root, '1.0');
 
     // 1. Remove a node unrelated to the reference node
     remove($('X'));
     check(iterator.nextNode(), A, '1.1');
 
     // 2. Remove an ancestor of the root node
     remove($('Y'));
@@ -82,17 +82,17 @@
   /** Removal of the reference node **/
   (function () {
     var root = $('root2');
     var F = $('F');
     var FF = $('FF');
     var G = $('G');
     var H = $('H');
     var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
-					       null, false);
+					       null);
 
     check(iterator.nextNode(), root, '2.0');
     check(iterator.nextNode(), F,    '2.1');
     check(iterator.nextNode(), FF,   '2.2');
     check(iterator.nextNode(), G,    '2.3');
     remove(G);
     check(iterator.previousNode(), FF, '2.4');
     remove(FF);
@@ -104,17 +104,17 @@
     var root = $('root3');
     var I = $('I');
     var II = $('II');
     var J = $('J');
     var K = $('K');
     var KK = $('KK');
 
     var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
-					       null, false);
+					       null);
     check(iterator.nextNode(), root, '3.0');
     check(iterator.nextNode(), I, '3.1');
     check(iterator.nextNode(), II, '3.2');
     check(iterator.nextNode(), J, '3.3');
     remove(J);
     var X = addChildTo(II);
     check(iterator.nextNode(), X, '3.4');
     check(iterator.previousNode(), X, '3.5');
@@ -130,17 +130,17 @@
   (function () {
     var root = $('root4');
     var L = $('L');
     var M = $('M');
     var MM = $('MM');
     var N = $('N');
 
     var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
-					       null, false);
+					       null);
     check(iterator.nextNode(), root, '4.1');
     check(iterator.nextNode(), L, '4.2');
     check(iterator.nextNode(), M, '4.3');
     check(iterator.nextNode(), MM, '4.4');
     remove(M);
     check(iterator.previousNode(), L, '4.5');
   })();
 
@@ -148,17 +148,17 @@
   (function () {
     var root = $('root5');
     var O = $('O');
     var P = $('P');
     var PP = $('PP');
     var Q = $('Q');
 
     var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
-					       null, false);
+					       null);
     check(iterator.nextNode(), root, '5.1');
     check(iterator.nextNode(), O, '5.2');
     check(iterator.nextNode(), P, '5.3');
     check(iterator.nextNode(), PP, '5.4');
     remove(P);
     var X = addChildTo(O);
     check(iterator.nextNode(), X, '5.5');
   })();
@@ -167,17 +167,17 @@
   (function () {
     var root = $('root6');
     var R = $('R');
     var S = $('S');
     var SS = $('SS');
     var T = $('T');
 
     var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
-					       null, false);
+					       null);
     check(iterator.nextNode(), root, '6.1');
     check(iterator.nextNode(), R, '6.2');
     check(iterator.nextNode(), S, '6.3');
     check(iterator.nextNode(), SS, '6.4');
     check(iterator.previousNode(), SS, '6.5');
     remove(S);
     check(iterator.nextNode(), T, '6.6');
   })();
@@ -186,17 +186,17 @@
   (function () {
     var root = $('root7');
     var U = $('U');
     var V = $('V');
     var VV = $('VV');
     var W = $('W');
 
     var iterator = document.createNodeIterator(root, NodeFilter.SHOW_ALL,
-					       null, false);
+					       null);
     check(iterator.nextNode(), root, '7.1');
     check(iterator.nextNode(), U, '7.2');
     check(iterator.nextNode(), V, '7.3');
     check(iterator.nextNode(), VV, '7.4');
     check(iterator.previousNode(), VV, '7.5');
     remove(V);
     var X = addChildTo(U);
     check(iterator.previousNode(), X, '7.6');
--- a/content/base/test/test_NodeIterator_mutations_2.html
+++ b/content/base/test/test_NodeIterator_mutations_2.html
@@ -34,17 +34,17 @@
   function testNodeFilter(n) {
     if (n.tagName == 'SPAN')
       return NodeFilter.FILTER_ACCEPT;
     return NodeFilter.FILTER_SKIP;
   }
 
   function checkseq(it, root, expect) {
     var checkIt = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
-					      testNodeFilter, false);
+					      testNodeFilter);
     var printedPointer = (it.referenceNode == undefined);
     var string = '';
     var node;
     while ((node = checkIt.nextNode()) != null) {
       if (!printedPointer && it.referenceNode == node) {
         printedPointer = true;
 	var s = '[' + node.id + '] ';
           if (it.pointerBeforeReferenceNode)
@@ -57,32 +57,32 @@
     }
     is(string.slice(0, -1), expect, "sequence check");
   }
 
   // first a basic sanity check [node-iterator-001]
   (function(){
      var root = resetContent();
      var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
-					  testNodeFilter, false);
+					  testNodeFilter);
 
      checkseq(it, root, 'A B C D E F G H I');
      it.nextNode();
      checkseq(it, root, '[A] * B C D E F G H I');
      it.previousNode();
      checkseq(it, root, '* [A] B C D E F G H I');
      it.previousNode();
      checkseq(it, root, '* [A] B C D E F G H I');
   })();
 
   // Mutations that should not move the iterator [node-iterator-002]
   (function(){
      var root = resetContent();
      var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
-					  testNodeFilter, false);
+					  testNodeFilter);
 
      for (var i = 0; i < 4; i++)
        it.nextNode();
      checkseq(it, root, 'A B C [D] * E F G H I');
 
      root.removeChild($('E'));
      checkseq(it, root, 'A B C [D] * F G H I');
 
@@ -97,16 +97,16 @@
   })();
 
   // 002 complete
 
   /* Template
   (function(){
      var root = resetContent();
      var it = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
-					  testNodeFilter, false);
+					  testNodeFilter);
 
   })();
   */
 </script>
 </pre>
 </body>
 </html>
--- a/content/base/test/test_NodeIterator_mutations_3.html
+++ b/content/base/test/test_NodeIterator_mutations_3.html
@@ -16,17 +16,17 @@
   }
   var initInner = $('content').innerHTML;
   var content = $('content');
   
 
   function resetContent() {
     content.innerHTML = initInner;
     var checkIt = document.createNodeIterator(content, NodeFilter.SHOW_ELEMENT,
-					      testNodeFilter, false);
+					      testNodeFilter);
     var node;
     while ((node = checkIt.nextNode()) != null) {
       if (node.id) {
         window[node.id] = node;
       }
     }
   }
 
@@ -39,17 +39,17 @@
   function testNodeFilter(n) {
     if (n.tagName == 'SPAN')
       return NodeFilter.FILTER_ACCEPT;
     return NodeFilter.FILTER_SKIP;
   }
 
   function checkseq(it, root, expect) {
     var checkIt = document.createNodeIterator(root, NodeFilter.SHOW_ELEMENT,
-					      testNodeFilter, false);
+					      testNodeFilter);
     var printedPointer = (it.referenceNode == undefined);
     var string = '';
     var node;
     while ((node = checkIt.nextNode()) != null) {
       if (!printedPointer && it.referenceNode == node) {
         printedPointer = true;
 	var s = '[' + node.id + '] ';
           if (it.pointerBeforeReferenceNode)
@@ -60,17 +60,17 @@
         string += node.id + " ";
       }
     }
     is(string.slice(0, -1), expect, "sequence check");
   }
 
   resetContent();
   var it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
-                                       testNodeFilter, false);
+                                       testNodeFilter);
   checkseq(it, root, "root B C D * [E] E1 E11");
 
   removeNode(C);
   checkseq(it, root, "root B D * [E] E1 E11");
 
   it.nextNode();
   removeNode(D);
   checkseq(it, root, "root B [E] * E1 E11");
@@ -89,17 +89,17 @@
   it.previousNode();
   it.previousNode();
   it.previousNode();
   it.previousNode();
   checkseq(it, root, "root * [E] E1 E11");
 
   resetContent();
   it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
-                                   testNodeFilter, false);
+                                   testNodeFilter);
   checkseq(it, root, "root B C D * [E] E1 E11");
 
   it.nextNode();
   it.nextNode();
   checkseq(it, root, "root B C D E [E1] * E11");
 
   it.previousNode();
   it.previousNode();
@@ -114,17 +114,17 @@
   checkseq(it, root, "root C n * [E] E1 E11");
 
   n2 = makeSpan('n2');
   root.insertBefore(n2, C);
   checkseq(it, root, "root n2 C n * [E] E1 E11");
 
   resetContent();
   it = document.createNodeIterator(E, NodeFilter.SHOW_ELEMENT,
-                                   testNodeFilter, false);
+                                   testNodeFilter);
   checkseq(it, root, "root B C D * [E] E1 E11");
 
   removeNode(root);
   checkseq(it, root, "root B C D * [E] E1 E11");
 
   removeNode(B);
   checkseq(it, root, "root C D * [E] E1 E11");
 
--- a/content/base/test/test_bug559526.html
+++ b/content/base/test/test_bug559526.html
@@ -50,18 +50,17 @@ function filter(node) {
   return NodeFilter.FILTER_ACCEPT;
 }
 
 (function testNodeIterator() {
 
   it = document.createNodeIterator(
     document.getElementById("nodes"),
     NodeFilter.SHOW_ELEMENT,
-    filter,
-    false
+    filter
   );
   while (it.nextNode());
 })();
 
 (function testTreeWalker() {
   it = document.createTreeWalker(
     document.getElementById("nodes"),
     NodeFilter.SHOW_ELEMENT,
--- a/dom/imptests/failures/webapps/DOMCore/tests/approved/test_interfaces.html.json
+++ b/dom/imptests/failures/webapps/DOMCore/tests/approved/test_interfaces.html.json
@@ -134,17 +134,17 @@
   "NodeIterator interface: existence and properties of interface object": true,
   "NodeIterator interface: existence and properties of interface prototype object": true,
   "NodeIterator interface: existence and properties of interface prototype object's \"constructor\" property": true,
   "NodeIterator interface: attribute root": true,
   "NodeIterator interface: attribute referenceNode": true,
   "NodeIterator interface: attribute pointerBeforeReferenceNode": true,
   "NodeIterator interface: attribute whatToShow": true,
   "NodeIterator interface: attribute filter": true,
-  "Stringification of document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null, false)": "debug",
+  "Stringification of document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null)": "debug",
   "TreeWalker interface: existence and properties of interface object": true,
   "TreeWalker interface: existence and properties of interface prototype object": true,
   "TreeWalker interface: existence and properties of interface prototype object's \"constructor\" property": true,
   "TreeWalker interface: attribute root": true,
   "TreeWalker interface: attribute whatToShow": true,
   "TreeWalker interface: attribute filter": true,
   "TreeWalker interface: attribute currentNode": true,
   "Stringification of document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null)": "debug",
--- a/dom/imptests/webapps/DOMCore/tests/approved/test_interfaces.html
+++ b/dom/imptests/webapps/DOMCore/tests/approved/test_interfaces.html
@@ -504,16 +504,16 @@ idlArray.add_objects({
 	DocumentFragment: ['document.createDocumentFragment()'],
 	DocumentType: ['document.doctype'],
 	Element: ['element'],
 	Attr: ['document.querySelector("[id]").attributes[0]'],
 	Text: ['document.createTextNode("abc")'],
 	ProcessingInstruction: ['xmlDoc.createProcessingInstruction("abc", "def")'],
 	Comment: ['document.createComment("abc")'],
 	Range: ['document.createRange()', 'detachedRange'],
-	NodeIterator: ['document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null, false)'],
+	NodeIterator: ['document.createNodeIterator(document.body, NodeFilter.SHOW_ALL, null)'],
 	TreeWalker: ['document.createTreeWalker(document.body, NodeFilter.SHOW_ALL, null)'],
 	NodeList: ['document.querySelectorAll("script")'],
 	HTMLCollection: ['document.body.children'],
 	DOMTokenList: ['document.body.classList'],
 });
 idlArray.test();
 </script>
--- a/js/xpconnect/tests/mochitest/test_bug446584.html
+++ b/js/xpconnect/tests/mochitest/test_bug446584.html
@@ -18,18 +18,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 446584 **/
 
 function test(val) {
   try {
     document.createNodeIterator(document.body,
                                 NodeFilter.SHOW_ALL,
-                                function() { throw val },
-                                true).nextNode();
+                                function() { throw val }).nextNode();
     ok(false, "NodeIterator::nextNode() should have thrown an exception.");
   } catch (ex) {
     ok(val === ex, "NodeIterator did not properly forward exception " +
        val + " of type " + typeof val + ".  Thrown value was " + ex + ".");
   }
 }
 
 test(0);
--- a/js/xpconnect/tests/mochitest/test_bug502959.html
+++ b/js/xpconnect/tests/mochitest/test_bug502959.html
@@ -18,17 +18,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script type="application/javascript">
 
 /** Test for Bug 502959 **/
 // Whatever you do don't use the word "wrapped" in this function.
 function foo() {
   ok(true, "Able to call the function");
 }
 
-var iter = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, foo, false);
+var iter = document.createNodeIterator(document, NodeFilter.SHOW_ELEMENT, foo);
 var doublewrapped = iter.filter;
 
 ok(doublewrapped.toString().indexOf("wrapped") > 0, "got a double-wrapped object back");
 
 (function () {
     netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
     Components.utils.forceGC();
 })();
--- a/mobile/xul/chrome/content/browser.js
+++ b/mobile/xul/chrome/content/browser.js
@@ -2705,17 +2705,17 @@ function importDialog(aParent, aSrc, aAr
   let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance();
   xhr.open("GET", aSrc, false);
   xhr.overrideMimeType("text/xml");
   xhr.send(null);
   if (!xhr.responseXML)
     return null;
 
   let currentNode;
-  let nodeIterator = xhr.responseXML.createNodeIterator(xhr.responseXML, NodeFilter.SHOW_TEXT, null, false);
+  let nodeIterator = xhr.responseXML.createNodeIterator(xhr.responseXML, NodeFilter.SHOW_TEXT, null);
   while (currentNode = nodeIterator.nextNode()) {
     let trimmed = currentNode.nodeValue.replace(/^\s\s*/, "").replace(/\s\s*$/, "");
     if (!trimmed.length)
       currentNode.parentNode.removeChild(currentNode);
   }
 
   let doc = xhr.responseXML.documentElement;