The shippingOption in the response that is resolved from the promise returned when calling request.show() is always null. I expect the shippingOption to show the user's selected shipping method. I am only able to see the shippingOption inside the onshippingoptionchange event handler. Code Example: const request = new PaymentRequest(...); request.onshippingoptionchange = event => { request.shippingOption; // not null } const response = await request.show(); response.shippingOption; // null request.shippingOption; // null
<rdar://problem/73204387>
Are you providing `requestShipping` (part of the optional `options` 3rd argument) when constructing the `PaymentRequest`? `shippingOption` (and `shippingAddress`) are only populated if you do.
Yes I am providing requestShipping: true. I can confirm this because I am seeing the shippingOption inside the onshippingoptionchange event handler.
Created attachment 417993 [details] Patch
Committed r271703: <https://trac.webkit.org/changeset/271703> All reviewed patches have been landed. Closing bug and clearing flags on attachment 417993 [details].
The new test http/tests/paymentrequest/updateWith-modifiers.https.html is crashing History: https://results.webkit.org/?suite=layout-tests&test=http%2Ftests%2Fpaymentrequest%2FupdateWith-modifiers.https.html Log: No crash log found for com.apple.WebKit.WebContent.Development:3178. stdout: stderr: ASSERTION FAILED: !m_isUpdating ./Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp(586) : virtual void WebCore::ApplePayPaymentHandler::didAuthorizePayment(const WebCore::Payment &) 1 0x773794e69 WTFCrash 2 0x74fde6a3b WTFCrashWithInfo(int, char const*, char const*, int) 3 0x751ad8ca8 WebCore::ApplePayPaymentHandler::didAuthorizePayment(WebCore::Payment const&) 4 0x751a93cc5 WebCore::PaymentCoordinator::didAuthorizePayment(WebCore::Payment const&) 5 0x77f205862 WebCore::MockPaymentCoordinator::acceptPayment()::$_7::operator()() 6 0x77f20571e WTF::Detail::CallableWrapper<WebCore::MockPaymentCoordinator::acceptPayment()::$_7, void>::call() 7 0x77f1bf482 WTF::Function<void ()>::operator()() const 8 0x77f1faf1e WebCore::dispatchIfShowing(WTF::Function<void ()>&&)::$_9::operator()() const 9 0x77f1fae2e WTF::Detail::CallableWrapper<WebCore::dispatchIfShowing(WTF::Function<void ()>&&)::$_9, void>::call() 10 0x7737c1082 WTF::Function<void ()>::operator()() const 11 0x773843585 WTF::RunLoop::performWork() 12 0x773847e21 WTF::RunLoop::performWork(void*) 13 0x7fff2046ba0c __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ 14 0x7fff2046b974 __CFRunLoopDoSource0 15 0x7fff2046b6ef __CFRunLoopDoSources0 16 0x7fff2046a121 __CFRunLoopRun 17 0x7fff204696ce CFRunLoopRunSpecific 18 0x7fff211f6fa1 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] 19 0x7fff21285384 -[NSRunLoop(NSRunLoop) run] 20 0x7fff200c03dd _xpc_objc_main 21 0x7fff200bfe65 _xpc_copy_xpcservice_dictionary 22 0x740d1ebcc WebKit::XPCServiceMain(int, char const**) 23 0x74227eacb WKXPCServiceMain 24 0x1062edea2 main 25 0x7fff2038e621 start LEAK: 1 WebPageProxy
Fixed in r271752.