RESOLVED FIXED Bug 188490
[macOS 10.15] Image dragged from Safari does not appear in Notes
https://bugs.webkit.org/show_bug.cgi?id=188490
Summary [macOS 10.15] Image dragged from Safari does not appear in Notes
Wenson Hsieh
Reported 2018-08-12 02:16:04 PDT Comment hidden (obsolete)
Attachments
Patch (4.51 KB, patch)
2018-08-12 14:47 PDT, Wenson Hsieh
ews-watchlist: commit-queue-
Drop the image into the area below (37.28 KB, application/zip)
2018-08-13 20:00 PDT, Wenson Hsieh
no flags
Archive of layout-test-results from ews205 for win-future (12.79 MB, application/zip)
2018-08-16 15:37 PDT, EWS Watchlist
no flags
Patch (7.04 KB, patch)
2019-08-02 09:57 PDT, Wenson Hsieh
no flags
Wenson Hsieh
Comment 1 2018-08-12 14:47:02 PDT
Wenson Hsieh
Comment 2 2018-08-13 19:58:57 PDT
I realized on second glance that this patch is not quite right... Suppose we're dragging a file promise within a `WKWebView` (or dragging from one `WKWebView` to another in the same process), and dropping in a custom file upload area that uses DataTransfer API to read files from the pasteboard. Upon drop, we'll call out to the web process to perform the drag operation; the web process then makes a request to the UI process to grab the image on behalf of DataTransfer API, which then causes AppKit to request the data by invoking `-[WKWebView pasteboard:provideDataForType:]`. However, in the meantime, AppKit has already assumed that we've finished from the drag pasteboard after calling `-[WKWebView performDragOperation:]` on the destination-side, and calls `-[WKWebView draggedImage:endedAt:operation:]` on the source. If this patch were to land, we'd end up clearing out our data early, before the destination web view has a chance to ask for it. This can be observed via a simple test case, to be attached shortly. I don't think there's a simple way to fix this; we'd probably have to rewrite our macOS drop handling logic to become like iOS, where we have a heuristic to front-load any data on the pasteboard that the drop destination might access, and then provide a mechanism to answer any questions the web process might have using this subset of the pasteboard. iOS is only implemented this way because, unlike macOS, the data of a drag session backed by NSItemProviders is accessible *only* within the scope of the call to perform a drop. On the other hand, due to the persistent nature of NSPasteboard on macOS, we have the ability to just lazily fetch data as needed. I guess a cheap (non-?)solution is to just keep the drag data around on WebViewImpl until the next drag happens...but this is far less than ideal.
Wenson Hsieh
Comment 3 2018-08-13 20:00:24 PDT
Created attachment 347062 [details] Drop the image into the area below Test case
EWS Watchlist
Comment 4 2018-08-16 15:36:50 PDT Comment hidden (obsolete)
EWS Watchlist
Comment 5 2018-08-16 15:37:01 PDT Comment hidden (obsolete)
Wenson Hsieh
Comment 6 2019-08-02 09:43:23 PDT
Wenson Hsieh
Comment 7 2019-08-02 09:57:20 PDT
Wenson Hsieh
Comment 8 2019-08-02 11:20:21 PDT
Comment on attachment 375417 [details] Patch Thanks for the review!
Wenson Hsieh
Comment 9 2019-08-02 11:21:22 PDT
The api-mac bot encountered these failures: > Test suite failed > Timeout > TestWebKitAPI.Challenge.BasicProposedCredential > TestWebKitAPI.WKWebsiteDataStore.FetchPersistentCredentials > TestWebKitAPI.Challenge.SecIdentity …which don’t seem related to this change.
WebKit Commit Bot
Comment 10 2019-08-02 11:50:04 PDT
Comment on attachment 375417 [details] Patch Clearing flags on attachment: 375417 Committed r248166: <https://trac.webkit.org/changeset/248166>
WebKit Commit Bot
Comment 11 2019-08-02 11:50:06 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.