CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 137
passing data on complete() #982
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@dcrousso, ok... we now do IDL conversion and member validation early, giving the developer an opportunity to recover. And the [[\complete]] = true now happens after the checks. |
… passed to `complete()` https://bugs.webkit.org/show_bug.cgi?id=235415 <rdar://problem/82970451> Reviewed by Darin Adler. Source/WebCore: This allows for developers/merchants to give additional details to Apple Pay on completion. Issue: <w3c/payment-request#981> Spec PR: <w3c/payment-request#982> Test: http/tests/paymentrequest/ApplePayPaymentCompleteDetails.https.html * Modules/paymentrequest/PaymentCompleteDetails.h: Added. * Modules/paymentrequest/PaymentCompleteDetails.idl: Added. * Modules/paymentrequest/PaymentResponse.h: * Modules/paymentrequest/PaymentResponse.idl: * Modules/paymentrequest/PaymentResponse.cpp: (WebCore::PaymentResponse::complete): * Modules/paymentrequest/PaymentRequest.h: * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::PaymentRequest::complete): * Modules/paymentrequest/PaymentHandler.h: Add new `dictionary PaymentCompleteDetails` that's allowed as an optional second argument to `PaymentResponse.prototype.complete`. If provided, JSON stringify it and pass the serialized string data along to the relevant `PaymentHandler` for JSON (re)parsing if the associated payment method requires it. * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::convertAndValidate): (WebCore::merge): (WebCore::ApplePayPaymentHandler::complete): (WebCore::ApplePayPaymentHandler::retry): * Modules/applepay/paymentrequest/ApplePayPaymentCompleteDetails.idl: Added. * Modules/applepay/paymentrequest/ApplePayPaymentCompleteDetails.h: Added. (WebCore::ApplePayPaymentCompleteDetails::encode const): (WebCore::ApplePayPaymentCompleteDetails::decode): Convert the JSON (re)parsed object into a `ApplePayPaymentCompleteDetails`, merging it into the `ApplePayPaymentAuthorizationResult` passed to the `PaymentCoordinator` (see below). * Modules/applepay/ApplePayPaymentAuthorizationResult.h: * Modules/applepay/ApplePayPaymentAuthorizationResult.cpp: Added. (WebCore::ApplePayPaymentAuthorizationResult::isFinalState const): (WebCore::ApplePayPaymentAuthorizationResult::encode const): (WebCore::ApplePayPaymentAuthorizationResult::decode): * Modules/applepay/ApplePaySessionPaymentRequest.h: * Modules/applepay/ApplePaySessionPaymentRequest.cpp: (WebCore::isFinalStateResult): Deleted. * Modules/applepay/ApplePaySession.h: * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): (WebCore::ApplePaySession::completePayment): * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinator.cpp: (WebCore::PaymentCoordinator::completePaymentSession): * Modules/applepay/PaymentCoordinatorClient.h: * loader/EmptyClients.cpp: * testing/MockPaymentCoordinator.h: * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::completePaymentSession): Replace `PaymentAuthorizationResult` with `ApplePayPaymentAuthorizationResult` so that data doesn't need to be moved between identically shaped structs for sending to the UIProcess. * Modules/applepay/cocoa/PaymentAPIVersionCocoa.mm: (WebCore::PaymentAPIVersion::current): Increment the current version. * Modules/applepay-ams-ui/ApplePayAMSUIPaymentHandler.h: * Modules/applepay-ams-ui/ApplePayAMSUIPaymentHandler.cpp: (WebCore::ApplePayAMSUIPaymentHandler::complete): AMS UI does not allow/require any data to be provided on completion. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * PlatformMac.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: Source/WebKit: This allows for developers/merchants to give additional details to Apple Pay on completion. Issue: <w3c/payment-request#981> Spec PR: <w3c/payment-request#982> * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::completePaymentSession): * Scripts/webkit/messages.py: (headers_for_type): * Shared/WebCoreArgumentCoders.h: * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::encode): Deleted. (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode): Deleted. * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: * Shared/ApplePay/WebPaymentCoordinatorProxy.h: * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::completePaymentSession): * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession): * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: * Platform/cocoa/PaymentAuthorizationPresenter.h: * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::toPKPaymentAuthorizationStatus): (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Replace `PaymentAuthorizationResult` with `ApplePayPaymentAuthorizationResult` so that data doesn't need to be moved between identically shaped structs for sending to the UIProcess. * Platform/cocoa/WKPaymentAuthorizationDelegate.h: * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Add some WKA hooks. Source/WebKitLegacy/mac: * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::completePaymentSession): LayoutTests: * http/tests/paymentrequest/ApplePayPaymentCompleteDetails.https.html: Added. * http/tests/paymentrequest/ApplePayPaymentCompleteDetails.https-expected.txt: Added. Canonical link: https://commits.webkit.org/246496@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288698 268f45cc-cd09-0410-ab3c-d52691b4dbfc
… passed to `complete()` https://bugs.webkit.org/show_bug.cgi?id=235415 <rdar://problem/82970451> Reviewed by Darin Adler. Source/WebCore: This allows for developers/merchants to give additional details to Apple Pay on completion. Issue: <w3c/payment-request#981> Spec PR: <w3c/payment-request#982> Test: http/tests/paymentrequest/ApplePayPaymentCompleteDetails.https.html * Modules/paymentrequest/PaymentCompleteDetails.h: Added. * Modules/paymentrequest/PaymentCompleteDetails.idl: Added. * Modules/paymentrequest/PaymentResponse.h: * Modules/paymentrequest/PaymentResponse.idl: * Modules/paymentrequest/PaymentResponse.cpp: (WebCore::PaymentResponse::complete): * Modules/paymentrequest/PaymentRequest.h: * Modules/paymentrequest/PaymentRequest.cpp: (WebCore::PaymentRequest::complete): * Modules/paymentrequest/PaymentHandler.h: Add new `dictionary PaymentCompleteDetails` that's allowed as an optional second argument to `PaymentResponse.prototype.complete`. If provided, JSON stringify it and pass the serialized string data along to the relevant `PaymentHandler` for JSON (re)parsing if the associated payment method requires it. * Modules/applepay/paymentrequest/ApplePayPaymentHandler.h: * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp: (WebCore::convertAndValidate): (WebCore::merge): (WebCore::ApplePayPaymentHandler::complete): (WebCore::ApplePayPaymentHandler::retry): * Modules/applepay/paymentrequest/ApplePayPaymentCompleteDetails.idl: Added. * Modules/applepay/paymentrequest/ApplePayPaymentCompleteDetails.h: Added. (WebCore::ApplePayPaymentCompleteDetails::encode const): (WebCore::ApplePayPaymentCompleteDetails::decode): Convert the JSON (re)parsed object into a `ApplePayPaymentCompleteDetails`, merging it into the `ApplePayPaymentAuthorizationResult` passed to the `PaymentCoordinator` (see below). * Modules/applepay/ApplePayPaymentAuthorizationResult.h: * Modules/applepay/ApplePayPaymentAuthorizationResult.cpp: Added. (WebCore::ApplePayPaymentAuthorizationResult::isFinalState const): (WebCore::ApplePayPaymentAuthorizationResult::encode const): (WebCore::ApplePayPaymentAuthorizationResult::decode): * Modules/applepay/ApplePaySessionPaymentRequest.h: * Modules/applepay/ApplePaySessionPaymentRequest.cpp: (WebCore::isFinalStateResult): Deleted. * Modules/applepay/ApplePaySession.h: * Modules/applepay/ApplePaySession.cpp: (WebCore::convertAndValidate): (WebCore::ApplePaySession::completePayment): * Modules/applepay/PaymentCoordinator.h: * Modules/applepay/PaymentCoordinator.cpp: (WebCore::PaymentCoordinator::completePaymentSession): * Modules/applepay/PaymentCoordinatorClient.h: * loader/EmptyClients.cpp: * testing/MockPaymentCoordinator.h: * testing/MockPaymentCoordinator.cpp: (WebCore::MockPaymentCoordinator::completePaymentSession): Replace `PaymentAuthorizationResult` with `ApplePayPaymentAuthorizationResult` so that data doesn't need to be moved between identically shaped structs for sending to the UIProcess. * Modules/applepay/cocoa/PaymentAPIVersionCocoa.mm: (WebCore::PaymentAPIVersion::current): Increment the current version. * Modules/applepay-ams-ui/ApplePayAMSUIPaymentHandler.h: * Modules/applepay-ams-ui/ApplePayAMSUIPaymentHandler.cpp: (WebCore::ApplePayAMSUIPaymentHandler::complete): AMS UI does not allow/require any data to be provided on completion. * CMakeLists.txt: * DerivedSources-input.xcfilelist: * DerivedSources-output.xcfilelist: * DerivedSources.make: * Headers.cmake: * PlatformMac.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: Source/WebKit: This allows for developers/merchants to give additional details to Apple Pay on completion. Issue: <w3c/payment-request#981> Spec PR: <w3c/payment-request#982> * WebProcess/ApplePay/WebPaymentCoordinator.h: * WebProcess/ApplePay/WebPaymentCoordinator.cpp: (WebKit::WebPaymentCoordinator::completePaymentSession): * Scripts/webkit/messages.py: (headers_for_type): * Shared/WebCoreArgumentCoders.h: * Shared/Cocoa/WebCoreArgumentCodersCocoa.mm: (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::encode): Deleted. (IPC::ArgumentCoder<WebCore::PaymentAuthorizationResult>::decode): Deleted. * Shared/ApplePay/WebPaymentCoordinatorProxy.messages.in: * Shared/ApplePay/WebPaymentCoordinatorProxy.h: * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp: (WebKit::WebPaymentCoordinatorProxy::completePaymentSession): * Shared/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: (WebKit::WebPaymentCoordinatorProxy::platformCompletePaymentSession): * Shared/ApplePay/ios/WebPaymentCoordinatorProxyIOS.mm: * Platform/cocoa/PaymentAuthorizationPresenter.h: * Platform/cocoa/PaymentAuthorizationPresenter.mm: (WebKit::toPKPaymentAuthorizationStatus): (WebKit::PaymentAuthorizationPresenter::completePaymentSession): Replace `PaymentAuthorizationResult` with `ApplePayPaymentAuthorizationResult` so that data doesn't need to be moved between identically shaped structs for sending to the UIProcess. * Platform/cocoa/WKPaymentAuthorizationDelegate.h: * Platform/cocoa/WKPaymentAuthorizationDelegate.mm: Add some WKA hooks. Source/WebKitLegacy/mac: * WebCoreSupport/WebPaymentCoordinatorClient.h: * WebCoreSupport/WebPaymentCoordinatorClient.mm: (WebPaymentCoordinatorClient::completePaymentSession): LayoutTests: * http/tests/paymentrequest/ApplePayPaymentCompleteDetails.https.html: Added. * http/tests/paymentrequest/ApplePayPaymentCompleteDetails.https-expected.txt: Added. git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288698 268f45cc-cd09-0410-ab3c-d52691b4dbfc
8b94e5f
to
e76b31d
Compare
@stephenmcgruer, @rsolomakhin, would appreciate your review on this addition? |
Is there a link to the WebKit issue available? |
I found https://bugs.webkit.org/show_bug.cgi?id=235415 and WebKit/WebKit@2fbfd75, but looks like the 'real' issue is an internal Apple one (which is of course ok :)) |
Yeah, this just adds optional proprietary behavior for completing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (and @rsolomakhin )
I personally am a fan of having defined concepts rather than prose where possible (e.g., I don't like "an IDL value of the type specified by the specification"), but I acknowledge (a) that that may just be my opinion and (b) that at least for now no public specification exists that will link to this.
Putting on my Chrome hat, I believe we'll be happy to make the IDL change in our implementation though we will likely not do anything with the passed data.
Updating the WPT tests would be great! :)
Thanks @stephenmcgruer! I agree with you about "an IDL value of the type specified by the specification". If eventually we have a spec to link to, will definitely update.
We should get some tests for free from WPT once we merge (at least for the method signature length). I'm not sure it's worth adding a manual test, but can add one if you think it's worth it. |
Of course, I completely forgot about idlharness tests >_<. (Which I really shouldn't, given my history in WPT!). I think that is sufficient for this use-case, thanks :) |
This reverts commit 5337037.
closes #981
The following tasks have been completed:
Implementation commitment:
Optional, impact on Payment Handler spec?
Preview | Diff