Title: [223675] branches/safari-604-branch

Diff

Modified: branches/safari-604-branch/LayoutTests/ChangeLog (223674 => 223675)


--- branches/safari-604-branch/LayoutTests/ChangeLog	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/LayoutTests/ChangeLog	2017-10-19 05:14:59 UTC (rev 223675)
@@ -1,5 +1,21 @@
 2017-10-18  Jason Marcell  <[email protected]>
 
+        Cherry-pick r223580. rdar://problem/34958773
+
+    2017-10-16  Andy Estes  <[email protected]>
+
+            [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
+            https://bugs.webkit.org/show_bug.cgi?id=178191
+            <rdar://problem/34906367>
+
+            Reviewed by Tim Horton.
+
+            * http/tests/ssl/applepay/ApplePayError-expected.txt:
+            * http/tests/ssl/applepay/ApplePaySession-expected.txt:
+            * http/tests/ssl/applepay/ApplePaySession.html:
+
+2017-10-18  Jason Marcell  <[email protected]>
+
         Cherry-pick r223210. rdar://problem/34820936
 
     2017-10-11  Simon Fraser  <[email protected]>

Modified: branches/safari-604-branch/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt (223674 => 223675)


--- branches/safari-604-branch/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt	2017-10-19 05:14:59 UTC (rev 223675)
@@ -27,10 +27,10 @@
 PASS new ApplePayError('addressUnserviceable') did not throw exception.
 
 SETUP: 
-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".
+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".
 
 SETUP: 
-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".
+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".
 
 SETUP: 
 PASS new ApplePayError('unknown', 'phoneNumber') did not throw exception.

Modified: branches/safari-604-branch/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt (223674 => 223675)


--- branches/safari-604-branch/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt	2017-10-19 05:14:59 UTC (rev 223675)
@@ -257,6 +257,9 @@
 SETUP: request = validRequest(); request.billingContact = { };
 PASS new ApplePaySession(2, request) did not throw exception.
 
+SETUP: request = validRequest(); request.billingContact = { subLocality: '', subAdministrativeArea: '' };
+PASS new ApplePaySession(2, request) did not throw exception.
+
 Testing PaymentRequest.requiredShippingContactFields
 
 SETUP: request = validRequest(); request.requiredShippingContactFields = undefined;
@@ -318,6 +321,9 @@
 SETUP: request = validRequest(); request.shippingContact = { };
 PASS new ApplePaySession(2, request) did not throw exception.
 
+SETUP: request = validRequest(); request.shippingContact = { subLocality: '', subAdministrativeArea: '' };
+PASS new ApplePaySession(2, request) did not throw exception.
+
 Testing PaymentRequest.shippingType
 
 SETUP: request = validRequest(); request.shippingType = undefined;

Modified: branches/safari-604-branch/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html (223674 => 223675)


--- branches/safari-604-branch/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html	2017-10-19 05:14:59 UTC (rev 223675)
@@ -147,6 +147,7 @@
     logAndShouldNotThrow("request = validRequest(); request.billingContact = null;", "new ApplePaySession(2, request)")
     logAndShouldNotThrow("request = validRequest(); request.billingContact = undefined;", "new ApplePaySession(2, request)")
     logAndShouldNotThrow("request = validRequest(); request.billingContact = { };", "new ApplePaySession(2, request)")
+    logAndShouldNotThrow("request = validRequest(); request.billingContact = { subLocality: '', subAdministrativeArea: '' };", "new ApplePaySession(2, request)")
     
     debug("Testing PaymentRequest.requiredShippingContactFields")
     debug("");
@@ -173,6 +174,7 @@
     logAndShouldNotThrow("request = validRequest(); request.shippingContact = null;", "new ApplePaySession(2, request)")
     logAndShouldNotThrow("request = validRequest(); request.shippingContact = undefined;", "new ApplePaySession(2, request)")
     logAndShouldNotThrow("request = validRequest(); request.shippingContact = { };", "new ApplePaySession(2, request)")
+    logAndShouldNotThrow("request = validRequest(); request.shippingContact = { subLocality: '', subAdministrativeArea: '' };", "new ApplePaySession(2, request)")
     
     debug("Testing PaymentRequest.shippingType")
     debug("");

Modified: branches/safari-604-branch/Source/WebCore/ChangeLog (223674 => 223675)


--- branches/safari-604-branch/Source/WebCore/ChangeLog	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/Source/WebCore/ChangeLog	2017-10-19 05:14:59 UTC (rev 223675)
@@ -1,5 +1,30 @@
 2017-10-18  Jason Marcell  <[email protected]>
 
+        Cherry-pick r223580. rdar://problem/34958773
+
+    2017-10-16  Andy Estes  <[email protected]>
+
+            [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
+            https://bugs.webkit.org/show_bug.cgi?id=178191
+            <rdar://problem/34906367>
+
+            Reviewed by Tim Horton.
+
+            Added test cases to http/tests/ssl/applepay/ApplePaySession.html.
+
+            * Modules/applepay/ApplePayError.idl:
+            * Modules/applepay/ApplePayPaymentContact.h:
+            * Modules/applepay/ApplePayPaymentContact.idl:
+            * Modules/applepay/ApplePaySessionPaymentRequest.h:
+            * Modules/applepay/cocoa/PaymentContactCocoa.mm:
+            (WebCore::subLocality):
+            (WebCore::setSubLocality):
+            (WebCore::subAdministrativeArea):
+            (WebCore::setSubAdministrativeArea):
+            (WebCore::convert):
+
+2017-10-18  Jason Marcell  <[email protected]>
+
         Cherry-pick r223424. rdar://problem/34745623
 
     2017-10-16  Alex Christensen  <[email protected]>

Modified: branches/safari-604-branch/Source/WebCore/Modules/applepay/ApplePayError.idl (223674 => 223675)


--- branches/safari-604-branch/Source/WebCore/Modules/applepay/ApplePayError.idl	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/Source/WebCore/Modules/applepay/ApplePayError.idl	2017-10-19 05:14:59 UTC (rev 223675)
@@ -41,8 +41,10 @@
     "phoneticName",
     "postalAddress",
     "addressLines",
+    "subLocality",
     "locality",
     "postalCode",
+    "subAdministrativeArea",
     "administrativeArea",
     "country",
     "countryCode"

Modified: branches/safari-604-branch/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h (223674 => 223675)


--- branches/safari-604-branch/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h	2017-10-19 05:14:59 UTC (rev 223675)
@@ -41,8 +41,10 @@
     String phoneticGivenName;
     String phoneticFamilyName;
     std::optional<Vector<String>> addressLines;
+    String subLocality;
     String locality;
     String postalCode;
+    String subAdministrativeArea;
     String administrativeArea;
     String country;
     String countryCode;

Modified: branches/safari-604-branch/Source/WebCore/Modules/applepay/ApplePayPaymentContact.idl (223674 => 223675)


--- branches/safari-604-branch/Source/WebCore/Modules/applepay/ApplePayPaymentContact.idl	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/Source/WebCore/Modules/applepay/ApplePayPaymentContact.idl	2017-10-19 05:14:59 UTC (rev 223675)
@@ -34,8 +34,10 @@
     [Conditional=APPLE_PAY_SESSION_V3] DOMString phoneticGivenName;
     [Conditional=APPLE_PAY_SESSION_V3] DOMString phoneticFamilyName;
     sequence<DOMString> addressLines;
+    DOMString subLocality;
     DOMString locality;
     DOMString postalCode;
+    DOMString subAdministrativeArea;
     DOMString administrativeArea;
     DOMString country;
     DOMString countryCode;

Modified: branches/safari-604-branch/Source/WebCore/Modules/applepay/PaymentRequest.h (223674 => 223675)


--- branches/safari-604-branch/Source/WebCore/Modules/applepay/PaymentRequest.h	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/Source/WebCore/Modules/applepay/PaymentRequest.h	2017-10-19 05:14:59 UTC (rev 223675)
@@ -170,8 +170,10 @@
         PhoneticName,
         PostalAddress,
         AddressLines,
+        SubLocality,
         Locality,
         PostalCode,
+        SubAdministrativeArea,
         AdministrativeArea,
         Country,
         CountryCode,

Modified: branches/safari-604-branch/Source/WebCore/Modules/applepay/cocoa/PaymentContactCocoa.mm (223674 => 223675)


--- branches/safari-604-branch/Source/WebCore/Modules/applepay/cocoa/PaymentContactCocoa.mm	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/Source/WebCore/Modules/applepay/cocoa/PaymentContactCocoa.mm	2017-10-19 05:14:59 UTC (rev 223675)
@@ -48,6 +48,54 @@
 
 namespace WebCore {
 
+static NSString *subLocality(CNPostalAddress *address)
+{
+#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101204)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+    if (![address respondsToSelector:@selector(subLocality)])
+        return nil;
+#endif
+    return address.subLocality;
+#else
+    return nil;
+#endif
+}
+
+static void setSubLocality(CNMutablePostalAddress *address, NSString *subLocality)
+{
+#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101204)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+    if (![address respondsToSelector:@selector(setSubLocality:)])
+        return;
+#endif
+    address.subLocality = subLocality;
+#endif
+}
+
+static NSString *subAdministrativeArea(CNPostalAddress *address)
+{
+#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101204)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+    if (![address respondsToSelector:@selector(subAdministrativeArea)])
+        return nil;
+#endif
+    return address.subAdministrativeArea;
+#else
+    return nil;
+#endif
+}
+
+static void setSubAdministrativeArea(CNMutablePostalAddress *address, NSString *subAdministrativeArea)
+{
+#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101204)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+    if (![address respondsToSelector:@selector(setSubAdministrativeArea:)])
+        return;
+#endif
+    address.subAdministrativeArea = subAdministrativeArea;
+#endif
+}
+
 static RetainPtr<PKContact> convert(unsigned version, const ApplePayPaymentContact& contact)
 {
     auto result = adoptNS([allocPKContactInstance() init]);
@@ -100,10 +148,14 @@
         // FIXME: StringBuilder should hava a toNSString() function to avoid the extra String allocation.
         [address setStreet:builder.toString()];
 
+        if (!contact.subLocality.isEmpty())
+            setSubLocality(address.get(), contact.subLocality);
         if (!contact.locality.isEmpty())
             [address setCity:contact.locality];
         if (!contact.postalCode.isEmpty())
             [address setPostalCode:contact.postalCode];
+        if (!contact.subAdministrativeArea.isEmpty())
+            setSubAdministrativeArea(address.get(), contact.subAdministrativeArea);
         if (!contact.administrativeArea.isEmpty())
             [address setState:contact.administrativeArea];
         if (!contact.country.isEmpty())
@@ -140,8 +192,10 @@
         String(postalAddress.street).split("\n", addressLines);
         result.addressLines = WTFMove(addressLines);
     }
+    result.subLocality = subLocality(postalAddress);
     result.locality = postalAddress.city;
     result.postalCode = postalAddress.postalCode;
+    result.subAdministrativeArea = subAdministrativeArea(postalAddress);
     result.administrativeArea = postalAddress.state;
     result.country = postalAddress.country;
     result.countryCode = postalAddress.ISOCountryCode;

Modified: branches/safari-604-branch/Source/WebKit/ChangeLog (223674 => 223675)


--- branches/safari-604-branch/Source/WebKit/ChangeLog	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/Source/WebKit/ChangeLog	2017-10-19 05:14:59 UTC (rev 223675)
@@ -1,3 +1,18 @@
+2017-10-18  Jason Marcell  <[email protected]>
+
+        Cherry-pick r223580. rdar://problem/34958773
+
+    2017-10-16  Andy Estes  <[email protected]>
+
+            [Apple Pay] Add subLocality and subAdministrativeArea to ApplePayPaymentContact and ApplePayError
+            https://bugs.webkit.org/show_bug.cgi?id=178191
+            <rdar://problem/34906367>
+
+            Reviewed by Tim Horton.
+
+            * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm:
+            (WebKit::toNSError):
+
 2017-10-11  Jason Marcell  <[email protected]>
 
         Apply patch. rdar://problem/34920294

Modified: branches/safari-604-branch/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (223674 => 223675)


--- branches/safari-604-branch/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm	2017-10-19 05:14:55 UTC (rev 223674)
+++ branches/safari-604-branch/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm	2017-10-19 05:14:59 UTC (rev 223675)
@@ -62,7 +62,9 @@
 #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, CNPostalAddressSubLocalityKey, NSString *);
 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressCityKey, NSString *);
+SOFT_LINK_CONSTANT(Contacts, CNPostalAddressSubAdministrativeAreaKey, NSString *);
 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressStateKey, NSString *);
 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressPostalCodeKey, NSString *);
 SOFT_LINK_CONSTANT(Contacts, CNPostalAddressCountryKey, NSString *);
@@ -651,6 +653,11 @@
             postalAddressKey = getCNPostalAddressStreetKey();
             break;
 
+        case WebCore::PaymentError::ContactField::SubLocality:
+            pkContactField = getPKContactFieldPostalAddress();
+            postalAddressKey = getCNPostalAddressSubLocalityKey();
+            break;
+
         case WebCore::PaymentError::ContactField::Locality:
             pkContactField = getPKContactFieldPostalAddress();
             postalAddressKey = getCNPostalAddressCityKey();
@@ -661,6 +668,11 @@
             postalAddressKey = getCNPostalAddressPostalCodeKey();
             break;
 
+        case WebCore::PaymentError::ContactField::SubAdministrativeArea:
+            pkContactField = getPKContactFieldPostalAddress();
+            postalAddressKey = getCNPostalAddressSubAdministrativeAreaKey();
+            break;
+
         case WebCore::PaymentError::ContactField::AdministrativeArea:
             pkContactField = getPKContactFieldPostalAddress();
             postalAddressKey = getCNPostalAddressStateKey();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to