Bug 33738 - DataTransfer interface does not work on Windows
Summary: DataTransfer interface does not work on Windows
Status: RESOLVED DUPLICATE of bug 30527
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows Vista
: P2 Normal
Assignee: Nobody
URL: http://www.whatwg.org/specs/web-apps/...
Keywords:
Depends on:
Blocks:
 
Reported: 2010-01-15 14:05 PST by Daniel Cheng
Modified: 2010-01-21 22:05 PST (History)
1 user (show)

See Also:


Attachments
Patch for the problems described (2.37 KB, patch)
2010-01-15 14:10 PST, Daniel Cheng
aroben: review-
Details | Formatted Diff | Diff
Patch (4.61 KB, patch)
2010-01-15 16:57 PST, Daniel Cheng
aroben: review-
dcheng: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Cheng 2010-01-15 14:05:45 PST
The format enumerator isn't being called correctly in ClipboardWin::types and ClipboardWin::hasData.
Comment 1 Daniel Cheng 2010-01-15 14:10:41 PST
Created attachment 46711 [details]
Patch for the problems described
Comment 2 Adam Roben (:aroben) 2010-01-15 14:43:42 PST
Comment on attachment 46711 [details]
Patch for the problems described

> +        Not sure how to add a good test for it.

I'll bet we can come up with a test. If .types and .getData are completely broken, it should be pretty easy! There are probably existing tests you can build off of; grep through LayoutTests for uses of event.dataTransfer.

> +        * platform/win/ClipboardWin.cpp:
> +        (WebCore::addMimeTypesForFormat):
> +        (WebCore::ClipboardWin::types):
> +        (WebCore::ClipboardWin::hasData):

You should add function-level comments about what your patch does and why.

> @@ -568,7 +568,7 @@ HashSet<String> ClipboardWin::types() co
>  
>      FORMATETC data;
>  
> -    while (SUCCEEDED(itr->Next(1, &data, 0))) {
> +    while (itr->Next(1, &data, 0) == S_OK) {
>          addMimeTypesForFormat(results, data);
>      }
>  
> @@ -789,7 +789,7 @@ bool ClipboardWin::hasData()
>  
>      FORMATETC data;
>  
> -    if (SUCCEEDED(itr->Next(1, &data, 0))) {
> +    if (itr->Next(1, &data, 0) == S_OK) {
>          // There is at least one item in the IDataObject
>          return true;
>      }

It might be worth adding a comment about the return value of IEnumFORMATETC::Next.

The code changes look good, but r- so we can come up with a test and fix up the ChangeLog.
Comment 3 Daniel Cheng 2010-01-15 16:57:49 PST
Created attachment 46719 [details]
Patch

Updated ChangeLog, added a few comments in the code, and updated a layout test.

As it turns out, fast/events/drag-and-drop-dataTransfer-types-nocrash.html already partially covers this so I extended it to test event.dataTransfer.getData() as well.
Comment 4 Adam Roben (:aroben) 2010-01-18 06:20:21 PST
Comment on attachment 46719 [details]
Patch

This looks great! The one thing we still need to do is actually enable that test on Windows. You will find it listed in LayoutTests/platform/win/Skipped. Please remove it from that file and resubmit your patch and we can get this committed!
Comment 5 Adam Roben (:aroben) 2010-01-18 06:21:38 PST
Duping to bug 30527. Daniel, please attach your next revision of the patch to that bug.

*** This bug has been marked as a duplicate of bug 30527 ***