Bug 69885 - Support passing optional filename when FormData.append() is used to append a blob
Summary: Support passing optional filename when FormData.append() is used to append a ...
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: 2011-10-11 17:15 PDT by Jian Li
Modified: 2011-10-12 10:45 PDT (History)
5 users (show)

See Also:


Attachments
Proposed Patch (14.59 KB, patch)
2011-10-11 17:20 PDT, Jian Li
jianli: commit-queue-
Details | Formatted Diff | Diff
Proposed Patch (14.65 KB, patch)
2011-10-11 17:26 PDT, Jian Li
levin: 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 2011-10-11 17:15:43 PDT
We need to support passing optional filename when FormData.append() is used to append a blob, per the latest XHR 2 spec:
  http://dev.w3.org/2006/webapi/XMLHttpRequest-2/#dom-formdata-append

When the append(name, value, filename) method is invoked, the user agent must create a new entry with the following parameters set and append it to the end of the collection the FormData object represents:

Set its name to name.
Set its value to value.
Set its type to "text" if value is a string and "file" if it is a Blob.
If its type is "file" set its filename to "blob".
If its type is "file" and value is a File whose name attribute is not the empty string, set entry's filename to the attribute's value.
If the filename parameter is not omitted set entry's filename to filename.
Comment 1 Jian Li 2011-10-11 17:20:55 PDT
Created attachment 110614 [details]
Proposed Patch
Comment 2 WebKit Review Bot 2011-10-11 17:24:06 PDT
Attachment 110614 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/http..." exit_code: 1

LayoutTests/ChangeLog:1:  ChangeLog entry has no bug number  [changelog/bugnumber] [5]
Total errors found: 1 in 13 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Jian Li 2011-10-11 17:26:35 PDT
Created attachment 110616 [details]
Proposed Patch
Comment 4 David Levin 2011-10-12 09:28:31 PDT
Comment on attachment 110616 [details]
Proposed Patch

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

Please consider adding that test.

> Source/WebCore/bindings/v8/custom/V8DOMFormDataCustom.cpp:78
> +            filename = toWebCoreStringWithNullCheck(args[2]);

It would be nice to add a test with null as the last arg. It looks like you added handling throughout the code for this but it seems untested.
Comment 5 Jian Li 2011-10-12 10:45:05 PDT
New test case added to cover null argument case.

Committed as http://trac.webkit.org/changeset/97274.