[webkit-changes] [WebKit/WebKit] d9d8f6: [visionOS] Payment sheet not showing up when a vie...

Abrar Rahman Protyasha noreply at github.com
Tue Jan 30 17:52:04 PST 2024


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

  Changed paths:
    M Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
    M Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm
    M Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.h
    M Source/WebKit/Platform/cocoa/PaymentAuthorizationViewController.h
    M Source/WebKit/Platform/cocoa/PaymentAuthorizationViewController.mm
    M Source/WebKit/Platform/ios/PaymentAuthorizationController.h
    M Source/WebKit/Platform/ios/PaymentAuthorizationController.mm
    M Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h
    M Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm
    M Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h
    M Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp
    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
    M Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

  Log Message:
  -----------
  [visionOS] Payment sheet not showing up when a view service tries to present it on a host application owned scene
https://bugs.webkit.org/show_bug.cgi?id=268400
rdar://121673521

Reviewed by Tim Horton.

PKPaymentAuthorizationController needs to be vended a scene ID and bundle
ID pair that correspond to each other for it to successfully present a
payment sheet on a scene. Unfortunately, when there is an embedded view
service in a host application, we:

1. Supply a bogus scene ID because view services don't have an associated
scene ID.
2. Supply the bundle identifier of the view service and not the hosting
application, which actually owns the scene to be presented in.

To address (1), we consult `-[WKUIDelegatePrivate _hostSceneBundleIdentifierForWebView:]`
when we fetch a scene identifier for payment presentation. This ensures
that we supply the _host_ scene identifier to PKPaymentAuthorizationController,
where it can actually present a payment sheet.

However, since we don't provide the bundle identifier of the host
application, we're still supplying a mismatching scene/bundle ID pair, so
the controller can't present a payment sheet successfully. This is
resolved by addressing (2), for which we introduce a new
WKUIDelegatePrivate method `_hostSceneBundleIdentifierForWebView:`. We
consult this when we fetch a bundle identifier for payment presentation,
ensuring that we supply the bundle identifier corresponding to the _host_
application that owns the scene where we would like to present a payment
sheet.

* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
* Source/WebKit/NetworkProcess/ios/NetworkConnectionToWebProcessIOS.mm:
(WebKit::NetworkConnectionToWebProcess::getWindowSceneAndBundleIdentifierForPaymentPresentation):
(WebKit::NetworkConnectionToWebProcess::getWindowSceneIdentifierForPaymentPresentation): Deleted.
* Source/WebKit/Platform/cocoa/PaymentAuthorizationPresenter.h:
(WebKit::PaymentAuthorizationPresenter::bundleIdentifier const):
* Source/WebKit/Platform/cocoa/PaymentAuthorizationViewController.h:
* Source/WebKit/Platform/cocoa/PaymentAuthorizationViewController.mm:
(WebKit::PaymentAuthorizationViewController::presentInScene):
* Source/WebKit/Platform/ios/PaymentAuthorizationController.h:
* Source/WebKit/Platform/ios/PaymentAuthorizationController.mm:
(-[WKPaymentAuthorizationControllerDelegate presentationSceneBundleIdentifierForPaymentAuthorizationController:]):
(WebKit::PaymentAuthorizationController::presentInScene):
* Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.h:
* Source/WebKit/Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm:
(WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI):
* Source/WebKit/UIProcess/API/Cocoa/WKUIDelegatePrivate.h:
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getWindowSceneIdentifierForPaymentPresentation): Deleted.
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.h:
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.messages.in:
* Source/WebKit/UIProcess/Network/NetworkProcessProxyCocoa.mm:
(WebKit::NetworkProcessProxy::getWindowSceneAndBundleIdentifierForPaymentPresentation):
* Source/WebKit/UIProcess/WebPageProxyInternals.h:
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::Internals::getWindowSceneAndBundleIdentifierForPaymentPresentation):
(WebKit::WebPageProxy::Internals::getWindowSceneIdentifierForPaymentPresentation): Deleted.

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




More information about the webkit-changes mailing list