- Revision
- 285898
- Author
- [email protected]
- Date
- 2021-11-16 16:30:29 -0800 (Tue, 16 Nov 2021)
Log Message
[Apple Pay] handle unknown setup features
https://bugs.webkit.org/show_bug.cgi?id=233212
Reviewed by Wenson Hsieh.
Source/WebCore:
* Modules/applepay/ApplePaySetupFeatureWebCore.h:
* Modules/applepay/ApplePaySetupFeature.mm:
(WebCore::ApplePaySetupFeature::supportsFeature): Added.
(WebCore::ApplePaySetupFeature::type const):
* Modules/applepay/PaymentInstallmentConfiguration.mm:
(WebCore::applePaySetupFeatureType):
(WebCore::platformFeatureType):
(WebCore::PaymentInstallmentConfiguration::applePayInstallmentConfiguration const):
If the `PKPaymentSetupFeatureType` is unknown/unsupported, return an empty `ApplePayInstallmentConfiguration`.
Drive-by: Replace all `PKPaymentSetupFeatureTypeApplePay_X` with `PKPaymentSetupFeatureTypeAppleCard`.
Source/WebCore/PAL:
* pal/spi/cocoa/PassKitSPI.h:
Drive-by: Replace all `PKPaymentSetupFeatureTypeApplePay_X` with `PKPaymentSetupFeatureTypeAppleCard`.
Source/WebKit:
* Shared/ApplePay/ApplePayPaymentSetupFeatures.mm:
(WebKit::PaymentSetupFeatures::operator Vector<Ref<WebCore::ApplePaySetupFeature>> const):
Skip `PKPaymentSetupFeature` that have an unknown `PKPaymentSetupFeatureType`. This ensures
that `WebCore::ApplePaySetupFeature` will only ever be created with known/supported `PKPaymentSetupFeatureType`.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (285897 => 285898)
--- trunk/Source/WebCore/ChangeLog 2021-11-17 00:29:07 UTC (rev 285897)
+++ trunk/Source/WebCore/ChangeLog 2021-11-17 00:30:29 UTC (rev 285898)
@@ -1,3 +1,22 @@
+2021-11-16 Devin Rousso <[email protected]>
+
+ [Apple Pay] handle unknown setup features
+ https://bugs.webkit.org/show_bug.cgi?id=233212
+
+ Reviewed by Wenson Hsieh.
+
+ * Modules/applepay/ApplePaySetupFeatureWebCore.h:
+ * Modules/applepay/ApplePaySetupFeature.mm:
+ (WebCore::ApplePaySetupFeature::supportsFeature): Added.
+ (WebCore::ApplePaySetupFeature::type const):
+
+ * Modules/applepay/PaymentInstallmentConfiguration.mm:
+ (WebCore::applePaySetupFeatureType):
+ (WebCore::platformFeatureType):
+ (WebCore::PaymentInstallmentConfiguration::applePayInstallmentConfiguration const):
+ If the `PKPaymentSetupFeatureType` is unknown/unsupported, return an empty `ApplePayInstallmentConfiguration`.
+ Drive-by: Replace all `PKPaymentSetupFeatureTypeApplePay_X` with `PKPaymentSetupFeatureTypeAppleCard`.
+
2021-11-16 Nikolaos Mouchtaris <[email protected]>
Add overscroll behavior to ScrollableAreaParameters
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySetupFeature.mm (285897 => 285898)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySetupFeature.mm 2021-11-17 00:29:07 UTC (rev 285897)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySetupFeature.mm 2021-11-17 00:30:29 UTC (rev 285898)
@@ -34,6 +34,18 @@
namespace WebCore {
+bool ApplePaySetupFeature::supportsFeature(PKPaymentSetupFeature *feature)
+{
+ switch (feature.type) {
+ case PKPaymentSetupFeatureTypeApplePay:
+ case PKPaymentSetupFeatureTypeAppleCard:
+ return true;
+
+ default:
+ return false;
+ }
+}
+
ApplePaySetupFeature::ApplePaySetupFeature() = default;
ApplePaySetupFeature::~ApplePaySetupFeature() = default;
@@ -42,10 +54,13 @@
switch ([m_feature type]) {
case PKPaymentSetupFeatureTypeApplePay:
return ApplePaySetupFeatureType::ApplePay;
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- case PKPaymentSetupFeatureTypeApplePay_X:
- ALLOW_DEPRECATED_DECLARATIONS_END
+
+ case PKPaymentSetupFeatureTypeAppleCard:
return ApplePaySetupFeatureType::AppleCard;
+
+ default:
+ ASSERT(!supportsFeature(m_feature.get()));
+ return ApplePaySetupFeatureType::ApplePay;
}
}
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h (285897 => 285898)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h 2021-11-17 00:29:07 UTC (rev 285897)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySetupFeatureWebCore.h 2021-11-17 00:30:29 UTC (rev 285898)
@@ -43,6 +43,8 @@
{
return adoptRef(*new ApplePaySetupFeature(feature));
}
+
+ WEBCORE_EXPORT static bool supportsFeature(PKPaymentSetupFeature *);
WEBCORE_EXPORT virtual ~ApplePaySetupFeature();
Modified: trunk/Source/WebCore/Modules/applepay/PaymentInstallmentConfiguration.mm (285897 => 285898)
--- trunk/Source/WebCore/Modules/applepay/PaymentInstallmentConfiguration.mm 2021-11-17 00:29:07 UTC (rev 285897)
+++ trunk/Source/WebCore/Modules/applepay/PaymentInstallmentConfiguration.mm 2021-11-17 00:30:29 UTC (rev 285898)
@@ -57,15 +57,18 @@
return [numberFormatter stringFromNumber:number];
}
-static ApplePaySetupFeatureType applePaySetupFeatureType(PKPaymentSetupFeatureType featureType)
+static std::optional<ApplePaySetupFeatureType> applePaySetupFeatureType(PKPaymentSetupFeatureType featureType)
{
switch (featureType) {
case PKPaymentSetupFeatureTypeApplePay:
return ApplePaySetupFeatureType::ApplePay;
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- case PKPaymentSetupFeatureTypeApplePay_X:
- ALLOW_DEPRECATED_DECLARATIONS_END
+
+ case PKPaymentSetupFeatureTypeAppleCard:
return ApplePaySetupFeatureType::AppleCard;
+
+ default:
+ ASSERT_NOT_REACHED();
+ return std::nullopt;
}
}
@@ -75,9 +78,7 @@
case ApplePaySetupFeatureType::ApplePay:
return PKPaymentSetupFeatureTypeApplePay;
case ApplePaySetupFeatureType::AppleCard:
- ALLOW_DEPRECATED_DECLARATIONS_BEGIN
- return PKPaymentSetupFeatureTypeApplePay_X;
- ALLOW_DEPRECATED_DECLARATIONS_END
+ return PKPaymentSetupFeatureTypeAppleCard;
}
}
@@ -233,7 +234,10 @@
if (!PAL::getPKPaymentInstallmentConfigurationClass())
return installmentConfiguration;
- installmentConfiguration.featureType = applePaySetupFeatureType([m_configuration feature]);
+ if (auto featureType = applePaySetupFeatureType([m_configuration feature]))
+ installmentConfiguration.featureType = *featureType;
+ else
+ return installmentConfiguration;
installmentConfiguration.bindingTotalAmount = fromDecimalNumber([m_configuration bindingTotalAmount]);
installmentConfiguration.currencyCode = [m_configuration currencyCode];
Modified: trunk/Source/WebCore/PAL/ChangeLog (285897 => 285898)
--- trunk/Source/WebCore/PAL/ChangeLog 2021-11-17 00:29:07 UTC (rev 285897)
+++ trunk/Source/WebCore/PAL/ChangeLog 2021-11-17 00:30:29 UTC (rev 285898)
@@ -1,3 +1,13 @@
+2021-11-16 Devin Rousso <[email protected]>
+
+ [Apple Pay] handle unknown setup features
+ https://bugs.webkit.org/show_bug.cgi?id=233212
+
+ Reviewed by Wenson Hsieh.
+
+ * pal/spi/cocoa/PassKitSPI.h:
+ Drive-by: Replace all `PKPaymentSetupFeatureTypeApplePay_X` with `PKPaymentSetupFeatureTypeAppleCard`.
+
2021-11-16 Myles C. Maxfield <[email protected]>
[WebGPU] Start preparing for serializing commands to the GPU process
Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h (285897 => 285898)
--- trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h 2021-11-17 00:29:07 UTC (rev 285897)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/PassKitSPI.h 2021-11-17 00:30:29 UTC (rev 285898)
@@ -368,7 +368,6 @@
typedef NS_ENUM(NSInteger, PKPaymentSetupFeatureType) {
PKPaymentSetupFeatureTypeApplePay,
PKPaymentSetupFeatureTypeAppleCard,
- PKPaymentSetupFeatureTypeApplePay_X API_DEPRECATED_WITH_REPLACEMENT("PKPaymentSetupFeatureTypeAppleCard", ios(12.3, 12.3), macos(10.14.5, 10.14.5)) = PKPaymentSetupFeatureTypeAppleCard,
};
@interface PKPaymentSetupConfiguration : NSObject <NSSecureCoding>
Modified: trunk/Source/WebKit/ChangeLog (285897 => 285898)
--- trunk/Source/WebKit/ChangeLog 2021-11-17 00:29:07 UTC (rev 285897)
+++ trunk/Source/WebKit/ChangeLog 2021-11-17 00:30:29 UTC (rev 285898)
@@ -1,3 +1,15 @@
+2021-11-16 Devin Rousso <[email protected]>
+
+ [Apple Pay] handle unknown setup features
+ https://bugs.webkit.org/show_bug.cgi?id=233212
+
+ Reviewed by Wenson Hsieh.
+
+ * Shared/ApplePay/ApplePayPaymentSetupFeatures.mm:
+ (WebKit::PaymentSetupFeatures::operator Vector<Ref<WebCore::ApplePaySetupFeature>> const):
+ Skip `PKPaymentSetupFeature` that have an unknown `PKPaymentSetupFeatureType`. This ensures
+ that `WebCore::ApplePaySetupFeature` will only ever be created with known/supported `PKPaymentSetupFeatureType`.
+
2021-11-16 Nikolaos Mouchtaris <[email protected]>
Add overscroll behavior to ScrollableAreaParameters
Modified: trunk/Source/WebKit/Shared/ApplePay/ApplePayPaymentSetupFeatures.mm (285897 => 285898)
--- trunk/Source/WebKit/Shared/ApplePay/ApplePayPaymentSetupFeatures.mm 2021-11-17 00:29:07 UTC (rev 285897)
+++ trunk/Source/WebKit/Shared/ApplePay/ApplePayPaymentSetupFeatures.mm 2021-11-17 00:30:29 UTC (rev 285898)
@@ -85,8 +85,10 @@
{
Vector<Ref<WebCore::ApplePaySetupFeature>> features;
features.reserveInitialCapacity([m_platformFeatures count]);
- for (PKPaymentSetupFeature *platformFeature in m_platformFeatures.get())
- features.uncheckedAppend(WebCore::ApplePaySetupFeature::create(platformFeature));
+ for (PKPaymentSetupFeature *platformFeature in m_platformFeatures.get()) {
+ if (WebCore::ApplePaySetupFeature::supportsFeature(platformFeature))
+ features.uncheckedAppend(WebCore::ApplePaySetupFeature::create(platformFeature));
+ }
return features;
}