2010-07-22 John Gregg <johnnyg@google.com>
authorjohnnyg@google.com <johnnyg@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Jul 2010 21:26:55 +0000 (21:26 +0000)
committerjohnnyg@google.com <johnnyg@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 22 Jul 2010 21:26:55 +0000 (21:26 +0000)
        Reviewed by Kent Tamura.

        [chromium] fast/forms/input-file-directory-upload.html fails on win after r63454
        https://bugs.webkit.org/show_bug.cgi?id=42768

        Normalize path separators for the script API by convering \'s to /'s.

        Covered by input-file-directory-upload.html

        * html/HTMLInputElement.cpp:
        (WebCore::HTMLInputElement::setFileListFromRenderer):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@63914 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/html/HTMLInputElement.cpp

index 081a618..763d569 100644 (file)
@@ -1,3 +1,17 @@
+2010-07-22  John Gregg  <johnnyg@google.com>
+
+        Reviewed by Kent Tamura.
+
+        [chromium] fast/forms/input-file-directory-upload.html fails on win after r63454
+        https://bugs.webkit.org/show_bug.cgi?id=42768
+
+        Normalize path separators for the script API by convering \'s to /'s.
+
+        Covered by input-file-directory-upload.html
+
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setFileListFromRenderer):
+
 2010-07-22  Dmitry Titov  <dimich@chromium.org>
 
         Rubberstamped by Simon Fraser.
index 3df3544..00dc503 100644 (file)
@@ -1996,8 +1996,11 @@ void HTMLInputElement::setFileListFromRenderer(const Vector<String>& paths)
         }
         rootPath = directoryName(rootPath);
         ASSERT(rootPath.length());
-        for (int i = 0; i < size; i++)
-            m_fileList->append(File::create(paths[i].substring(1 + rootPath.length()), paths[i]));
+        for (int i = 0; i < size; i++) {
+            // Normalize backslashes to slashes before exposing the relative path to script.
+            String relativePath = paths[i].substring(1 + rootPath.length()).replace('\\','/');
+            m_fileList->append(File::create(relativePath, paths[i]));
+        }
     } else {
         for (int i = 0; i < size; i++)
             m_fileList->append(File::create(paths[i]));