[webkit-changes] [WebKit/WebKit] 133a77: WebPaymentCoordinatorProxy should not send IPC to ...

Abrar Rahman Protyasha noreply at github.com
Sat Jan 13 15:20:28 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 133a77cf0f1d2a39311aabd462fef0fe36752060
      https://github.com/WebKit/WebKit/commit/133a77cf0f1d2a39311aabd462fef0fe36752060
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-01-13 (Sat, 13 Jan 2024)

  Changed paths:
    M Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp
    M Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h

  Log Message:
  -----------
  WebPaymentCoordinatorProxy should not send IPC to WebProcess when the connection is null
https://bugs.webkit.org/show_bug.cgi?id=267321
rdar://120772845

Reviewed by Wenson Hsieh.

It is possible for WebPaymentCoordinatorProxy to send IPC messages to the
WP when the connection is null. This can happen when a WP terminates while
a payment sheet is showing, and since the proxy will be alive, it will end
up sending a DidCancelPaymentSession message in its destructor.
Unfortunately, this causes the UI process to terminate, which is a bad
user experience for client users (like Safari).

This patch provides nuance to WebPaymentCoordinatorProxy's state machine
so that it can distinguish between successful versus unsuccessful
payment sheet presentation. We do so by introducing the Deactivating
state, which we transition into when the proxy has to be reset because
the corresponding WP has terminated. In this state, we can't begin,
cancel, complete, or abort payments. The former pair of inabilities
ensures that the proxy does not send the culprit IPC when it is being
destructed.

Note that it is OK for us to skip out on sending DidCancelPaymentSession
when the proxy is being reset because there is no WP to respond to it
regardless.

* Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::canBegin const):
(WebKit::WebPaymentCoordinatorProxy::canCancel const):
(WebKit::WebPaymentCoordinatorProxy::canCompletePayment const):
(WebKit::WebPaymentCoordinatorProxy::canAbort const):
(WebKit::WebPaymentCoordinatorProxy::webProcessExited):

Public state transition method that
WebPageProxy::resetPaymentCoordinator can call into.

* Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::resetState):
(WebKit::WebPageProxy::resetPaymentCoordinator):
* Source/WebKit/UIProcess/WebPageProxy.h:

Add a resetPaymentCoordinator method since we are doing a little more
than nulling it out now. Also, drive-by fix to provide a more
representative backing type for the ResetStateReason enumeration.

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




More information about the webkit-changes mailing list