Diff
Modified: trunk/LayoutTests/ChangeLog (223446 => 223447)
--- trunk/LayoutTests/ChangeLog 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/LayoutTests/ChangeLog 2017-10-17 00:00:40 UTC (rev 223447)
@@ -1,3 +1,15 @@
+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-16 Alex Christensen <[email protected]>
De-flakify http/tests/loading/basic-credentials-sent-automatically.html
Modified: trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt (223446 => 223447)
--- trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/LayoutTests/http/tests/ssl/applepay/ApplePayError-expected.txt 2017-10-17 00:00:40 UTC (rev 223447)
@@ -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: trunk/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt (223446 => 223447)
--- trunk/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/LayoutTests/http/tests/ssl/applepay/ApplePaySession-expected.txt 2017-10-17 00:00:40 UTC (rev 223447)
@@ -260,6 +260,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;
@@ -321,6 +324,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: trunk/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html (223446 => 223447)
--- trunk/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/LayoutTests/http/tests/ssl/applepay/ApplePaySession.html 2017-10-17 00:00:40 UTC (rev 223447)
@@ -148,6 +148,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("");
@@ -174,6 +175,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: trunk/Source/WebCore/ChangeLog (223446 => 223447)
--- trunk/Source/WebCore/ChangeLog 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/Source/WebCore/ChangeLog 2017-10-17 00:00:40 UTC (rev 223447)
@@ -1,3 +1,24 @@
+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-16 Alex Christensen <[email protected]>
Allow modern decoding of URLs
Modified: trunk/Source/WebCore/Modules/applepay/ApplePayError.idl (223446 => 223447)
--- trunk/Source/WebCore/Modules/applepay/ApplePayError.idl 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayError.idl 2017-10-17 00:00:40 UTC (rev 223447)
@@ -41,8 +41,10 @@
"phoneticName",
"postalAddress",
"addressLines",
+ "subLocality",
"locality",
"postalCode",
+ "subAdministrativeArea",
"administrativeArea",
"country",
"countryCode"
Modified: trunk/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h (223446 => 223447)
--- trunk/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayPaymentContact.h 2017-10-17 00:00:40 UTC (rev 223447)
@@ -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: trunk/Source/WebCore/Modules/applepay/ApplePayPaymentContact.idl (223446 => 223447)
--- trunk/Source/WebCore/Modules/applepay/ApplePayPaymentContact.idl 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/Source/WebCore/Modules/applepay/ApplePayPaymentContact.idl 2017-10-17 00:00:40 UTC (rev 223447)
@@ -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: trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h (223446 => 223447)
--- trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/Source/WebCore/Modules/applepay/ApplePaySessionPaymentRequest.h 2017-10-17 00:00:40 UTC (rev 223447)
@@ -167,8 +167,10 @@
PhoneticName,
PostalAddress,
AddressLines,
+ SubLocality,
Locality,
PostalCode,
+ SubAdministrativeArea,
AdministrativeArea,
Country,
CountryCode,
Modified: trunk/Source/WebCore/Modules/applepay/cocoa/PaymentContactCocoa.mm (223446 => 223447)
--- trunk/Source/WebCore/Modules/applepay/cocoa/PaymentContactCocoa.mm 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/Source/WebCore/Modules/applepay/cocoa/PaymentContactCocoa.mm 2017-10-17 00:00:40 UTC (rev 223447)
@@ -46,8 +46,56 @@
SOFT_LINK_CLASS(PassKit, PKContact)
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+@interface CNPostalAddress ()
+@property (readonly, copy, NS_NONATOMIC_IOSONLY) NSString *subLocality;
+@property (readonly, copy, NS_NONATOMIC_IOSONLY) NSString *subAdministrativeArea;
+@end
+
+@interface CNMutablePostalAddress ()
+@property (copy, NS_NONATOMIC_IOSONLY) NSString *subLocality;
+@property (copy, NS_NONATOMIC_IOSONLY) NSString *subAdministrativeArea;
+@end
+#endif
+
namespace WebCore {
+static NSString *subLocality(CNPostalAddress *address)
+{
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+ if (![address respondsToSelector:@selector(subLocality)])
+ return nil;
+#endif
+ return address.subLocality;
+}
+
+static void setSubLocality(CNMutablePostalAddress *address, NSString *subLocality)
+{
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+ if (![address respondsToSelector:@selector(setSubLocality:)])
+ return;
+#endif
+ address.subLocality = subLocality;
+}
+
+static NSString *subAdministrativeArea(CNPostalAddress *address)
+{
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+ if (![address respondsToSelector:@selector(subAdministrativeArea)])
+ return nil;
+#endif
+ return address.subAdministrativeArea;
+}
+
+static void setSubAdministrativeArea(CNMutablePostalAddress *address, NSString *subAdministrativeArea)
+{
+#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101300
+ if (![address respondsToSelector:@selector(setSubAdministrativeArea:)])
+ return;
+#endif
+ address.subAdministrativeArea = subAdministrativeArea;
+}
+
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: trunk/Source/WebKit/ChangeLog (223446 => 223447)
--- trunk/Source/WebKit/ChangeLog 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/Source/WebKit/ChangeLog 2017-10-17 00:00:40 UTC (rev 223447)
@@ -1,3 +1,14 @@
+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-16 Tim Horton <[email protected]>
Safari crashes after searching PDF (under [WKPDFView zoom:to:atPoint:kind:])
Modified: trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (223446 => 223447)
--- trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2017-10-16 23:29:36 UTC (rev 223446)
+++ trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2017-10-17 00:00:40 UTC (rev 223447)
@@ -63,7 +63,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 *);
@@ -656,6 +658,11 @@
postalAddressKey = getCNPostalAddressStreetKey();
break;
+ case WebCore::PaymentError::ContactField::SubLocality:
+ pkContactField = getPKContactFieldPostalAddress();
+ postalAddressKey = getCNPostalAddressSubLocalityKey();
+ break;
+
case WebCore::PaymentError::ContactField::Locality:
pkContactField = getPKContactFieldPostalAddress();
postalAddressKey = getCNPostalAddressCityKey();
@@ -666,6 +673,11 @@
postalAddressKey = getCNPostalAddressPostalCodeKey();
break;
+ case WebCore::PaymentError::ContactField::SubAdministrativeArea:
+ pkContactField = getPKContactFieldPostalAddress();
+ postalAddressKey = getCNPostalAddressSubAdministrativeAreaKey();
+ break;
+
case WebCore::PaymentError::ContactField::AdministrativeArea:
pkContactField = getPKContactFieldPostalAddress();
postalAddressKey = getCNPostalAddressStateKey();