Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9a5dd61958c8778b9d3c24c43a680628cd015826
      
https://github.com/WebKit/WebKit/commit/9a5dd61958c8778b9d3c24c43a680628cd015826
  Author: Joanne Pan <[email protected]>
  Date:   2026-05-06 (Wed, 06 May 2026)

  Changed paths:
    M Source/WebKit/UIProcess/mac/WebViewImpl.mm
    M Tools/TestWebKitAPI/Helpers/cocoa/DragAndDropSimulator.h
    M Tools/TestWebKitAPI/Helpers/mac/DragAndDropSimulatorMac.mm
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/DragAndDropTestsMac.mm

  Log Message:
  -----------
  dataTransfer.types includes "Files" but dataTransfer.files is empty when 
dragging images from Mail.app
https://bugs.webkit.org/show_bug.cgi?id=307601
rdar://170672606

Reviewed by Ryosuke Niwa.

The problem: dataTransfer.files is empty when dragging an inline image
from the Mail app to a web page even though dataTransfer.types contains
the "Files" type. Mail puts both WebArchivePboardType and
NSFilesPromisePboardType on the pasteboard. The image data is only available
through the file promise, but WebKit skips file promise resolution whenever
WebArchive is present on the pasteboard.

The fix: The old code skipped file promise resolution whenever WebArchive
was on the pasteboard. Now it only skips when the drag came from the same
WebView (checked via DragApplicationFlags::IsSource). Mail.app is not the
same view, so its file promises get resolved.
Safari-to-Safari drags still use the WebArchive path since IsSource is true.

Tests: Tools/TestWebKitAPI/Helpers/cocoa/DragAndDropSimulator.h
       Tools/TestWebKitAPI/Helpers/mac/DragAndDropSimulatorMac.mm
       Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/DragAndDropTestsMac.mm

* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::performDragOperation):
* Tools/TestWebKitAPI/Helpers/cocoa/DragAndDropSimulator.h:
* Tools/TestWebKitAPI/Helpers/mac/DragAndDropSimulatorMac.mm:
(-[DragAndDropSimulator writePromisedFilesWithWebArchive:]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/mac/DragAndDropTestsMac.mm:
(TEST(DragAndDropTests, DragPromisedImageFileWithWebArchiveIntoFileUpload)):

Canonical link: https://commits.webkit.org/312711@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to