Add a helper function to FileList to retrieve a list of filenames.
Created attachment 98297 [details] Patch
Comment on attachment 98297 [details] Patch ok
Comment on attachment 98297 [details] Patch Clearing flags on attachment: 98297 Committed r89523: <http://trac.webkit.org/changeset/89523>
All reviewed patches have been landed. Closing bug.
+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()"?
(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".
And there's also fakepath (see bug 29000). Would be nice to clean this up.
(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?
> WDYT? I don't have anything wise to say :-)
(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.