Bug 1484496: Follow-up: Fix more busted JS enumerators. r=bustage CLOSED TREE

--HG--
extra : amend_source : b6753494cab68add325af09442239e72ea0c4501
This commit is contained in:
Kris Maglione 2018-08-24 17:10:29 -07:00
parent a093c19492
commit 8ad0bfd9c0
3 changed files with 15 additions and 0 deletions

View file

@ -253,6 +253,9 @@ FilePicker.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),
mFiles: files,
mIndex: 0,
[Symbol.iterator]() {
return this.mFiles.values();
},
hasMoreElements: function() {
return (this.mIndex < this.mFiles.length);
},

View file

@ -873,6 +873,14 @@ FilePickerDelegate.prototype = {
QueryInterface: ChromeUtils.generateQI([Ci.nsISimpleEnumerator]),
_owner: this,
_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() {
return this._index < this._owner._files.length;
},

View file

@ -829,6 +829,10 @@ ArrayEnumerator.prototype = {
_index: 0,
_contents: [],
[Symbol.iterator]() {
return this._contents.values();
},
hasMoreElements: function ArrayEnumerator_hasMoreElements() {
return this._index < this._contents.length;
},