Changeset 105941 in webkit


Ignore:
Timestamp:
Jan 25, 2012 4:27:03 PM (12 years ago)
Author:
eric@webkit.org
Message:

"text" and "URL" legacy clipboard types should not be case sensitive
https://bugs.webkit.org/show_bug.cgi?id=76947

Reviewed by Adam Barth.

Source/WebCore:

This matches the HTML5 spec which says the first thing to do is to lowercase
the type before comparing.
I also removed the stripping of whitespace since that is not part of the modern spec (and no tests failed as a result of removal).
Turns out we already had a test for case sensitivity, but it was disabled on Mac
so I just re-enabled it and have added failing expectations for the parts
of the test we still fail.

  • platform/mac/ClipboardMac.mm:

(WebCore::cocoaTypeFromHTMLClipboardType):
(WebCore::ClipboardMac::getData):

LayoutTests:

This test has been disabled on Mac since it was added 2 years ago.
But we actually need to fix at least one of the bugs covered by this
test, so I'm unskipping it and adding failing expectations for the
parts Mac doens't yet pass.

  • platform/mac/Skipped:
  • platform/mac/editing/pasteboard/dataTransfer-setData-getData-expected.txt: Added.
Location:
trunk
Files:
5 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r105938 r105941  
     12012-01-25  Eric Seidel  <eric@webkit.org>
     2
     3        "text" and "URL" legacy clipboard types should not be case sensitive
     4        https://bugs.webkit.org/show_bug.cgi?id=76947
     5
     6        Reviewed by Adam Barth.
     7
     8        This test has been disabled on Mac since it was added 2 years ago.
     9        But we actually need to fix at least one of the bugs covered by this
     10        test, so I'm unskipping it and adding failing expectations for the
     11        parts Mac doens't yet pass.
     12
     13        * platform/mac/Skipped:
     14        * platform/mac/editing/pasteboard/dataTransfer-setData-getData-expected.txt: Added.
     15
    1162012-01-25  Eric Seidel  <eric@webkit.org>
    217
  • trunk/LayoutTests/editing/pasteboard/dataTransfer-setData-getData-expected.txt

    r105826 r105941  
    66--- Test set/get 'URL':
    77PASS getDataResultType is "string"
    8 PASS getDataResult is "http://test.com/"
     8FAIL getDataResult should be http://test.com/. Was http://test.com.
    99--- Test set/get 'URL' with multiple URLs:
    10 PASS getDataResultType is "string"
    11 PASS getDataResult is "http://test.com/"
     10FAIL getDataResultType should be string. Was undefined.
     11FAIL getDataResult should be http://test.com/ (of type string). Was undefined (of type undefined).
    1212--- Test set/get 'text/uri-list':
    13 PASS getDataResultType is "string"
    14 PASS getDataResult is "http://test.com\r\nhttp://check.com"
     13FAIL getDataResultType should be string. Was undefined.
     14FAIL getDataResult should be http://test.com
     15http://check.com (of type string). Was undefined (of type undefined).
    1516--- Test set/get 'text/uri-list' using '\n':
    16 PASS getDataResultType is "string"
    17 PASS getDataResult is "http://test.com\nhttp://check.com"
     17FAIL getDataResultType should be string. Was undefined.
     18FAIL getDataResult should be http://test.com
     19http://check.com (of type string). Was undefined (of type undefined).
    1820--- Test set 'text/uri-list', get 'URL':
    19 PASS getDataResultType is "string"
    20 PASS getDataResult is "http://test.com/"
     21FAIL getDataResultType should be string. Was undefined.
     22FAIL getDataResult should be http://test.com/ (of type string). Was undefined (of type undefined).
    2123--- Test set 'URL', get 'text/uri-list':
    22 PASS getDataResultType is "string"
    23 PASS getDataResult is "http://test.com\r\nhttp://check.com"
     24FAIL getDataResultType should be string. Was undefined.
     25FAIL getDataResult should be http://test.com
     26http://check.com (of type string). Was undefined (of type undefined).
    2427--- Test set 'text/uri-list', get 'URL', using only '\n':
    25 PASS getDataResultType is "string"
    26 PASS getDataResult is "http://test.com/"
     28FAIL getDataResultType should be string. Was undefined.
     29FAIL getDataResult should be http://test.com/ (of type string). Was undefined (of type undefined).
    2730--- Test set/get 'text/uri-list' with comments:
    28 PASS getDataResultType is "string"
    29 PASS getDataResult is "# comment\r\nhttp://test.com\r\nhttp://check.com"
     31FAIL getDataResultType should be string. Was undefined.
     32FAIL getDataResult should be # comment
     33http://test.com
     34http://check.com (of type string). Was undefined (of type undefined).
    3035--- Test set 'text/uri-list', get 'URL' with comments:
    31 PASS getDataResultType is "string"
    32 PASS getDataResult is "http://test.com/"
     36FAIL getDataResultType should be string. Was undefined.
     37FAIL getDataResult should be http://test.com/ (of type string). Was undefined (of type undefined).
    3338--- Test set 'text/uri-list', get 'URL' with only comments:
    34 PASS getDataResultType is "string"
    35 PASS getDataResult is ""
     39FAIL getDataResultType should be string. Was undefined.
     40FAIL getDataResult should be  (of type string). Was undefined (of type undefined).
    3641--- Test set/get 'text/plain':
    3742PASS getDataResultType is "string"
  • trunk/LayoutTests/platform/mac/Skipped

    r105867 r105941  
    115115fast/dom/HTMLProgressElement/progress-element.html
    116116
    117 # event.dataTransfer.setData('text/uri-list') not correctly implemented on Mac
    118 editing/pasteboard/dataTransfer-setData-getData.html
    119 
    120117# eventSender needs to propagate the event to the calling window, not the main frame always.
    121118http/tests/plugins/plugin-document-has-focus.html
  • trunk/Source/WebCore/ChangeLog

    r105940 r105941  
     12012-01-25  Eric Seidel  <eric@webkit.org>
     2
     3        "text" and "URL" legacy clipboard types should not be case sensitive
     4        https://bugs.webkit.org/show_bug.cgi?id=76947
     5
     6        Reviewed by Adam Barth.
     7
     8        This matches the HTML5 spec which says the first thing to do is to lowercase
     9        the type before comparing.
     10        I also removed the stripping of whitespace since that is not part of the modern spec (and no tests failed as a result of removal).
     11        Turns out we already had a test for case sensitivity, but it was disabled on Mac
     12        so I just re-enabled it and have added failing expectations for the parts
     13        of the test we still fail.
     14
     15        * platform/mac/ClipboardMac.mm:
     16        (WebCore::cocoaTypeFromHTMLClipboardType):
     17        (WebCore::ClipboardMac::getData):
     18
    1192012-01-25  Eric Seidel  <eric@webkit.org>
    220
  • trunk/Source/WebCore/platform/mac/ClipboardMac.mm

    r85036 r105941  
    6969static RetainPtr<NSString> cocoaTypeFromHTMLClipboardType(const String& type)
    7070{
    71     String qType = type.stripWhiteSpace();
    72 
    73     // two special cases for IE compatibility
    74     if (qType == "Text")
    75         return NSStringPboardType;
    76     if (qType == "URL")
    77         return NSURLPboardType;
     71    // http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dom-datatransfer-setdata
     72    String qType = type.lower();
     73
     74    if (qType == "text")
     75        qType = "text/plain";
     76    if (qType == "url")
     77        qType = "text/uri-list";
    7878
    7979    // Ignore any trailing charset - JS strings are Unicode, which encapsulates the charset issue
     
    8383        // special case because UTI doesn't work with Cocoa's URL type
    8484        return NSURLPboardType; // note special case in getData to read NSFilenamesType
    85    
     85
    8686    // Try UTI now
    8787    NSString *mimeType = qType;
     
    219219    // Grab the value off the pasteboard corresponding to the cocoaType
    220220    if ([cocoaType.get() isEqualToString:NSURLPboardType]) {
    221         // "URL" and "text/url-list" both map to NSURLPboardType in cocoaTypeFromHTMLClipboardType(), "URL" only wants the first URL
    222         bool onlyFirstURL = (type == "URL");
     221        // "url" and "text/url-list" both map to NSURLPboardType in cocoaTypeFromHTMLClipboardType(), "url" only wants the first URL
     222        bool onlyFirstURL = (equalIgnoringCase(type, "url"));
    223223        NSArray *absoluteURLs = absoluteURLsFromPasteboard(m_pasteboard.get(), onlyFirstURL);
    224224        cocoaValue = [absoluteURLs componentsJoinedByString:@"\n"];
Note: See TracChangeset for help on using the changeset viewer.