Bug 796805 - Permanent orange: TEST-UNEXPECTED-FAIL | test_iteratorUtils.js | TypeError: childArray is null, r=Standard8.
authorFlorian Quèze <florian@queze.net>
Tue, 02 Oct 2012 14:28:39 +0200
changeset 13781 86bb281789650b8bcea73db07316f580e3d752cd
parent 13780 95ecbcca7df64a50d2ad45c26a665e25f09e9408
child 13782 668d41ad7b03d77652b910594ca8653f22d4df07
push id762
push userbugzilla@standard8.plus.com
push dateMon, 19 Nov 2012 21:16:42 +0000
treeherdercomm-beta@4a2f61509b17 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersStandard8
bugs796805
Bug 796805 - Permanent orange: TEST-UNEXPECTED-FAIL | test_iteratorUtils.js | TypeError: childArray is null, r=Standard8.
mailnews/base/util/iteratorUtils.jsm
--- a/mailnews/base/util/iteratorUtils.jsm
+++ b/mailnews/base/util/iteratorUtils.jsm
@@ -23,24 +23,24 @@ let Ci = Components.interfaces;
  *                      values
  */
 function toArray(aObj, aUseKeys) {
   // - The Iterator object seems to be per-scope, so use a string-based check.
   //   We use indexOf because the constructor toString returns a function dump,
   //   which we don't actually care about.
   // - Not all iterators are instances of Iterator, so additionally use a
   //   duck-typing test.
-  if ((aObj.constructor.toString().indexOf("Iterator") != -1) 
-      || ("__iterator__" in aObj)) {
+  let constructor = aObj.constructor.toString();
+  if (constructor.contains("Iterator") || ("__iterator__" in aObj)) {
     if (aUseKeys) {
       return [ a for (a in aObj) ];
     } else {
       return [ a for each (a in aObj) ];
     }
-  } else if (aObj.constructor.toString() == "[object NodeList]") {
+  } else if (constructor.contains("NodeList")) {
     // aUseKeys doesn't make sense in this case, always return the values.
     return Array.slice(aObj);
   }
 
   return null;
 }
 
 /**