[webkit-changes] [WebKit/WebKit] 6e4f73: [Apple Pay] PKPaymentRequest instances are vended ...

Abrar Rahman Protyasha noreply at github.com
Tue Mar 26 15:15:56 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6e4f73ab3bd2705006528afdfc8b17fedbfb96a2
      https://github.com/WebKit/WebKit/commit/6e4f73ab3bd2705006528afdfc8b17fedbfb96a2
  Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
  Date:   2024-03-26 (Tue, 26 Mar 2024)

  Changed paths:
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
    M Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm
    M Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h
    M Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm
    M Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm
    M Source/WebKit/Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm
    M Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
    M Source/WebKit/UIProcess/Network/NetworkProcessProxy.h
    M Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in
    M Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm
    M Source/WebKit/UIProcess/WebPageProxyInternals.h

  Log Message:
  -----------
  [Apple Pay] PKPaymentRequest instances are vended generic user agent string on iOS
https://bugs.webkit.org/show_bug.cgi?id=271503
rdar://125267234

Reviewed by Aditya Keerthi.

WebPaymentCoordinatorProxy either lives in the UI process (macOS) or in
the network process (iOS). In 270312 at main, we unconditionally consulted
WebPageProxy::userAgent() when populating PKPaymentRequest instances
with originating user agent strings. This approach is not valid for iOS
because we would be trying to access a WebPageProxy (lives in the UI
process) directly from an object that lives in the network process. As a
result, we ended up supplying the fallback, generic UA strings on iOS.

This patch addresses this bug by instead delegating the work of
procuring a UA string to WebPaymentCoordinatorProxy::Client. On macOS,
the client can simply query WebPageProxy::userAgent() since it lives in
the UI process. On iOS, we add plumbing to be able to send an async
message from the network process across the UI process connection asking
for an appropriate UA string.

* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
* Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
(WebKit::NetworkConnectionToWebProcess::getPaymentCoordinatorEmbeddingUserAgent):
* Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h:
* Source/WebKit/Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
(WebKit::WebPaymentCoordinatorProxy::platformSetPaymentRequestUserAgent):

* Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
* Source/WebKit/Shared/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):

On both platforms, delegate work that needs to be performed with the
payment authorization presenter to the completion handler executed by
WebPaymentCoordinatorProxy::Client once it receives the user agent
string. We do so because the payment authorization presenter must only
be used after our PKPaymentRequest instance is fully fleshed out, which
includes having had its userAgent property assigned correctly.

* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::Internals::getPaymentCoordinatorEmbeddingUserAgent):
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.h:
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in:
* Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm:
(WebKit::NetworkProcessProxy::getPaymentCoordinatorEmbeddingUserAgent):
* Source/WebKit/UIProcess/WebPageProxyInternals.h:

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



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


More information about the webkit-changes mailing list