Diff
Modified: trunk/Source/WebCore/ChangeLog (213945 => 213946)
--- trunk/Source/WebCore/ChangeLog 2017-03-14 22:23:06 UTC (rev 213945)
+++ trunk/Source/WebCore/ChangeLog 2017-03-14 22:32:10 UTC (rev 213946)
@@ -1,3 +1,17 @@
+2017-03-14 Anders Carlsson <ander...@apple.com>
+
+ Propagate PassKit errors
+ https://bugs.webkit.org/show_bug.cgi?id=169633
+ rdar://problem/31043392
+
+ Reviewed by Dean Jackson.
+
+ * Modules/applepay/ApplePayError.idl:
+ * Modules/applepay/ApplePaySession.cpp:
+ (WebCore::convert):
+ (WebCore::convertAndValidate):
+ * Modules/applepay/PaymentRequest.h:
+
2017-03-14 Alan Kinsley <za...@apple.com>
Simple line layout: Adjust hyphenation constrains based on the normal line layout line-breaking logic.
Modified: trunk/Source/WebCore/Modules/applepay/ApplePayError.idl (213945 => 213946)
--- trunk/Source/WebCore/Modules/applepay/ApplePayError.idl 2017-03-14 22:23:06 UTC (rev 213945)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayError.idl 2017-03-14 22:32:10 UTC (rev 213946)
@@ -37,14 +37,12 @@
] enum ApplePayErrorContactField {
"phoneNumber",
"emailAddress",
- "givenName",
- "familyName",
- "addressLines",
+ "name",
+ "address",
"locality",
"postalCode",
"administrativeArea",
- "country",
- "countryCode"
+ "country"
};
[
Modified: trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp (213945 => 213946)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2017-03-14 22:23:06 UTC (rev 213945)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySession.cpp 2017-03-14 22:32:10 UTC (rev 213946)
@@ -413,6 +413,23 @@
}
}
+static Vector<PaymentError> convert(const Vector<RefPtr<ApplePayError>>& errors)
+{
+ Vector<PaymentError> convertedErrors;
+
+ for (auto& error : errors) {
+ PaymentError convertedError;
+
+ convertedError.code = error->code();
+ convertedError.message = error->message();
+ convertedError.contactField = error->contactField();
+
+ convertedErrors.append(convertedError);
+ }
+
+ return convertedErrors;
+}
+
static ExceptionOr<PaymentAuthorizationResult> convertAndValidate(ApplePayPaymentAuthorizationResult&& result)
{
PaymentAuthorizationResult convertedResult;
@@ -421,6 +438,7 @@
if (!authorizationStatus)
return Exception { INVALID_ACCESS_ERR };
convertedResult.status = *authorizationStatus;
+ convertedResult.errors = convert(result.errors);
return WTFMove(convertedResult);
}
Modified: trunk/Source/WebCore/Modules/applepay/PaymentRequest.h (213945 => 213946)
--- trunk/Source/WebCore/Modules/applepay/PaymentRequest.h 2017-03-14 22:23:06 UTC (rev 213945)
+++ trunk/Source/WebCore/Modules/applepay/PaymentRequest.h 2017-03-14 22:32:10 UTC (rev 213946)
@@ -161,14 +161,12 @@
enum class ContactField {
PhoneNumber,
EmailAddress,
- GivenName,
- FamilyName,
- AddressLines,
+ Name,
+ Address,
Locality,
PostalCode,
AdministrativeArea,
Country,
- CountryCode,
};
Code code;
@@ -218,14 +216,12 @@
WebCore::PaymentError::ContactField,
WebCore::PaymentError::ContactField::PhoneNumber,
WebCore::PaymentError::ContactField::EmailAddress,
- WebCore::PaymentError::ContactField::GivenName,
- WebCore::PaymentError::ContactField::FamilyName,
- WebCore::PaymentError::ContactField::AddressLines,
+ WebCore::PaymentError::ContactField::Name,
+ WebCore::PaymentError::ContactField::Address,
WebCore::PaymentError::ContactField::Locality,
WebCore::PaymentError::ContactField::PostalCode,
WebCore::PaymentError::ContactField::AdministrativeArea,
- WebCore::PaymentError::ContactField::Country,
- WebCore::PaymentError::ContactField::CountryCode
+ WebCore::PaymentError::ContactField::Country
>;
};
Modified: trunk/Source/WebKit2/ChangeLog (213945 => 213946)
--- trunk/Source/WebKit2/ChangeLog 2017-03-14 22:23:06 UTC (rev 213945)
+++ trunk/Source/WebKit2/ChangeLog 2017-03-14 22:32:10 UTC (rev 213946)
@@ -1,3 +1,14 @@
+2017-03-14 Anders Carlsson <ander...@apple.com>
+
+ Propagate PassKit errors
+ https://bugs.webkit.org/show_bug.cgi?id=169633
+ rdar://problem/31043392
+
+ Reviewed by Dean Jackson.
+
+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+ (WebKit::toNSError):
+
2017-03-06 Jer Noble <jer.no...@apple.com>
Refactor: Allow WebKit2 to override the creation of RealtimeMediaSources
Modified: trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (213945 => 213946)
--- trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2017-03-14 22:23:06 UTC (rev 213945)
+++ trunk/Source/WebKit2/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2017-03-14 22:32:10 UTC (rev 213946)
@@ -58,11 +58,23 @@
SOFT_LINK_CONSTANT(PassKit, PKPaymentNetworkVisa, NSString *);
#if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000)
+SOFT_LINK_FRAMEWORK(Contacts)
+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressStreetKey, NSString *);
+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressCityKey, NSString *);
+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressStateKey, NSString *);
+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressPostalCodeKey, NSString *);
+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressCountryKey, NSString *);
SOFT_LINK_CLASS(PassKit, PKPaymentAuthorizationResult)
SOFT_LINK_CLASS(PassKit, PKPaymentRequestPaymentMethodUpdate)
SOFT_LINK_CLASS(PassKit, PKPaymentRequestShippingContactUpdate)
SOFT_LINK_CLASS(PassKit, PKPaymentRequestShippingMethodUpdate)
SOFT_LINK_CONSTANT(PassKit, PKPaymentErrorDomain, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKContactFieldPostalAddress, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKContactFieldEmailAddress, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKContactFieldPhoneNumber, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKContactFieldName, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKPaymentErrorContactFieldUserInfoKey, NSString *);
+SOFT_LINK_CONSTANT(PassKit, PKPaymentErrorPostalAddressUserInfoKey, NSString *);
#endif
typedef void (^PKCanMakePaymentsCompletion)(BOOL isValid, NSError *error);
@@ -547,8 +559,53 @@
auto userInfo = adoptNS([[NSMutableDictionary alloc] init]);
[userInfo setObject:error.message forKey:NSLocalizedDescriptionKey];
- // FIXME: Set the contact field key.
+ if (error.contactField) {
+ NSString *pkContactField = nil;
+ NSString *postalAddressKey = nil;
+ switch (*error.contactField) {
+ case WebCore::PaymentError::ContactField::PhoneNumber:
+ pkContactField = getPKContactFieldPhoneNumber();
+ break;
+
+ case WebCore::PaymentError::ContactField::EmailAddress:
+ pkContactField = getPKContactFieldEmailAddress();
+ break;
+
+ case WebCore::PaymentError::ContactField::Name:
+ pkContactField = getPKContactFieldName();
+ break;
+
+ case WebCore::PaymentError::ContactField::Address:
+ pkContactField = getPKContactFieldPostalAddress();
+ postalAddressKey = getCNPostalAddressStreetKey();
+ break;
+
+ case WebCore::PaymentError::ContactField::Locality:
+ pkContactField = getPKContactFieldPostalAddress();
+ postalAddressKey = getCNPostalAddressCityKey();
+ break;
+
+ case WebCore::PaymentError::ContactField::PostalCode:
+ pkContactField = getPKContactFieldPostalAddress();
+ postalAddressKey = getCNPostalAddressPostalCodeKey();
+ break;
+
+ case WebCore::PaymentError::ContactField::AdministrativeArea:
+ pkContactField = getPKContactFieldPostalAddress();
+ postalAddressKey = getCNPostalAddressCityKey();
+ break;
+
+ case WebCore::PaymentError::ContactField::Country:
+ pkContactField = getPKContactFieldPostalAddress();
+ postalAddressKey = getCNPostalAddressCountryKey();
+ break;
+ }
+
+ [userInfo setObject:pkContactField forKey:getPKPaymentErrorContactFieldUserInfoKey()];
+ [userInfo setObject:postalAddressKey forKey:getPKPaymentErrorPostalAddressUserInfoKey()];
+ }
+
return adoptNS([[NSError alloc] initWithDomain:getPKPaymentErrorDomain() code:toPKPaymentErrorCode(error.code) userInfo:userInfo.get()]);
}