Changeset 223580 in webkit
- Timestamp:
- Oct 17, 2017 2:41:57 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r223578 r223580 1 2017-10-16 Andy Estes <aestes@apple.com> 2 3 [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError 4 https://bugs.webkit.org/show_bug.cgi?id=178191 5 <rdar://problem/34906367> 6 7 Reviewed by Tim Horton. 8 9 * http/tests/ssl/applepay/ApplePayError-expected.txt: 10 * http/tests/ssl/applepay/ApplePaySession-expected.txt: 11 * http/tests/ssl/applepay/ApplePaySession.html: 12 1 13 2017-10-17 Myles C. Maxfield <mmaxfield@apple.com> 2 14 -
trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt
r223566 r223580 28 28 29 29 SETUP: 30 PASS new ApplePayError('unknown', []) threw exception TypeError: Argument 2 ('contactField') to the ApplePayError constructor must be one of: "phoneNumber", "emailAddress", "name", "phoneticName", "postalAddress", "addressLines", " locality", "postalCode", "administrativeArea", "country", "countryCode".30 PASS new ApplePayError('unknown', []) threw exception TypeError: Argument 2 ('contactField') to the ApplePayError constructor must be one of: "phoneNumber", "emailAddress", "name", "phoneticName", "postalAddress", "addressLines", "subLocality", "locality", "postalCode", "subAdministrativeArea", "administrativeArea", "country", "countryCode". 31 31 32 32 SETUP: 33 PASS new ApplePayError('unknown', '') threw exception TypeError: Argument 2 ('contactField') to the ApplePayError constructor must be one of: "phoneNumber", "emailAddress", "name", "phoneticName", "postalAddress", "addressLines", " locality", "postalCode", "administrativeArea", "country", "countryCode".33 PASS new ApplePayError('unknown', '') threw exception TypeError: Argument 2 ('contactField') to the ApplePayError constructor must be one of: "phoneNumber", "emailAddress", "name", "phoneticName", "postalAddress", "addressLines", "subLocality", "locality", "postalCode", "subAdministrativeArea", "administrativeArea", "country", "countryCode". 34 34 35 35 SETUP: -
trunk/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt
r223566 r223580 261 261 PASS new ApplePaySession(2, request) did not throw exception. 262 262 263 SETUP: request = validRequest(); request.billingContact = { subLocality: '', subAdministrativeArea: '' }; 264 PASS new ApplePaySession(2, request) did not throw exception. 265 263 266 Testing PaymentRequest.requiredShippingContactFields 264 267 … … 322 325 PASS new ApplePaySession(2, request) did not throw exception. 323 326 327 SETUP: request = validRequest(); request.shippingContact = { subLocality: '', subAdministrativeArea: '' }; 328 PASS new ApplePaySession(2, request) did not throw exception. 329 324 330 Testing PaymentRequest.shippingType 325 331 -
trunk/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html
r223566 r223580 149 149 logAndShouldNotThrow("request = validRequest(); request.billingContact = undefined;", "new ApplePaySession(2, request)") 150 150 logAndShouldNotThrow("request = validRequest(); request.billingContact = { };", "new ApplePaySession(2, request)") 151 logAndShouldNotThrow("request = validRequest(); request.billingContact = { subLocality: '', subAdministrativeArea: '' };", "new ApplePaySession(2, request)") 151 152 152 153 debug("Testing PaymentRequest.requiredShippingContactFields") … … 175 176 logAndShouldNotThrow("request = validRequest(); request.shippingContact = undefined;", "new ApplePaySession(2, request)") 176 177 logAndShouldNotThrow("request = validRequest(); request.shippingContact = { };", "new ApplePaySession(2, request)") 178 logAndShouldNotThrow("request = validRequest(); request.shippingContact = { subLocality: '', subAdministrativeArea: '' };", "new ApplePaySession(2, request)") 177 179 178 180 debug("Testing PaymentRequest.shippingType") -
trunk/Source/WebCore/ChangeLog
r223579 r223580 1 2017-10-16 Andy Estes <aestes@apple.com> 2 3 [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError 4 https://bugs.webkit.org/show_bug.cgi?id=178191 5 <rdar://problem/34906367> 6 7 Reviewed by Tim Horton. 8 9 Added test cases to http/tests/ssl/applepay/ApplePaySession.html. 10 11 * Modules/applepay/ApplePayError.idl: 12 * Modules/applepay/ApplePayPaymentContact.h: 13 * Modules/applepay/ApplePayPaymentContact.idl: 14 * Modules/applepay/ApplePaySessionPaymentRequest.h: 15 * Modules/applepay/cocoa/PaymentContactCocoa.mm: 16 (WebCore::subLocality): 17 (WebCore::setSubLocality): 18 (WebCore::subAdministrativeArea): 19 (WebCore::setSubAdministrativeArea): 20 (WebCore::convert): 21 1 22 2017-10-17 Commit Queue <commit-queue@webkit.org> 2 23 -
trunk/Source/WebCore/Modules/applepay/ApplePayError.idl
r223566 r223580 42 42 "postalAddress", 43 43 "addressLines", 44 "subLocality", 44 45 "locality", 45 46 "postalCode", 47 "subAdministrativeArea", 46 48 "administrativeArea", 47 49 "country", -
trunk/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h
r223566 r223580 42 42 String phoneticFamilyName; 43 43 std::optional<Vector<String>> addressLines; 44 String subLocality; 44 45 String locality; 45 46 String postalCode; 47 String subAdministrativeArea; 46 48 String administrativeArea; 47 49 String country; -
trunk/Source/WebCore/Modules/applepay/ApplePayPaymentContact.idl
r223566 r223580 35 35 [Conditional=APPLE_PAY_SESSION_V3] DOMString phoneticFamilyName; 36 36 sequence<DOMString> addressLines; 37 DOMString subLocality; 37 38 DOMString locality; 38 39 DOMString postalCode; 40 DOMString subAdministrativeArea; 39 41 DOMString administrativeArea; 40 42 DOMString country; -
trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h
r223566 r223580 168 168 PostalAddress, 169 169 AddressLines, 170 SubLocality, 170 171 Locality, 171 172 PostalCode, 173 SubAdministrativeArea, 172 174 AdministrativeArea, 173 175 Country, -
trunk/Source/WebCore/Modules/applepay/cocoa/PaymentContactCocoa.mm
r223566 r223580 49 49 namespace WebCore { 50 50 51 static NSString *subLocality(CNPostalAddress *address) 52 { 53 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101204) 54 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300 55 if (![address respondsToSelector:@selector(subLocality)]) 56 return nil; 57 #endif 58 return address.subLocality; 59 #else 60 return nil; 61 #endif 62 } 63 64 static void setSubLocality(CNMutablePostalAddress *address, NSString *subLocality) 65 { 66 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101204) 67 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300 68 if (![address respondsToSelector:@selector(setSubLocality:)]) 69 return; 70 #endif 71 address.subLocality = subLocality; 72 #endif 73 } 74 75 static NSString *subAdministrativeArea(CNPostalAddress *address) 76 { 77 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101204) 78 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300 79 if (![address respondsToSelector:@selector(subAdministrativeArea)]) 80 return nil; 81 #endif 82 return address.subAdministrativeArea; 83 #else 84 return nil; 85 #endif 86 } 87 88 static void setSubAdministrativeArea(CNMutablePostalAddress *address, NSString *subAdministrativeArea) 89 { 90 #if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101204) 91 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300 92 if (![address respondsToSelector:@selector(setSubAdministrativeArea:)]) 93 return; 94 #endif 95 address.subAdministrativeArea = subAdministrativeArea; 96 #endif 97 } 98 51 99 static RetainPtr<PKContact> convert(unsigned version, const ApplePayPaymentContact& contact) 52 100 { … … 101 149 [address setStreet:builder.toString()]; 102 150 151 if (!contact.subLocality.isEmpty()) 152 setSubLocality(address.get(), contact.subLocality); 103 153 if (!contact.locality.isEmpty()) 104 154 [address setCity:contact.locality]; 105 155 if (!contact.postalCode.isEmpty()) 106 156 [address setPostalCode:contact.postalCode]; 157 if (!contact.subAdministrativeArea.isEmpty()) 158 setSubAdministrativeArea(address.get(), contact.subAdministrativeArea); 107 159 if (!contact.administrativeArea.isEmpty()) 108 160 [address setState:contact.administrativeArea]; … … 141 193 result.addressLines = WTFMove(addressLines); 142 194 } 195 result.subLocality = subLocality(postalAddress); 143 196 result.locality = postalAddress.city; 144 197 result.postalCode = postalAddress.postalCode; 198 result.subAdministrativeArea = subAdministrativeArea(postalAddress); 145 199 result.administrativeArea = postalAddress.state; 146 200 result.country = postalAddress.country; -
trunk/Source/WebKit/ChangeLog
r223574 r223580 1 2017-10-16 Andy Estes <aestes@apple.com> 2 3 [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError 4 https://bugs.webkit.org/show_bug.cgi?id=178191 5 <rdar://problem/34906367> 6 7 Reviewed by Tim Horton. 8 9 * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: 10 (WebKit::toNSError): 11 1 12 2017-10-17 Sam Weinig <sam@webkit.org> 2 13 -
trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm
r223566 r223580 64 64 SOFT_LINK_FRAMEWORK(Contacts) 65 65 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressStreetKey, NSString *); 66 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressSubLocalityKey, NSString *); 66 67 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressCityKey, NSString *); 68 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressSubAdministrativeAreaKey, NSString *); 67 69 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressStateKey, NSString *); 68 70 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressPostalCodeKey, NSString *); … … 657 659 break; 658 660 661 case WebCore::PaymentError::ContactField::SubLocality: 662 pkContactField = getPKContactFieldPostalAddress(); 663 postalAddressKey = getCNPostalAddressSubLocalityKey(); 664 break; 665 659 666 case WebCore::PaymentError::ContactField::Locality: 660 667 pkContactField = getPKContactFieldPostalAddress(); … … 665 672 pkContactField = getPKContactFieldPostalAddress(); 666 673 postalAddressKey = getCNPostalAddressPostalCodeKey(); 674 break; 675 676 case WebCore::PaymentError::ContactField::SubAdministrativeArea: 677 pkContactField = getPKContactFieldPostalAddress(); 678 postalAddressKey = getCNPostalAddressSubAdministrativeAreaKey(); 667 679 break; 668 680
Note: See TracChangeset
for help on using the changeset viewer.