Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4aaf25fe9410814b6d80a71e5fca825af0742764
      
https://github.com/WebKit/WebKit/commit/4aaf25fe9410814b6d80a71e5fca825af0742764
  Author: Sihui Liu <[email protected]>
  Date:   2026-07-08 (Wed, 08 Jul 2026)

  Changed paths:
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/PasteImage.mm

  Log Message:
  -----------
  Assertion failure under WebPageProxy::executeEditCommand() when 
NetworkProcess connection isn't established yet
https://bugs.webkit.org/show_bug.cgi?id=318812
rdar://181397513

Reviewed by Abrar Rahman Protyasha.

executeEditCommand(commandName, argument) synchronously waits for the 
AllowFilesAccessFromWebProcess reply by calling
AuxiliaryProcessProxy::connection() on the NetworkProcess, which 
RELEASE_ASSERTs that m_connection is non-null.
willPerformPasteCommand() can return a valid AsyncReplyID (via 
grantAccessToCurrentPasteboardData ->
WebPasteboardProxy::grantAccessToCurrentData) even while the NetworkProcess is 
still launching, since
sendWithAsyncReply() queues the message in m_pendingMessages and only 
establishes m_connection once the process
finishes launching. Pasting content that carries file paths (e.g. an 
attachment) before the NetworkProcess connection
exists therefore hits the RELEASE_ASSERT and crashes the UI process.

This is a follow-up to 99d7f658ab04 (bug 301321), which added a similar 
hasRunningProcess() guard to the callback-based
overload of executeEditCommand() but did not cover this synchronous overload's 
unconditional connection() call.

Guard the wait with hasConnection() instead. The AllowFilesAccessFromWebProcess 
message itself is unaffected: it is
already queued safely regardless of process launch state, and its completion 
handler will still run once the
NetworkProcess is up and the reply is dispatched normally. Skipping the 
synchronous wait only means the paste's
completion handler may run asynchronously later rather than being fast-pathed 
within this call.

API Test: PasteImage.PasteFileWhileNetworkProcessIsLaunching

* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::executeEditCommand):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/PasteImage.mm:
(TEST(PasteImage, PasteFileWhileNetworkProcessIsLaunching)):

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



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

Reply via email to