Commit 63038daf authored by abarth@webkit.org's avatar abarth@webkit.org

2010-08-29 Adam Barth <abarth@webkit.org>

        Reviewed by Darin Adler.

        Implement HTML5's fakepath
        https://bugs.webkit.org/show_bug.cgi?id=29000

        Update expectations for this pasteboard test to include our new friend
        fakepath.

        * editing/pasteboard/file-input-files-access-expected.txt:
2010-08-29  Adam Barth  <abarth@webkit.org>

        Reviewed by Darin Adler.

        Implement HTML5's fakepath
        https://bugs.webkit.org/show_bug.cgi?id=29000

        The HTML 5 spec says to prepend C:\fakepath\ to the value of an
        <input type="file"> control, so that's what we do now.

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66343 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 7eda5f55
2010-08-29 Adam Barth <abarth@webkit.org>
Reviewed by Darin Adler.
Implement HTML5's fakepath
https://bugs.webkit.org/show_bug.cgi?id=29000
Update expectations for this pasteboard test to include our new friend
fakepath.
* editing/pasteboard/file-input-files-access-expected.txt:
2010-08-29 Mihai Parparita <mihaip@chromium.org>
Reviewed by Tony Chang.
......@@ -47812,4 +47824,4 @@
* platform/mac/editing/pasteboard/styled-element-markup-expected.checksum: Replaced.
* platform/mac/editing/pasteboard/styled-element-markup-expected.png: Replaced.
* platform/mac/editing/pasteboard/subframe-dragndrop-1-expected.che
svn
\ No newline at end of file
svn
......@@ -4,7 +4,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
Dragging a single (non-existant) file to a file input control:
PASS fileInput.value is "DRTFakeFile"
FAIL fileInput.value should be DRTFakeFile. Was C:\fakepath\DRTFakeFile.
PASS fileInput.files.length is 1
PASS fileInput.files[0].name is "DRTFakeFile"
PASS fileInput.files[0].type is ""
......@@ -12,7 +12,7 @@ PASS fileInput.files[0].size is 0
PASS fileInput.files[0].fileName is "DRTFakeFile"
PASS fileInput.files[0].fileSize is 0
Dragging a real file to a file input control:
PASS fileInput.value is "apple.gif"
FAIL fileInput.value should be apple.gif. Was C:\fakepath\apple.gif.
PASS fileInput.files.length is 1
PASS fileInput.files[0].name is "apple.gif"
PASS fileInput.files[0].type is "image/gif"
......@@ -20,21 +20,21 @@ PASS fileInput.files[0].size is 1476
PASS fileInput.files[0].fileName is "apple.gif"
PASS fileInput.files[0].fileSize is 1476
Dragging a directory onto an file input control:
FAIL fileInput.value should be . Was directory-for-dragging.
FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
FAIL fileInput.files.length should be 0. Was 1.
FIXME: Single-file input elements should refuse multi-file drags. See https://bugs.webkit.org/show_bug.cgi?id=25913
Dragging two files to a single-file input control:
FAIL fileInput.value should be . Was apple.gif.
FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
FAIL fileInput.files.length should be 0. Was 1.
Dragging a file and a directory onto a single-file input control:
FAIL fileInput.value should be . Was apple.gif.
FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
FAIL fileInput.files.length should be 0. Was 1.
FIXME: elements should refuse drags including directories: https://bugs.webkit.org/show_bug.cgi?id=25879. The page is given File objects corresponding to directories, but form submission will fail.
Dragging a directory and a file onto a single-file input control:
FAIL fileInput.value should be . Was directory-for-dragging.
FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
FAIL fileInput.files.length should be 0. Was 1.
Dragging two files to a multi-file input control:
PASS fileInput.value is "apple.gif"
FAIL fileInput.value should be apple.gif. Was C:\fakepath\apple.gif.
PASS fileInput.files.length is 2
PASS fileInput.files[0].name is "apple.gif"
PASS fileInput.files[0].type is "image/gif"
......@@ -47,11 +47,11 @@ PASS fileInput.files[1].size is 2593
PASS fileInput.files[1].fileName is "mozilla.gif"
PASS fileInput.files[1].fileSize is 2593
Dragging a file and a directory onto a mutli-file input control:
FAIL fileInput.value should be . Was apple.gif.
FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
FAIL fileInput.files.length should be 0. Was 2.
FIXME: elements should refuse drags including directories: https://bugs.webkit.org/show_bug.cgi?id=25879. The page is given File objects corresponding to directories, but form submission will fail.
Dragging a directory and a file onto a mutli-file input control:
FAIL fileInput.value should be . Was directory-for-dragging.
FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
FAIL fileInput.files.length should be 0. Was 2.
Dragging to a disabled file input control:
PASS fileInput.value is ""
......
2010-08-29 Adam Barth <abarth@webkit.org>
Reviewed by Darin Adler.
Implement HTML5's fakepath
https://bugs.webkit.org/show_bug.cgi?id=29000
The HTML 5 spec says to prepend C:\fakepath\ to the value of an
<input type="file"> control, so that's what we do now.
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::value):
2010-08-29 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r66329.
......@@ -1498,11 +1498,16 @@ void HTMLInputElement::copyNonAttributeProperties(const Element* source)
String HTMLInputElement::value() const
{
// The HTML5 spec (as of the 10/24/08 working draft) says that the value attribute isn't applicable to the file upload control
// but we don't want to break existing websites, who may be relying on being able to get the file name as a value.
if (inputType() == FILE) {
if (!m_fileList->isEmpty())
return m_fileList->item(0)->fileName();
if (!m_fileList->isEmpty()) {
// HTML5 tells us that we're supposed to use this goofy value for
// file input controls. Historically, browsers reveals the real
// file path, but that's a privacy problem. Code on the web
// decided to try to parse the value by looking for backslashes
// (because that's what Windows file paths use). To be compatible
// with that code, we make up a fake path for the file.
return "C:\\fakepath\\" + m_fileList->item(0)->fileName();
}
return String();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment