Fix deadlock issue when dragging from PWA to Chrome
Moderate
Commit Hash:
ca6ea1cd0db580d5ee3f0c0642d4c7206d0a41fb
Commit Time: 2025-08-20 18:35:40+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This submission primarily addresses a potential deadlock issue that may occur when dragging from a PWA to the Chrome browser. The changes include: 1) Adding static methods IsOutOfProcessAppShim() and SetIsOutOfProcessAppShim() to the ApplicationBridge class to indicate whether the current process is running in a separate app shim process; 2) Invoking SetIsOutOfProcessAppShim() in chrome_main_app_mode_mac.mm to mark the app shim process state; 3) Adding the writingOptionsForType:pasteboard: method to the WebDragSource class, which always returns 0 when running in the app shim process to avoid deadlocks caused by synchronous IPC calls upon drag completion.
🎯 Impact Analysis
This change has a moderate impact on WebView2Mac. Although the change primarily targets drag-and-drop scenarios for PWAs, WebView2Mac relies on the same remote_cocoa infrastructure, especially the ApplicationBridge class, resulting in the following impacts: 1) The newly added process identification feature in the ApplicationBridge class may be recognized and utilized by the host application of WebView2Mac, so it is necessary to ensure the correctness of this identification status in the WebView2Mac environment; 2) Changes to the drag-and-drop behavior of WebDragSource may affect drag-and-drop operations in WebView2Mac, particularly when WebView2Mac needs to handle scenarios where content is dragged from the web page to the host application; 3) Since this change involves the underlying mechanisms of inter-process communication and drag-and-drop data transfer, it may indirectly affect the drag-and-drop performance and stability of WebView2Mac. It is necessary to verify whether the drag-and-drop functionality of WebView2Mac continues to work properly after this change.
Impacted Classes:
remote_cocoa::ApplicationBridge
WebDragSource
remote_cocoa::mojom::WebContentsNSViewHost