Skip to main content

Posts

Showing posts with the label deep copy

Thunderbird or Firefox extension - nsISimpleEnumerator

Issue :  Some of the Firefox or Mozilla application extension API s return  an enumerator object of type interface nsISimpleEnumerator ,  that result objects can not be used in a global scope and can not do iteration through the  list more than one time.   Cause: nsISimpleEnumerator  interface has only two methods hasMoreElements() getNext()   - There is no way to reset this enumerator to the first position once it is iterated through once. Like in this example given in Mozilla developer example page,  ( https://developer.mozilla.org/en-US/docs/Using_nsISimpleEnumerator )   var enumerator = document.getElementById('aStringBundleID').strings; var s = ""; while (enumerator.hasMoreElements()) { var property = enumerator.getNext().QueryInterface(Components.interfaces.nsIProperty); s += property.name + ' = ' + property.value + ';\n'; } If you want to reuse the 'enumerator' object again, in another place another loop, this wil...