You attempted to invoke the Enumerator.prototype.atEnd, Enumerator.prototype.item, Enumerator.prototype.moveFirst, or Enumerator.prototype.moveNext method on an object of a type other than Enumerator. The object of this type of invocation must be of type Enumerator. Here is an example of code that breaks this rule:
var o = new Object; o.f = Enumerator.prototype.atEnd; o.f();
To correct this error
Only invoke the Enumerator.prototype.atEnd, Enumerator.prototype.item, Enumerator.prototype.moveFirst, or Enumerator.prototype.moveNext methods on objects of type Enumerator. To find out if your object is an Enumerator object, use:
if(x instanceof Enumerator)