[webkit-changes] [WebKit/WebKit] e5afaf: supportedCountries only works on ApplePaySession, ...
Abrar Rahman Protyasha
noreply at github.com
Fri Aug 11 13:42:25 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e5afaf96365a3fc5f7447ce08a1b756ecac62117
https://github.com/WebKit/WebKit/commit/e5afaf96365a3fc5f7447ce08a1b756ecac62117
Author: Abrar Rahman Protyasha <a_protyasha at apple.com>
Date: 2023-08-11 (Fri, 11 Aug 2023)
Changed paths:
A LayoutTests/http/tests/paymentrequest/paymentrequest-supportedCountries.https-expected.txt
A LayoutTests/http/tests/paymentrequest/paymentrequest-supportedCountries.https.html
M LayoutTests/http/tests/resources/payment-request.js
M Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp
M Source/WebCore/Modules/applepay/ApplePayRequestBase.h
M Source/WebCore/testing/MockPaymentCoordinator.cpp
M Source/WebCore/testing/MockPaymentCoordinator.h
M Source/WebCore/testing/MockPaymentCoordinator.idl
Log Message:
-----------
supportedCountries only works on ApplePaySession, not PaymentRequest (affects Shopify)
https://bugs.webkit.org/show_bug.cgi?id=259940
rdar://113557607
Reviewed by Alex Christensen.
The `supportedCountries` property only seems to be reflected in a payment
request when it is set in an ApplePayJS request, and not the W3C Payment
Request API. This is because we end up calling
`WebCore::convertAndValidate()` multiple times for `ApplePayRequestBase`
in the Payment Request flow, which means we end up `WTFMove`-ing the
`supportedCountries` vector on the first call and said vector is empty
on subsequent entries into the function, so we ultimately set it to an
empty vector.
The multiple calls to `WebCore::convertAndValidate()` is an architectural
issue that we should address (https://bugs.webkit.org/show_bug.cgi?id=260050),
but in the meantime we opt to fix the issue by copying the
`supportedCountries` vector before moving it at the
`setSupportedCountries()` callsite in `WebCore::convertAndValidate()`.
We also modify `WebCore::convertAndValidate()`'s signature to expect a
const L-value reference to `ApplePayRequestBase` instead, which should
mitigate against accidental data corruption.
This patch also introduces a layout test (and some associated Internals
plumbing) that improves our test coverage for the `supportedCountries`
attribute in payment requests.
* LayoutTests/http/tests/paymentrequest/paymentrequest-supportedCountries.https-expected.txt: Added.
* LayoutTests/http/tests/paymentrequest/paymentrequest-supportedCountries.https.html: Added.
* LayoutTests/http/tests/resources/payment-request.js:
(async validPaymentMethod):
* Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp:
(WebCore::convertAndValidate):
* Source/WebCore/Modules/applepay/ApplePayRequestBase.h:
* Source/WebCore/testing/MockPaymentCoordinator.cpp:
(WebCore::MockPaymentCoordinator::showPaymentUI):
* Source/WebCore/testing/MockPaymentCoordinator.h:
* Source/WebCore/testing/MockPaymentCoordinator.idl:
Canonical link: https://commits.webkit.org/266829@main
More information about the webkit-changes
mailing list