Skip to content

Commit

Permalink
Enable FormData being iterable
Browse files Browse the repository at this point in the history
Now that this is supported in webidl2js, we can use it here. Closes #1671. Tests submitted to web-platform-tests/wpt#5741, but not included here yet; we'll do a web-platform-tests roll soon.
  • Loading branch information
domenic committed May 1, 2017
1 parent 8d3f747 commit e3e4629
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions lib/jsdom/living/xhr/FormData-impl.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ exports.implementation = class FormDataImpl {
this._entries.push(entry);
}
}

* [Symbol.iterator]() {
for (const entry of this._entries) {
yield [entry.name, idlUtils.tryWrapperForImpl(entry.value)];
}
}
};

function createAnEntry(name, value, filename) {
Expand Down
2 changes: 1 addition & 1 deletion lib/jsdom/living/xhr/FormData.idl
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ interface FormData {
boolean has(USVString name);
// void set(USVString name, USVString value); // as above
void set(USVString name, Blob value, optional USVString filename);
// iterable<USVString, FormDataEntryValue>;
iterable<USVString, FormDataEntryValue>;
};
1 change: 1 addition & 0 deletions test/web-platform-tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ describe("Web Platform Tests", () => {
"XMLHttpRequest/event-upload-progress.htm",
"XMLHttpRequest/formdata-blob.htm",
"XMLHttpRequest/formdata-delete.htm",
"XMLHttpRequest/formdata-foreach.html",
"XMLHttpRequest/formdata-get.htm",
"XMLHttpRequest/formdata-has.htm",
"XMLHttpRequest/formdata-set.htm",
Expand Down

0 comments on commit e3e4629

Please sign in to comment.