Bug 113094 - [Mac] can-read-in-dragstart-event.html and can-read-in-copy-and-cut-events.html fail
Summary: [Mac] can-read-in-dragstart-event.html and can-read-in-copy-and-cut-events.ht...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alexey Proskuryakov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-22 13:41 PDT by Ryosuke Niwa
Modified: 2013-08-26 16:44 PDT (History)
6 users (show)

See Also:


Attachments
proposed fix (49.83 KB, patch)
2013-08-26 13:04 PDT, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff
proposed fix (49.96 KB, patch)
2013-08-26 14:07 PDT, Alexey Proskuryakov
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ryosuke Niwa 2013-03-22 13:41:32 PDT
Two tests added by http://trac.webkit.org/changeset/146644 fails on Mac port:
http://build.webkit.org/results/Apple%20MountainLion%20Release%20WK1%20(Tests)/r146644%20(8256)/results.html

--- /Volumes/Data/slave/mountainlion-release-tests-wk1/build/layout-test-results/editing/pasteboard/can-read-in-copy-and-cut-events-expected.txt
+++ /Volumes/Data/slave/mountainlion-release-tests-wk1/build/layout-test-results/editing/pasteboard/can-read-in-copy-and-cut-events-actual.txt
@@ -1,5 +1,5 @@
+CONSOLE MESSAGE: line 13: TypeError: 'null' is not an object (evaluating 'event.clipboardData.types.indexOf')
+CONSOLE MESSAGE: line 22: TypeError: 'null' is not an object (evaluating 'event.clipboardData.types.indexOf')
 Simple test that data set during a copy/cut event can be read back. To run the test manually, simply select any text and initiate a copy/cut operation.
 
-copy: SUCCESS
-cut: SUCCESS
 

--- /Volumes/Data/slave/mountainlion-release-tests-wk1/build/layout-test-results/editing/pasteboard/can-read-in-dragstart-event-expected.txt
+++ /Volumes/Data/slave/mountainlion-release-tests-wk1/build/layout-test-results/editing/pasteboard/can-read-in-dragstart-event-actual.txt
@@ -1,5 +1,5 @@
+CONSOLE MESSAGE: line 13: TypeError: 'null' is not an object (evaluating 'event.dataTransfer.types.indexOf')
 Simple test that data set during a dragstart event can be read back. To run the test manually, simply start dragging the 'Drag Me' element below.
 
 Drag Me
-dragstart: SUCCESS
Comment 1 Ryosuke Niwa 2013-03-22 13:44:11 PDT
Committed r146652: <http://trac.webkit.org/changeset/146652>
Comment 2 Daniel Cheng 2013-03-22 14:18:54 PDT
This is a problem specific to the Mac port.

In the new tests, we verify that the data object is both readable and writable in the dragstart/copy/cut events, which the spec and Firefox both allow.

However, the Mac implementation of the Clipboard getters contains the following check:
    if (m_changeCount != platformStrategies()->pasteboardStrategy()->changeCount(m_pasteboardName))
        return ListHashSet<String>();

Unfortunately, by definition, the change count will be always be different, since we're mutating the clipboard in the first part of the test.

One possibility is to relax this check by skipping the change count check if the clipboard is in a writable state as well, but that seems like a hack. Another possibility would be to update the change count every time an item is written to the clipboard.
Comment 3 Antoine Quint 2013-07-30 05:09:26 PDT
The test editing/pasteboard/can-read-in-copy-and-cut-events.html now passes on wk2.
Comment 4 Antoine Quint 2013-07-30 05:12:17 PDT
Retitled the bug to reflect the single test failure. Test expectations updated in http://trac.webkit.org/changeset/153465.
Comment 5 Alexey Proskuryakov 2013-07-30 15:02:08 PDT
This test still fails on wk1 though, so updated results again in <http://trac.webkit.org/r153496>. Re-titling the bug, too.

I'm not actually sure if wk2 success is true, or a consequence of some other bug.
Comment 6 Alexey Proskuryakov 2013-08-26 13:04:11 PDT
> Another possibility would be to update the change count every time an item is written to the clipboard.

That seems like the way to go to me.
Comment 7 Alexey Proskuryakov 2013-08-26 13:04:43 PDT
Created attachment 209672 [details]
proposed fix
Comment 8 Alexey Proskuryakov 2013-08-26 13:44:37 PDT
Unsure why WK2 EWS is still unhappy (can-read-in-copy-and-cut-events.html often fails on EWS, but not on regular WK2 bots).

I have another patch for pasteboard in WTR, hopefully together they will make EWS happier.
Comment 9 Alexey Proskuryakov 2013-08-26 14:03:56 PDT
Actually, a crash on EWS is real, will post a patch with a null check in a moment.
Comment 10 Alexey Proskuryakov 2013-08-26 14:07:38 PDT
Created attachment 209676 [details]
proposed fix

editing/pasteboard/dataTransfer-setData-getData.html was crashing because URL it was trying to set was invalid. This used to fail silently with a nil receiver in -writeToPasteboard:.

Not sure what the best behavior in this case is; updated patch proceeds with setting an empty URL in all flavors.
Comment 11 Alexey Proskuryakov 2013-08-26 14:10:42 PDT
Committed <http://trac.webkit.org/r154639>.
Comment 12 Alexey Proskuryakov 2013-08-26 16:44:36 PDT
Updated test results in <http://trac.webkit.org/r154653>.