[webkit-changes] [WebKit/WebKit] 7a9e0c: [iOS] Avoid incrementing the WebItemProviderPasteb...
Wenson Hsieh
noreply at github.com
Wed Jun 21 21:26:10 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 7a9e0cf4d1795b7ef6a49ea7becba561416a6f23
https://github.com/WebKit/WebKit/commit/7a9e0cf4d1795b7ef6a49ea7becba561416a6f23
Author: Wenson Hsieh <wenson_hsieh at apple.com>
Date: 2023-06-21 (Wed, 21 Jun 2023)
Changed paths:
M Source/WebCore/platform/ios/WebItemProviderPasteboard.h
M Source/WebCore/platform/ios/WebItemProviderPasteboard.mm
M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
M Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm
Log Message:
-----------
[iOS] Avoid incrementing the WebItemProviderPasteboard change count upon handling a drop
https://bugs.webkit.org/show_bug.cgi?id=258374
rdar://111130159
Reviewed by Aditya Keerthi.
This is a speculative fix for rdar://107712399, wherein the `changeCount` of the drag and drop
pasteboard (`WebItemProviderPasteboard`) may be incremented while performing a drop if the dropped
items are overwritten upon drop, thus bumping the pasteboard's `_changeCount`.
To mitigate this possibility, instead of incrementing the `_changeCount` whenever the backing item
provider array changes, we instead keep it stable across the lifetime of a given drop session
(`UIDropSession`), even in the case where a WebKit client overrides dropped items at the last
minute when performing the drop.
* Source/WebCore/platform/ios/WebItemProviderPasteboard.h:
* Source/WebCore/platform/ios/WebItemProviderPasteboard.mm:
(-[WebItemProviderPasteboard setItemProviders:dropSession:]):
(-[WebItemProviderPasteboard setItemProviders:]):
* Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView dropInteraction:sessionDidEnter:]):
(-[WKContentView dropInteraction:sessionDidUpdate:]):
(-[WKContentView dropInteraction:sessionDidExit:]):
(-[WKContentView dropInteraction:performDrop:]):
* Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
Adjust a couple of API tests to exercise the fix, by checking that the final `changeCount` ends up
at 2 after concluding a simulated drop (+1 for when we first begin the drop session, and +1 again
after we clean up the pasteboard, after the webpage is done handling the drop).
Canonical link: https://commits.webkit.org/265392@main
More information about the webkit-changes
mailing list