Changeset 66343 in webkit


Ignore:
Timestamp:
Aug 29, 2010 6:16:15 PM (14 years ago)
Author:
abarth@webkit.org
Message:

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):
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r66340 r66343  
     12010-08-29  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Implement HTML5's fakepath
     6        https://bugs.webkit.org/show_bug.cgi?id=29000
     7
     8        Update expectations for this pasteboard test to include our new friend
     9        fakepath.
     10
     11        * editing/pasteboard/file-input-files-access-expected.txt:
     12
    1132010-08-29  Mihai Parparita  <mihaip@chromium.org>
    214
  • trunk/LayoutTests/editing/pasteboard/file-input-files-access-expected.txt

    r59689 r66343  
    55
    66Dragging a single (non-existant) file to a file input control:
    7 PASS fileInput.value is "DRTFakeFile"
     7FAIL fileInput.value should be DRTFakeFile. Was C:\fakepath\DRTFakeFile.
    88PASS fileInput.files.length is 1
    99PASS fileInput.files[0].name is "DRTFakeFile"
     
    1313PASS fileInput.files[0].fileSize is 0
    1414Dragging a real file to a file input control:
    15 PASS fileInput.value is "apple.gif"
     15FAIL fileInput.value should be apple.gif. Was C:\fakepath\apple.gif.
    1616PASS fileInput.files.length is 1
    1717PASS fileInput.files[0].name is "apple.gif"
     
    2121PASS fileInput.files[0].fileSize is 1476
    2222Dragging a directory onto an file input control:
    23 FAIL fileInput.value should be . Was directory-for-dragging.
     23FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
    2424FAIL fileInput.files.length should be 0. Was 1.
    2525FIXME: Single-file input elements should refuse multi-file drags.  See https://bugs.webkit.org/show_bug.cgi?id=25913
    2626Dragging two files to a single-file input control:
    27 FAIL fileInput.value should be . Was apple.gif.
     27FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
    2828FAIL fileInput.files.length should be 0. Was 1.
    2929Dragging a file and a directory onto a single-file input control:
    30 FAIL fileInput.value should be . Was apple.gif.
     30FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
    3131FAIL fileInput.files.length should be 0. Was 1.
    3232FIXME:  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.
    3333Dragging a directory and a file onto a single-file input control:
    34 FAIL fileInput.value should be . Was directory-for-dragging.
     34FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
    3535FAIL fileInput.files.length should be 0. Was 1.
    3636Dragging two files to a multi-file input control:
    37 PASS fileInput.value is "apple.gif"
     37FAIL fileInput.value should be apple.gif. Was C:\fakepath\apple.gif.
    3838PASS fileInput.files.length is 2
    3939PASS fileInput.files[0].name is "apple.gif"
     
    4848PASS fileInput.files[1].fileSize is 2593
    4949Dragging a file and a directory onto a mutli-file input control:
    50 FAIL fileInput.value should be . Was apple.gif.
     50FAIL fileInput.value should be . Was C:\fakepath\apple.gif.
    5151FAIL fileInput.files.length should be 0. Was 2.
    5252FIXME:  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.
    5353Dragging a directory and a file onto a mutli-file input control:
    54 FAIL fileInput.value should be . Was directory-for-dragging.
     54FAIL fileInput.value should be . Was C:\fakepath\directory-for-dragging.
    5555FAIL fileInput.files.length should be 0. Was 2.
    5656Dragging to a disabled file input control:
  • trunk/WebCore/ChangeLog

    r66342 r66343  
     12010-08-29  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        Implement HTML5's fakepath
     6        https://bugs.webkit.org/show_bug.cgi?id=29000
     7
     8        The HTML 5 spec says to prepend C:\fakepath\ to the value of an
     9        <input type="file"> control, so that's what we do now.
     10
     11        * html/HTMLInputElement.cpp:
     12        (WebCore::HTMLInputElement::value):
     13
    1142010-08-29  Sheriff Bot  <webkit.review.bot@gmail.com>
    215
  • trunk/WebCore/html/HTMLInputElement.cpp

    r66223 r66343  
    14991499String HTMLInputElement::value() const
    15001500{
    1501     // The HTML5 spec (as of the 10/24/08 working draft) says that the value attribute isn't applicable to the file upload control
    1502     // but we don't want to break existing websites, who may be relying on being able to get the file name as a value.
    15031501    if (inputType() == FILE) {
    1504         if (!m_fileList->isEmpty())
    1505             return m_fileList->item(0)->fileName();
     1502        if (!m_fileList->isEmpty()) {
     1503            // HTML5 tells us that we're supposed to use this goofy value for
     1504            // file input controls.  Historically, browsers reveals the real
     1505            // file path, but that's a privacy problem.  Code on the web
     1506            // decided to try to parse the value by looking for backslashes
     1507            // (because that's what Windows file paths use).  To be compatible
     1508            // with that code, we make up a fake path for the file.
     1509            return "C:\\fakepath\\" + m_fileList->item(0)->fileName();
     1510        }
    15061511        return String();
    15071512    }
Note: See TracChangeset for help on using the changeset viewer.