<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[167368] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/167368">167368</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-04-16 11:49:39 -0700 (Wed, 16 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>DataTransfer should cache its FileList
https://bugs.webkit.org/show_bug.cgi?id=131694

Reviewed by Darin Adler.

Source/WebCore:
Test: fast/events/data-transfer-files-attribute-identity.html

* bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal):
Switched to a new FileList constructor, CloneDeserializer doesn't really need to modify
the FileList with append().

* dom/DataTransfer.h:
* dom/DataTransfer.cpp:
(WebCore::DataTransfer::types): Added a FIXME.
(WebCore::DataTransfer::files): Changed to reuse a cached FileList. It's currently
easy, because we don't support DataTransferItemList. Once we do, making any changes
through it will also require updating the FileList in a way that doesn't replace
File objects for unchanged files.

* fileapi/FileList.h:
(WebCore::FileList::create):
(WebCore::FileList::isEmpty):
(WebCore::FileList::FileList):
(WebCore::FileList::append):
(WebCore::FileList::clear):
Made non-const functions private, because neither DataTransfer nor FileInputType
expect the list to be modified without their knowledge. Added a new Vector based
constructor so that a FileList could be created without the use of append().

* html/FileInputType.cpp: (WebCore::FileInputType::createFileList): Simplified
the code a little bit. FileInputType still needs to modify the list for clear(),
but doesn't need to add to it dynamically - unlike with DataTransfer, it's expected
to create a new FileList when it's modified.

LayoutTests:
* fast/events/data-transfer-files-attribute-identity-expected.txt: Added.
* fast/events/data-transfer-files-attribute-identity.html: Added.

* platform/wk2/TestExpectations: Skipped the test, because WKTR doesn't support
file dragging yet.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsplatformwk2TestExpectations">trunk/LayoutTests/platform/wk2/TestExpectations</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsSerializedScriptValuecpp">trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDataTransfercpp">trunk/Source/WebCore/dom/DataTransfer.cpp</a></li>
<li><a href="#trunkSourceWebCoredomDataTransferh">trunk/Source/WebCore/dom/DataTransfer.h</a></li>
<li><a href="#trunkSourceWebCorefileapiFileListh">trunk/Source/WebCore/fileapi/FileList.h</a></li>
<li><a href="#trunkSourceWebCorehtmlFileInputTypecpp">trunk/Source/WebCore/html/FileInputType.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfasteventsdatatransferfilesattributeidentityexpectedtxt">trunk/LayoutTests/fast/events/data-transfer-files-attribute-identity-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfasteventsdatatransferfilesattributeidentityhtml">trunk/LayoutTests/fast/events/data-transfer-files-attribute-identity.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (167367 => 167368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-04-16 18:32:18 UTC (rev 167367)
+++ trunk/LayoutTests/ChangeLog        2014-04-16 18:49:39 UTC (rev 167368)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2014-04-16  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        DataTransfer should cache its FileList
+        https://bugs.webkit.org/show_bug.cgi?id=131694
+
+        Reviewed by Darin Adler.
+
+        * fast/events/data-transfer-files-attribute-identity-expected.txt: Added.
+        * fast/events/data-transfer-files-attribute-identity.html: Added.
+
+        * platform/wk2/TestExpectations: Skipped the test, because WKTR doesn't support
+        file dragging yet.
+
</ins><span class="cx"> 2014-04-16  Zoltan Horvath  &lt;zoltan@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove fast/parser/parser-yield-timing.html from skipped list
</span></span></pre></div>
<a id="trunkLayoutTestsfasteventsdatatransferfilesattributeidentityexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/data-transfer-files-attribute-identity-expected.txt (0 => 167368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/data-transfer-files-attribute-identity-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/events/data-transfer-files-attribute-identity-expected.txt        2014-04-16 18:49:39 UTC (rev 167368)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+
+Test that the same object is returned for dataTransfer.files each time, as well as for File objects in the FileList.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS event.dataTransfer.files is event.dataTransfer.files
+PASS event.dataTransfer.files.item(0) is event.dataTransfer.files.item(0)
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfasteventsdatatransferfilesattributeidentityhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/events/data-transfer-files-attribute-identity.html (0 => 167368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/events/data-transfer-files-attribute-identity.html                                (rev 0)
+++ trunk/LayoutTests/fast/events/data-transfer-files-attribute-identity.html        2014-04-16 18:49:39 UTC (rev 167368)
</span><span class="lines">@@ -0,0 +1,34 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;meta charset=&quot;utf-8&quot;&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;input type=&quot;file&quot; ondrop=&quot;dropped(event)&quot;&gt;&lt;/input&gt;
+&lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+
+description(&quot;Test that the same object is returned for dataTransfer.files each time, as well as for File objects in the FileList.&quot;);
+
+function runTest()
+{
+    var inputElement = document.getElementsByTagName('input')[0];
+    eventSender.beginDragWithFiles(['test.txt']);
+    eventSender.mouseMoveTo(inputElement.offsetLeft + inputElement.offsetWidth / 2,
+                            inputElement.offsetTop + inputElement.offsetHeight / 2);
+    eventSender.mouseUp();
+}
+
+function dropped(event)
+{
+    shouldBe(&quot;event.dataTransfer.files&quot;, &quot;event.dataTransfer.files&quot;);
+    shouldBe(&quot;event.dataTransfer.files.item(0)&quot;, &quot;event.dataTransfer.files.item(0)&quot;);
+}
+
+runTest();
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformwk2TestExpectations"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/wk2/TestExpectations (167367 => 167368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/wk2/TestExpectations        2014-04-16 18:32:18 UTC (rev 167367)
+++ trunk/LayoutTests/platform/wk2/TestExpectations        2014-04-16 18:49:39 UTC (rev 167368)
</span><span class="lines">@@ -645,6 +645,7 @@
</span><span class="cx"> editing/pasteboard/file-drag-to-editable.html
</span><span class="cx"> editing/pasteboard/file-input-files-access.html
</span><span class="cx"> fast/dom/Window/window-postmessage-clone-frames.html
</span><ins>+fast/events/data-transfer-files-attribute-identity.html
</ins><span class="cx"> fast/events/drag-file-crash.html
</span><span class="cx"> fast/events/drag-to-navigate.html
</span><span class="cx"> fast/events/drop-handler-should-not-stop-navigate.html
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167367 => 167368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-16 18:32:18 UTC (rev 167367)
+++ trunk/Source/WebCore/ChangeLog        2014-04-16 18:49:39 UTC (rev 167368)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2014-04-16  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        DataTransfer should cache its FileList
+        https://bugs.webkit.org/show_bug.cgi?id=131694
+
+        Reviewed by Darin Adler.
+
+        Test: fast/events/data-transfer-files-attribute-identity.html
+
+        * bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::readTerminal):
+        Switched to a new FileList constructor, CloneDeserializer doesn't really need to modify
+        the FileList with append().
+
+        * dom/DataTransfer.h:
+        * dom/DataTransfer.cpp:
+        (WebCore::DataTransfer::types): Added a FIXME.
+        (WebCore::DataTransfer::files): Changed to reuse a cached FileList. It's currently
+        easy, because we don't support DataTransferItemList. Once we do, making any changes
+        through it will also require updating the FileList in a way that doesn't replace
+        File objects for unchanged files.
+
+        * fileapi/FileList.h:
+        (WebCore::FileList::create):
+        (WebCore::FileList::isEmpty):
+        (WebCore::FileList::FileList):
+        (WebCore::FileList::append):
+        (WebCore::FileList::clear):
+        Made non-const functions private, because neither DataTransfer nor FileInputType
+        expect the list to be modified without their knowledge. Added a new Vector based
+        constructor so that a FileList could be created without the use of append().
+
+        * html/FileInputType.cpp: (WebCore::FileInputType::createFileList): Simplified
+        the code a little bit. FileInputType still needs to modify the list for clear(),
+        but doesn't need to add to it dynamically - unlike with DataTransfer, it's expected
+        to create a new FileList when it's modified.
+
</ins><span class="cx"> 2014-04-15  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Win] Eliminate use of deleteAllValues in Windows Files
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsSerializedScriptValuecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp (167367 => 167368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2014-04-16 18:32:18 UTC (rev 167367)
+++ trunk/Source/WebCore/bindings/js/SerializedScriptValue.cpp        2014-04-16 18:49:39 UTC (rev 167368)
</span><span class="lines">@@ -2184,17 +2184,17 @@
</span><span class="cx">             unsigned length = 0;
</span><span class="cx">             if (!read(length))
</span><span class="cx">                 return JSValue();
</span><del>-            RefPtr&lt;FileList&gt; result = FileList::create();
</del><ins>+            Vector&lt;RefPtr&lt;File&gt;&gt; files;
</ins><span class="cx">             for (unsigned i = 0; i &lt; length; i++) {
</span><span class="cx">                 RefPtr&lt;File&gt; file;
</span><span class="cx">                 if (!readFile(file))
</span><span class="cx">                     return JSValue();
</span><span class="cx">                 if (m_isDOMGlobalObject)
</span><del>-                    result-&gt;append(file.get());
</del><ins>+                    files.append(std::move(file));
</ins><span class="cx">             }
</span><span class="cx">             if (!m_isDOMGlobalObject)
</span><span class="cx">                 return jsNull();
</span><del>-            return getJSValue(result.get());
</del><ins>+            return getJSValue(FileList::create(std::move(files)).get());
</ins><span class="cx">         }
</span><span class="cx">         case ImageDataTag: {
</span><span class="cx">             int32_t width;
</span></span></pre></div>
<a id="trunkSourceWebCoredomDataTransfercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DataTransfer.cpp (167367 => 167368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DataTransfer.cpp        2014-04-16 18:32:18 UTC (rev 167367)
+++ trunk/Source/WebCore/dom/DataTransfer.cpp        2014-04-16 18:49:39 UTC (rev 167368)
</span><span class="lines">@@ -151,31 +151,37 @@
</span><span class="cx"> 
</span><span class="cx"> Vector&lt;String&gt; DataTransfer::types() const
</span><span class="cx"> {
</span><ins>+    // FIXME: Per HTML5, types should be a live array, and the DOM attribute should always return the same object.
+
</ins><span class="cx">     if (!canReadTypes())
</span><span class="cx">         return Vector&lt;String&gt;();
</span><span class="cx"> 
</span><span class="cx">     return m_pasteboard-&gt;types();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;FileList&gt; DataTransfer::files() const
</del><ins>+FileList* DataTransfer::files() const
</ins><span class="cx"> {
</span><del>-    // FIXME: We could cache the computed file list if it was necessary and helpful.
-    // Currently, each access gets a new copy, and thus setData() modifications to the
-    // dataTransfer are not reflected in any FileList objects the page has accessed and stored.
</del><ins>+    bool newlyCreatedFileList = !m_fileList;
+    if (!m_fileList)
+        m_fileList = FileList::create();
</ins><span class="cx"> 
</span><del>-    if (!canReadData())
-        return FileList::create();
</del><ins>+    if (!canReadData()) {
+        m_fileList-&gt;clear();
+        return m_fileList.get();
+    }
</ins><span class="cx"> 
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><del>-    if (m_forDrag &amp;&amp; !m_forFileDrag)
-        return FileList::create();
</del><ins>+    if (m_forDrag &amp;&amp; !m_forFileDrag) {
+        ASSERT(m_fileList-&gt;isEmpty());
+        return m_fileList.get();
+    }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    Vector&lt;String&gt; filenames = m_pasteboard-&gt;readFilenames();
-    RefPtr&lt;FileList&gt; fileList = FileList::create();
-    for (size_t i = 0; i &lt; filenames.size(); ++i)
-        fileList-&gt;append(File::create(filenames[i], File::AllContentTypes));
-    return fileList.release();
</del><ins>+    if (newlyCreatedFileList) {
+        for (const String&amp; filename : m_pasteboard-&gt;readFilenames())
+            m_fileList-&gt;append(File::create(filename, File::AllContentTypes));
+    }
+    return m_fileList.get();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if !ENABLE(DRAG_SUPPORT)
</span></span></pre></div>
<a id="trunkSourceWebCoredomDataTransferh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/DataTransfer.h (167367 => 167368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/DataTransfer.h        2014-04-16 18:32:18 UTC (rev 167367)
+++ trunk/Source/WebCore/dom/DataTransfer.h        2014-04-16 18:49:39 UTC (rev 167368)
</span><span class="lines">@@ -56,7 +56,7 @@
</span><span class="cx"> 
</span><span class="cx">         Vector&lt;String&gt; types() const;
</span><span class="cx"> 
</span><del>-        PassRefPtr&lt;FileList&gt; files() const;
</del><ins>+        FileList* files() const;
</ins><span class="cx"> 
</span><span class="cx">         void clearData(const String&amp; type);
</span><span class="cx">         void clearData();
</span><span class="lines">@@ -105,6 +105,8 @@
</span><span class="cx">         DataTransferAccessPolicy m_policy;
</span><span class="cx">         OwnPtr&lt;Pasteboard&gt; m_pasteboard;
</span><span class="cx"> 
</span><ins>+        mutable RefPtr&lt;FileList&gt; m_fileList;
+
</ins><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="cx">         bool m_forDrag;
</span><span class="cx">         bool m_forFileDrag;
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiFileListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/FileList.h (167367 => 167368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/FileList.h        2014-04-16 18:32:18 UTC (rev 167367)
+++ trunk/Source/WebCore/fileapi/FileList.h        2014-04-16 18:49:39 UTC (rev 167368)
</span><span class="lines">@@ -42,17 +42,27 @@
</span><span class="cx">         return adoptRef(new FileList);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    static PassRefPtr&lt;FileList&gt; create(Vector&lt;RefPtr&lt;File&gt;&gt;&amp;&amp; files)
+    {
+        return adoptRef(new FileList(std::move(files)));
+    }
+
</ins><span class="cx">     unsigned length() const { return m_files.size(); }
</span><span class="cx">     File* item(unsigned index) const;
</span><span class="cx"> 
</span><span class="cx">     bool isEmpty() const { return m_files.isEmpty(); }
</span><del>-    void clear() { m_files.clear(); }
-    void append(PassRefPtr&lt;File&gt; file) { m_files.append(file); }
</del><span class="cx">     Vector&lt;String&gt; paths() const;
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     FileList();
</span><ins>+    FileList(Vector&lt;RefPtr&lt;File&gt;&gt;&amp;&amp; files) : m_files(files) { }
</ins><span class="cx"> 
</span><ins>+    // FileLists can only be changed by their owners.
+    friend class DataTransfer;
+    friend class FileInputType;
+    void append(PassRefPtr&lt;File&gt; file) { m_files.append(file); }
+    void clear() { m_files.clear(); }
+
</ins><span class="cx">     Vector&lt;RefPtr&lt;File&gt;&gt; m_files;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlFileInputTypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/FileInputType.cpp (167367 => 167368)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/FileInputType.cpp        2014-04-16 18:32:18 UTC (rev 167367)
+++ trunk/Source/WebCore/html/FileInputType.cpp        2014-04-16 18:49:39 UTC (rev 167368)
</span><span class="lines">@@ -256,6 +256,7 @@
</span><span class="cx"> 
</span><span class="cx"> void FileInputType::setValue(const String&amp;, bool, TextFieldEventBehavior)
</span><span class="cx"> {
</span><ins>+    // FIXME: Should we clear the file list, or replace it with a new empty one here? This is observable from JavaScript through custom properties.
</ins><span class="cx">     m_fileList-&gt;clear();
</span><span class="cx">     m_icon.clear();
</span><span class="cx">     element().setNeedsStyleRecalc();
</span><span class="lines">@@ -263,12 +264,11 @@
</span><span class="cx"> 
</span><span class="cx"> PassRefPtr&lt;FileList&gt; FileInputType::createFileList(const Vector&lt;FileChooserFileInfo&gt;&amp; files) const
</span><span class="cx"> {
</span><del>-    RefPtr&lt;FileList&gt; fileList(FileList::create());
-    size_t size = files.size();
</del><ins>+    Vector&lt;RefPtr&lt;File&gt;&gt; fileObjects;
+    for (const FileChooserFileInfo&amp; info : files)
+        fileObjects.append(File::createWithName(info.path, info.displayName, File::AllContentTypes));
</ins><span class="cx"> 
</span><del>-    for (size_t i = 0; i &lt; size; i++)
-        fileList-&gt;append(File::createWithName(files[i].path, files[i].displayName, File::AllContentTypes));
-    return fileList;
</del><ins>+    return FileList::create(std::move(fileObjects));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool FileInputType::isFileUpload() const
</span></span></pre>
</div>
</div>

</body>
</html>