forked from mirrors/gecko-dev
Bug 1484496: Follow-up: Fix more busted JS enumerators. r=bustage CLOSED TREE
--HG-- extra : amend_source : b6753494cab68add325af09442239e72ea0c4501
This commit is contained in:
parent
a093c19492
commit
8ad0bfd9c0
3 changed files with 15 additions and 0 deletions
|
|
@ -253,6 +253,9 @@ FilePicker.prototype = {
|
||||||
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),
|
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),
|
||||||
mFiles: files,
|
mFiles: files,
|
||||||
mIndex: 0,
|
mIndex: 0,
|
||||||
|
[Symbol.iterator]() {
|
||||||
|
return this.mFiles.values();
|
||||||
|
},
|
||||||
hasMoreElements: function() {
|
hasMoreElements: function() {
|
||||||
return (this.mIndex < this.mFiles.length);
|
return (this.mIndex < this.mFiles.length);
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -873,6 +873,14 @@ FilePickerDelegate.prototype = {
|
||||||
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),
|
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),
|
||||||
_owner: this,
|
_owner: this,
|
||||||
_index: 0,
|
_index: 0,
|
||||||
|
* [Symbol.iterator]() {
|
||||||
|
for (let file of this._owner._files) {
|
||||||
|
if (aDOMFile) {
|
||||||
|
yield this._owner._getDOMFile(file);
|
||||||
|
}
|
||||||
|
yield new FileUtils.File(file);
|
||||||
|
}
|
||||||
|
},
|
||||||
hasMoreElements: function() {
|
hasMoreElements: function() {
|
||||||
return this._index < this._owner._files.length;
|
return this._index < this._owner._files.length;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -829,6 +829,10 @@ ArrayEnumerator.prototype = {
|
||||||
_index: 0,
|
_index: 0,
|
||||||
_contents: [],
|
_contents: [],
|
||||||
|
|
||||||
|
[Symbol.iterator]() {
|
||||||
|
return this._contents.values();
|
||||||
|
},
|
||||||
|
|
||||||
hasMoreElements: function ArrayEnumerator_hasMoreElements() {
|
hasMoreElements: function ArrayEnumerator_hasMoreElements() {
|
||||||
return this._index < this._contents.length;
|
return this._index < this._contents.length;
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue