Closed
Bug 1127703
Opened 10 years ago
Closed 9 years ago
Support iteration on FormData
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
FIXED
mozilla44
Tracking | Status | |
---|---|---|
firefox44 | --- | fixed |
People
(Reporter: nsm, Assigned: baku)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file, 3 obsolete files)
14.34 KB,
patch
|
Details | Diff | Splinter Review |
No description provided.
Updated•10 years ago
|
Keywords: dev-doc-needed
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8675708 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 2•9 years ago
|
||
Assignee: nobody → amarchesini
Attachment #8675708 -
Attachment is obsolete: true
Attachment #8675708 -
Flags: review?(bzbarsky)
Attachment #8675710 -
Flags: review?(bzbarsky)
Comment 3•9 years ago
|
||
Comment on attachment 8675710 [details] [diff] [review]
iterable2.patch
>+ if (tmp->mFormData[i].value.IsFile()) {
>+ ImplCycleCollectionUnlink(tmp->mFormData[i].value.GetAsFile());
How about:
ImplCycleCollectionUnlink(tmp->mFormData[i].value)
?
And similar in traverse. We codegen implementations of ImplCycleCollectionTraverse/ImplCycleCollectionUnlink for owning unions, precisely so you don't have to dig around inside them (especially important when they can have multiple refptr types).
>+ ImplCycleCollectionTraverse(cb,tmp->mFormData[i].value.GetAsFile(),
Missing space before "tmp".
>+ is(key.value, v.toString(), "Correct Key iterator: " + v.toString());
>+ ok(key.done, "key.done is false");
Should be ok(!key.done, "key.done should be false"), no?
>+ ok(value.done, "value.done is false");
>+ ok(entry.done, "entry.done is false");
And here.
>+++ b/xpcom/base/OwningNonNull.h
I guess it doesn't really hurt to add this, but I don't think it's really needed for this patch either...
r=me with the above fixed.
Attachment #8675710 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Comment 4•9 years ago
|
||
Attachment #8675710 -
Attachment is obsolete: true
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 5•9 years ago
|
||
Keywords: checkin-needed
Backed out for build bustage: https://treeherder.mozilla.org/logviewer.html#?job_id=15869511&repo=mozilla-inbound
https://hg.mozilla.org/integration/mozilla-inbound/rev/5f2853528bbf
Flags: needinfo?(amarchesini)
Backed out again in https://hg.mozilla.org/integration/mozilla-inbound/rev/d273e971464c for test_formsubmission failures:
https://treeherder.mozilla.org/logviewer.html#?job_id=15880296&repo=mozilla-inbound
Assignee | ||
Comment 9•9 years ago
|
||
Attachment #8675758 -
Attachment is obsolete: true
Flags: needinfo?(amarchesini)
Assignee | ||
Updated•9 years ago
|
Keywords: checkin-needed
Comment 10•9 years ago
|
||
Keywords: checkin-needed
Comment 11•9 years ago
|
||
backout bugherder merge |
Status: NEW → RESOLVED
Closed: 9 years ago
status-firefox44:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
Comment 12•9 years ago
|
||
Created:
https://developer.mozilla.org/en-US/docs/Web/API/FormData/values
https://developer.mozilla.org/en-US/docs/Web/API/FormData/keys
https://developer.mozilla.org/en-US/docs/Web/API/FormData/entries
I hope I have not forgotten a newly created method (first time we are documenting an iterator<> webidl value)
Updated:
https://developer.mozilla.org/en-US/docs/Web/API/FormData
and
https://developer.mozilla.org/en-US/Firefox/Releases/44#Miscellaneous
Keywords: dev-doc-needed → dev-doc-complete
Comment 13•9 years ago
|
||
Jean-Yves, it's not clear to me what the "In most cases, the use of the for...of statement is preferrable to access the key/value pairs." bits in those docs are meant to suggest/imply.
Are they trying to say that it's better to just for..of on the FormData object itself? Or on the iterators? Something else?
Similarly, it's not clear what "objects implementing this interface can be used in a for...of structure" means in <https://developer.mozilla.org/en-US/docs/Web/API/FormData>. Could probably use an example usage. Just like it might be good to have examples in the values/keys/entries pages of using for-of with the iterators there ("for (var key of formData.keys()) { /* etc */ }").
There will also be a forEach method here once bug 1216751 is fixed, but it's not there yet.
Comment 14•9 years ago
|
||
Thx. ni/ myself so I don't forget to come back to this (doing too many things in // right now ;-) )
Flags: needinfo?(jypenator)
Comment 15•9 years ago
|
||
So it happens that I didn't understood that I could directly use an iterator in for..of (which is rather obvious now, silly me!).
I fixed the three methods pages removing the sentence (that made no sense) and fixed the example to use for...of.
On FormData, I modified the sentence to explain that 'for (var pair of myFD)' is equivalent to 'for (var pair of myFD.entries())'.
I also added dev-doc-needed and a comment to bug 1216751 so that we don't forget add forEach() when it lands.
I updated our meta-documentation about how to document iterator<>: https://developer.mozilla.org/en-US/docs/MDN/Contribute/Howto/Write_an_API_reference/Information_contained_in_a_WebIDL_file#Pair_iterator
Flags: needinfo?(jypenator)
Comment 16•9 years ago
|
||
Thank you! That meta-documentation is pretty awesome, by the way.
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•