Bug 90425

Summary: editing/pasteboard/dataTransfer-setData-getData.html hit ASSERT in KURL::KURL in Windows.
Product: WebKit Reporter: huangxueqing <huangxueqing>
Component: WebCore Misc.Assignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal CC: ap, jberlin
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   

Description huangxueqing 2012-07-02 19:24:26 PDT
editing/pasteboard/dataTransfer-setData-getData.html hit ASSERT(url == m_string) in KURL::KURL(). It seems that KURL always append a slash in the end of url if url did not include neither fragment nor query, but ClipboardWin::setData() construct KURL with a url which did not include a slash in the end of it.
Comment 1 huangxueqing 2012-07-07 01:17:28 PDT
editing/pasteboard/dataTransfer-setData-getData.html failed not only hit ASSERT in KURL::KURL, but also other reason in implentation of dataTransfer.setData.

The reason of hit ASSERT in KURL::KURL was: A url did not inlude path, and scheme was file or http or https always be appended a slash in the end of url. In ClipboardWin::setData, we construct a url via KURL(ParsedURLString, data), if data was http://example.com, KURL parse this will hit ASSERT(url == m_string) since KURL append slash in the end of m_string, I suggest use KURL(KURL(), data) rather than KURL(ParsedURLString, data) in ClipboardWin::setData since we can not garantee web develop will call dataTransfer.setData with a canonicalized url such as "http://www.example.com/";
In Addtion, this case seems did not expect append slash to canonicalize url, but [1] did not specify this;
[1] also did not specify how to parse '\r\n' in data, in Windows, we ues extractURL() to truncate the string after '\n', which seems was inconsistent with author's expectation.

So, I prefer to use KURL(KURL(), data) instead of KURL(ParsedURLString, data) in ClipboardWin::setData() and modify the failure's reason in Skipped file to fix this bug.
Please feel free to comment it. Thanks.

1. http://www.w3.org/TR/2011/WD-html5-20110113/dnd.html#datatransfer