53 const Ci = Components.interfaces;
54 const Cr = Components.results;
62 this._itemsList = aItemsList;
63 this._iteratorPosition = 0;
68 return (this._iteratorPosition < this._itemsList.length);
72 getNext:
function getNext() {
74 throw Components.results.NS_ERROR_FAILURE;
76 var type = this._itemsList[this._iteratorPosition];
77 this._iteratorPosition++;
84 if (aIID.equals(
Ci.nsISimpleEnumerator) ||
85 aIID.equals(
Ci.nsISupports))
88 throw Components.results.NS_ERROR_NO_INTERFACE;
97 function StringEnumerator(aItemsList) {
98 this._itemsList = aItemsList;
99 this._iteratorPosition = 0;
101 StringEnumerator.prototype = {
104 return (this._iteratorPosition < this._itemsList.length);
108 getNext:
function getNext() {
110 throw Components.results.NS_ERROR_FAILURE;
112 var type = this._itemsList[this._iteratorPosition];
113 this._iteratorPosition++;
120 if (aIID.equals(
Ci.nsIStringEnumerator) ||
121 aIID.equals(
Ci.nsISupports))
124 throw Components.results.NS_ERROR_NO_INTERFACE;
128 function NSArray(aItemsList) {
129 this._itemsList = aItemsList;
131 NSArray.prototype = {
134 return this._itemsList.length;
138 queryElementAt:
function queryElementAt(aIndex, aIID) {
139 if (aIndex > this.length - 1) {
140 throw Components.results.NS_ERROR_ILLEGAL_VALUE;
143 return this._itemsList[aIndex].QueryInterface(aIID);
148 for (var
i = aIndex;
i < this._itemsList.length;
i++) {
149 if (this._itemsList[
i] == aElement) {
153 throw Components.results.NS_ERROR_NOT_FOUND;
164 if (aIID.equals(
Ci.nsIArray) ||
165 aIID.equals(
Ci.nsISupports))
168 throw Components.results.NS_ERROR_NO_INTERFACE;
172 var ArrayConverter = {
180 JSArray:
function getJSArray(aObject) {
181 if (aObject instanceof
Ci.nsIArray) {
182 aObject = aObject.enumerate();
187 if (aObject instanceof
Ci.nsISimpleEnumerator) {
188 hasMore =
"hasMoreElements";
189 }
else if (aObject instanceof
Ci.nsIStringEnumerator ||
190 aObject instanceof
Ci.nsIUTF8StringEnumerator)
194 throw new Components.Exception(
"invalid object",
195 Cr.NS_ERROR_INVALID_ARG);
199 while (aObject[hasMore]()) {
200 array.push(aObject.getNext());
213 JSEnum:
function JSEnum(enumIn) {
214 if (enumIn instanceof
Ci.nsIArray) {
215 enumIn = enumIn.enumerate();
218 if (enumIn instanceof
Ci.nsISimpleEnumerator) {
220 __iterator__:
function() {
221 while(enumIn.hasMoreElements())
222 yield(enumIn.getNext());
226 else if (enumIn instanceof
Ci.nsIStringEnumerator) {
228 __iterator__:
function() {
229 while(enumIn.hasMore())
230 yield(enumIn.getNext());
242 nsIArray:
function get_nsIArray(aArray) {
243 return new NSArray(aArray);
251 enumerator:
function get_enumerator( aArray) {
252 if (aArray instanceof
Ci.nsIArray) {
253 return aArray.nsIArray.enumerate();
263 stringEnumerator:
function get_stringEnumerator( aArray) {
264 return new StringEnumerator(aArray);
272 xpcomArrayMethod:
function getXPCOMMethod(aArrayName) {
280 return function xpcomArray(
aCount) {
281 var array =
this[aArrayName];
282 aCount.value = array.length;
284 for (var
i = 0;
i < array.length;
i++) {
function enumerate(enumerator, func)
sbOSDControlService prototype QueryInterface
return elem filter &&elem filter indexOf("opacity=")>=0?(parseFloat(elem.filter.match(/opacity
function Enumerator(aItemsList)
SimpleArrayEnumerator prototype hasMoreElements
StringArrayEnumerator prototype hasMore
restoreHistoryPrecursor aCount
_getSelectedPageStyle s i