Created attachment 131790 [details] test case Open the attached html, and hit Cmd-C and then Cmd-V. Expected: Hello and World are shown. Actual: Only World is shown. The html calls evt.clipboardData.setData() twice on two mime types, and "Clipboard Viewer" reveals that the latter overwrites the former. WebKit trunk has regressed as follows: * r107802: works * r107978 to r109142: the left output shows undefined * r109209 onwards: the left output shows empty string
<rdar://problem/11047262>
The first breakage was caused by http://trac.webkit.org/changeset/107844 After that revision, the clipboard only remembers the most recent data set on it. Further breakage was caused in http://trac.webkit.org/changeset/109176 which is what caused "undefined" to start returning empty/null
(In reply to comment #2) > The first breakage was caused by http://trac.webkit.org/changeset/107844 > > After that revision, the clipboard only remembers the most recent data set on it. > > Further breakage was caused in http://trac.webkit.org/changeset/109176 which is what caused "undefined" to start returning empty/null I'm working on the first break right now, I'll file a second bugzilla when it's time to work on the second break.
(In reply to comment #3) > (In reply to comment #2) > > The first breakage was caused by http://trac.webkit.org/changeset/107844 > > > > After that revision, the clipboard only remembers the most recent data set on it. > > > > Further breakage was caused in http://trac.webkit.org/changeset/109176 which is what caused "undefined" to start returning empty/null > > I'm working on the first break right now, I'll file a second bugzilla when it's time to work on the second break. Nevermind, http://trac.webkit.org/changeset/109176 was an intentional change to match the spec. Great!
The key change was in ClipboardMac::setData. Before r107844 ClipboardMac::setData used the NSPasteBoard API [NSPasteBoard addTypes:owner:] which takes an array of types to add, and adds them to the already existing pasteboard types. In r107844 and later, ClipboardMac::setData does the following: -Uses the PlatformStrategies method "setTypes" to pass off the new types to add. Notice the method name is notably wrong. -The WebKit Platform Strategies turn around and all PlatformPasteboard::setTypes(). Notice the method name is notably wrong. -PlatformPasteboardMac::setTypes() uses the NSPasteBoard API [NSPasteBoard declareTypes:owner:] which explicitly clears all previous contents and adds only the included types.
Created attachment 132098 [details] Patch with layout test
http://trac.webkit.org/changeset/110880