Bug 63222 - Add a helper function to FileList to retrieve a list of filenames.
Summary: Add a helper function to FileList to retrieve a list of filenames.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Dimitri Glazkov (Google)
URL:
Keywords:
Depends on:
Blocks: 62069
  Show dependency treegraph
 
Reported: 2011-06-22 19:30 PDT by Dimitri Glazkov (Google)
Modified: 2011-06-24 20:55 PDT (History)
3 users (show)

See Also:


Attachments
Patch (4.20 KB, patch)
2011-06-22 19:32 PDT, Dimitri Glazkov (Google)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitri Glazkov (Google) 2011-06-22 19:30:54 PDT
Add a helper function to FileList to retrieve a list of filenames.
Comment 1 Dimitri Glazkov (Google) 2011-06-22 19:32:17 PDT
Created attachment 98297 [details]
Patch
Comment 2 Kent Tamura 2011-06-22 19:37:09 PDT
Comment on attachment 98297 [details]
Patch

ok
Comment 3 WebKit Review Bot 2011-06-22 20:08:11 PDT
Comment on attachment 98297 [details]
Patch

Clearing flags on attachment: 98297

Committed r89523: <http://trac.webkit.org/changeset/89523>
Comment 4 WebKit Review Bot 2011-06-22 20:08:15 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Alexey Proskuryakov 2011-06-23 00:58:57 PDT
+Vector<String> FileList::filenames() const
+{
+    Vector<String> filenames;
+    for (unsigned i = 0; i < m_files.size(); ++i)
+        filenames.append(m_files[i]->path());

This function returns paths, so why is it called "filenames()"?
Comment 6 Dimitri Glazkov (Google) 2011-06-23 06:55:10 PDT
(In reply to comment #5)
> +Vector<String> FileList::filenames() const
> +{
> +    Vector<String> filenames;
> +    for (unsigned i = 0; i < m_files.size(); ++i)
> +        filenames.append(m_files[i]->path());
> 
> This function returns paths, so why is it called "filenames()"?

Oh, that's interesting. It seems there's a schism in how FileList is used in HTMLInputElement vs. File API. The File instances are populated from FileChoooser (http://codesearch.google.com/codesearch#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/rendering/RenderFileUploadControl.cpp&l=91), where they are definitely filenames. Then they are briefly called paths (http://codesearch.google.com/codesearch#OAMlx_jo-ck/src/third_party/WebKit/Source/WebCore/html/FileInputType.cpp&l=191), while remaining to be filenames. It seems that either File objects are not semantically well-formed, or I am totally misunderstanding the meaning of word "path".
Comment 7 Alexey Proskuryakov 2011-06-23 10:00:26 PDT
And there's also fakepath (see bug 29000).

Would be nice to clean this up.
Comment 8 Dimitri Glazkov (Google) 2011-06-23 10:50:38 PDT
(In reply to comment #7)
> And there's also fakepath (see bug 29000).
> 
> Would be nice to clean this up.

One thing we could do is just get rid of FileList altogether for managing input[type=file]. I don't think there's an actual need for that. WDYT?
Comment 9 Alexey Proskuryakov 2011-06-23 10:55:47 PDT
> WDYT?

I don't have anything wise to say :-)
Comment 10 Dimitri Glazkov (Google) 2011-06-24 20:55:29 PDT
(In reply to comment #9)
> > WDYT?
> 
> I don't have anything wise to say :-)

I looked at it and turns out there are good reasons for input->files() to be a FileList*. I'll just rename filenames to paths in FileList.