Bug 79712 - Clipboard::getData should return an empty string instead of undefined
Summary: Clipboard::getData should return an empty string instead of undefined
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Daniel Cheng
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-02-27 16:10 PST by Daniel Cheng
Modified: 2012-02-28 17:32 PST (History)
7 users (show)

See Also:


Attachments
Patch (30.73 KB, patch)
2012-02-27 16:35 PST, Daniel Cheng
no flags Details | Formatted Diff | Diff
Patch (36.00 KB, patch)
2012-02-27 17:43 PST, Daniel Cheng
tony: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Cheng 2012-02-27 16:10:38 PST
Clipboard::getData should return an empty string instead of undefined
Comment 1 Daniel Cheng 2012-02-27 16:35:13 PST
Created attachment 129126 [details]
Patch
Comment 2 Daniel Cheng 2012-02-27 16:36:38 PST
Are we planning on importing more IETC tests? This is covered by http://samples.msdn.microsoft.com/ietestcenter/html5/dragdrop/getData_dragenter.htm.

Otherwise I'll just write a new layout test for this.
Comment 3 Adam Barth 2012-02-27 16:38:16 PST
You can either import the IETC test or write a new test.  Whatever is more convenient for you.
Comment 4 Eric Seidel (no email) 2012-02-27 16:58:26 PST
In the past I've found it easier to write a new test.  Most of the IETC tests are not designed for automated testing.
Comment 5 Eric Seidel (no email) 2012-02-27 16:59:28 PST
Comment on attachment 129126 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=129126&action=review

> Source/WebCore/ChangeLog:10
> +        No new tests. (OOPS!)

This will cause the CQ to fail, you'll need to replace this line with a list of tests your'e changing/adding.
Comment 6 Daniel Cheng 2012-02-27 17:43:15 PST
Created attachment 129149 [details]
Patch
Comment 7 Tony Chang 2012-02-28 14:36:08 PST
Comment on attachment 129149 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=129149&action=review

It seems unfortunate that you can't tell if something is in the clipboard or just an empty string, but maybe that's intentional.

What does Firefox do?

> Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp:452
> +    if (!getWebLocData(dataObject, url, title)) {

Nit: Can we early return here instead of nesting?
Comment 8 Daniel Cheng 2012-02-28 17:29:19 PST
(In reply to comment #7)
> (From update of attachment 129149 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=129149&action=review
> 
> It seems unfortunate that you can't tell if something is in the clipboard or just an empty string, but maybe that's intentional.
> 
> What does Firefox do?
> 

My test shows they return empty strings instead of undefined.

> > Source/WebCore/platform/win/ClipboardUtilitiesWin.cpp:452
> > +    if (!getWebLocData(dataObject, url, title)) {
> 
> Nit: Can we early return here instead of nesting?

Done.
Comment 9 Daniel Cheng 2012-02-28 17:32:07 PST
Committed r109176: <http://trac.webkit.org/changeset/109176>