Bug 45929 - Support generating a FormData object based on the data in an existing <form>
Summary: Support generating a FormData object based on the data in an existing <form>
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Jian Li
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-16 15:52 PDT by Jian Li
Modified: 2010-10-07 15:58 PDT (History)
3 users (show)

See Also:


Attachments
Proposed Patch (9.58 KB, patch)
2010-09-16 16:04 PDT, Jian Li
jianli: commit-queue-
Details | Formatted Diff | Diff
Proposed Patch (9.25 KB, patch)
2010-09-20 10:49 PDT, Jian Li
abarth: review+
jianli: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jian Li 2010-09-16 15:52:06 PDT
Support generating a FormData object based on the data in an existing <form>, like:
    new FormData(formDataElement)
Comment 1 Jian Li 2010-09-16 16:04:49 PDT
Created attachment 67855 [details]
Proposed Patch
Comment 2 Darin Fisher (:fishd, Google) 2010-09-19 22:13:48 PDT
Comment on attachment 67855 [details]
Proposed Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=67855&action=prettypatch

> WebCore/html/DOMFormData.cpp:45
> +    appendForm(form);

wouldn't having two separate constructors be cleaner?  then you wouldn't
need the form null check inside of appendForm.
Comment 3 Jian Li 2010-09-20 10:49:11 PDT
Created attachment 68110 [details]
Proposed Patch

Changed to have a separate constructor.
Comment 4 Adam Barth 2010-09-26 22:27:25 PDT
Comment on attachment 68110 [details]
Proposed Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=68110&action=review

Is this from some spec?

> WebCore/html/DOMFormData.cpp:50
> +    if (form)

Prefer early return.

> WebCore/html/DOMFormData.h:55
>      DOMFormData(const TextEncoding&);
> +    DOMFormData(HTMLFormElement*);

These need to be marked "explicit".
Comment 5 Jian Li 2010-10-06 17:19:34 PDT
(In reply to comment #4)
> (From update of attachment 68110 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=68110&action=review
> 
> Is this from some spec?
> 
Not yet. But it will be added to the XHR Level 2 spec soon since everyone seems to agree on this. FF is also adding this support.
Comment 6 Jian Li 2010-10-07 15:58:58 PDT
All fixed and landed at http://trac.webkit.org/changeset/69349.