Changeset 230639 in webkit


Ignore:
Timestamp:
Apr 13, 2018 10:37:31 AM (6 years ago)
Author:
Chris Dumez
Message:

input.webkitEntries does not work as expected when folder contains accented chars
https://bugs.webkit.org/show_bug.cgi?id=184517
<rdar://problem/39265537>

Reviewed by Alex Christensen.

Source/WebCore:

Use String::fromUTF8() to construct a WTF String from the char* returned by
dirname() in FileSystem::directoryName(). Previously, we were just calling
the String constructor, which would treat the input as latin 1 instead of
UTF-8.

Change is covered by an API test rather than a layout test due to file versioning
limitations.

  • platform/posix/FileSystemPOSIX.cpp:

(WebCore::FileSystem::directoryName):

Tools:

Add API test coverage.

  • TestWebKitAPI/Tests/WebCore/FileSystem.cpp:

(TestWebKitAPI::TEST_F):

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r230637 r230639  
     12018-04-13  Chris Dumez  <cdumez@apple.com>
     2
     3        input.webkitEntries does not work as expected when folder contains accented chars
     4        https://bugs.webkit.org/show_bug.cgi?id=184517
     5        <rdar://problem/39265537>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Use String::fromUTF8() to construct a WTF String from the char* returned by
     10        dirname() in FileSystem::directoryName(). Previously, we were just calling
     11        the String constructor, which would treat the input as latin 1 instead of
     12        UTF-8.
     13
     14        Change is covered by an API test rather than a layout test due to file versioning
     15        limitations.
     16
     17        * platform/posix/FileSystemPOSIX.cpp:
     18        (WebCore::FileSystem::directoryName):
     19
    1202018-04-13  Yusuke Suzuki  <utatane.tea@gmail.com>
    221
  • trunk/Source/WebCore/platform/posix/FileSystemPOSIX.cpp

    r230586 r230639  
    352352        return String();
    353353
    354     return dirname(fsRep.mutableData());
     354    return String::fromUTF8(dirname(fsRep.mutableData()));
    355355}
    356356
  • trunk/Tools/ChangeLog

    r230638 r230639  
     12018-04-13  Chris Dumez  <cdumez@apple.com>
     2
     3        input.webkitEntries does not work as expected when folder contains accented chars
     4        https://bugs.webkit.org/show_bug.cgi?id=184517
     5        <rdar://problem/39265537>
     6
     7        Reviewed by Alex Christensen.
     8
     9        Add API test coverage.
     10
     11        * TestWebKitAPI/Tests/WebCore/FileSystem.cpp:
     12        (TestWebKitAPI::TEST_F):
     13
    1142018-04-13  Thibault Saunier  <tsaunier@igalia.com>
    215
  • trunk/Tools/TestWebKitAPI/Tests/WebCore/FileSystem.cpp

    r224371 r230639  
    140140}
    141141
     142TEST_F(FileSystemTest, UnicodeDirectoryName)
     143{
     144    String path = String::fromUTF8("/test/a\u0308lo/test.txt");
     145    String directoryName = FileSystem::directoryName(path);
     146    String expectedDirectoryName = String::fromUTF8("/test/a\u0308lo");
     147    EXPECT_TRUE(expectedDirectoryName == directoryName);
    142148}
     149
     150}
Note: See TracChangeset for help on using the changeset viewer.