Title: [241159] branches/safari-607-branch
Revision
241159
Author
[email protected]
Date
2019-02-07 15:36:57 -0800 (Thu, 07 Feb 2019)

Log Message

Cherry-pick r241105. rdar://problem/47893571

    [Payment Request] It should be possible to require a phonetic name for shipping contacts
    https://bugs.webkit.org/show_bug.cgi?id=194311
    <rdar://46733045>

    Reviewed by Alex Christensen.

    Source/WebCore:

    It should be possible to require that a shipping contact has a phonetic name in Payment Request.
    To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to
    ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data.

    Since required shipping contact fields can now be specified both in
    requiredShippingContactFields and PaymentOptions, we merge the required fields from these
    two sources such that, e.g., email is required if it is specified in either place.

    So that clients can detect this new feature, the API version number is bumped from 5 to 6.

    Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html.

    * DerivedSources.make:
    * Modules/applepay/ApplePayPaymentRequest.h:
    * Modules/applepay/ApplePayPaymentRequest.idl:
    * Modules/applepay/ApplePayRequestBase.cpp:
    (WebCore::convertAndValidate):
    * Modules/applepay/ApplePayRequestBase.h:
    * Modules/applepay/ApplePayRequestBase.idl:
    * Modules/applepay/ApplePaySession.cpp:
    (WebCore::convertAndValidate):
    * Modules/applepay/PaymentCoordinatorClient.cpp: Added.
    (WebCore::PaymentCoordinatorClient::supportsVersion):
    * Modules/applepay/PaymentCoordinatorClient.h:
    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
    (WebCore::mergePaymentOptions):
    (WebCore::ApplePayPaymentHandler::show):
    * SourcesCocoa.txt:
    * WebCore.xcodeproj/project.pbxproj:
    * loader/EmptyClients.cpp:
    * testing/MockPaymentContactFields.h: Added.
    (WebCore::MockPaymentContactFields::MockPaymentContactFields):
    * testing/MockPaymentContactFields.idl: Added.
    * testing/MockPaymentCoordinator.cpp:
    (WebCore::MockPaymentCoordinator::showPaymentUI):
    (WebCore::MockPaymentCoordinator::supportsVersion): Deleted.
    * testing/MockPaymentCoordinator.h:
    * testing/MockPaymentCoordinator.idl:

    Source/WebKit:

    * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
    (WebKit::WebPaymentCoordinator::supportsVersion): Deleted.
    * WebProcess/ApplePay/WebPaymentCoordinator.h:

    Source/WebKitLegacy/mac:

    * WebCoreSupport/WebPaymentCoordinatorClient.h:
    * WebCoreSupport/WebPaymentCoordinatorClient.mm:
    (WebPaymentCoordinatorClient::supportsVersion): Deleted.

    LayoutTests:

    * http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt:
    * http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html:
    * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt:
    * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html:
    * http/tests/ssl/applepay/PaymentRequest.https-expected.txt:
    * http/tests/ssl/applepay/PaymentRequest.https.html:

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241105 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-607-branch/LayoutTests/ChangeLog (241158 => 241159)


--- branches/safari-607-branch/LayoutTests/ChangeLog	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/LayoutTests/ChangeLog	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,95 @@
 2019-02-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r241105. rdar://problem/47893571
+
+    [Payment Request] It should be possible to require a phonetic name for shipping contacts
+    https://bugs.webkit.org/show_bug.cgi?id=194311
+    <rdar://46733045>
+    
+    Reviewed by Alex Christensen.
+    
+    Source/WebCore:
+    
+    It should be possible to require that a shipping contact has a phonetic name in Payment Request.
+    To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to
+    ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data.
+    
+    Since required shipping contact fields can now be specified both in
+    requiredShippingContactFields and PaymentOptions, we merge the required fields from these
+    two sources such that, e.g., email is required if it is specified in either place.
+    
+    So that clients can detect this new feature, the API version number is bumped from 5 to 6.
+    
+    Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html.
+    
+    * DerivedSources.make:
+    * Modules/applepay/ApplePayPaymentRequest.h:
+    * Modules/applepay/ApplePayPaymentRequest.idl:
+    * Modules/applepay/ApplePayRequestBase.cpp:
+    (WebCore::convertAndValidate):
+    * Modules/applepay/ApplePayRequestBase.h:
+    * Modules/applepay/ApplePayRequestBase.idl:
+    * Modules/applepay/ApplePaySession.cpp:
+    (WebCore::convertAndValidate):
+    * Modules/applepay/PaymentCoordinatorClient.cpp: Added.
+    (WebCore::PaymentCoordinatorClient::supportsVersion):
+    * Modules/applepay/PaymentCoordinatorClient.h:
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+    (WebCore::mergePaymentOptions):
+    (WebCore::ApplePayPaymentHandler::show):
+    * SourcesCocoa.txt:
+    * WebCore.xcodeproj/project.pbxproj:
+    * loader/EmptyClients.cpp:
+    * testing/MockPaymentContactFields.h: Added.
+    (WebCore::MockPaymentContactFields::MockPaymentContactFields):
+    * testing/MockPaymentContactFields.idl: Added.
+    * testing/MockPaymentCoordinator.cpp:
+    (WebCore::MockPaymentCoordinator::showPaymentUI):
+    (WebCore::MockPaymentCoordinator::supportsVersion): Deleted.
+    * testing/MockPaymentCoordinator.h:
+    * testing/MockPaymentCoordinator.idl:
+    
+    Source/WebKit:
+    
+    * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+    (WebKit::WebPaymentCoordinator::supportsVersion): Deleted.
+    * WebProcess/ApplePay/WebPaymentCoordinator.h:
+    
+    Source/WebKitLegacy/mac:
+    
+    * WebCoreSupport/WebPaymentCoordinatorClient.h:
+    * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+    (WebPaymentCoordinatorClient::supportsVersion): Deleted.
+    
+    LayoutTests:
+    
+    * http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html:
+    * http/tests/ssl/applepay/PaymentRequest.https-expected.txt:
+    * http/tests/ssl/applepay/PaymentRequest.https.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-06  Andy Estes  <[email protected]>
+
+            [Payment Request] It should be possible to require a phonetic name for shipping contacts
+            https://bugs.webkit.org/show_bug.cgi?id=194311
+            <rdar://46733045>
+
+            Reviewed by Alex Christensen.
+
+            * http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt:
+            * http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html:
+            * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt:
+            * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html:
+            * http/tests/ssl/applepay/PaymentRequest.https-expected.txt:
+            * http/tests/ssl/applepay/PaymentRequest.https.html:
+
+2019-02-07  Alan Coon  <[email protected]>
+
         Cherry-pick r241018. rdar://problem/47893623
 
     RELEASE_ASSERT(!m_document.isResolvingTreeStyle()) in com.apple.WebKit.WebContent at WebCore: WebCore::StyleResolver::~StyleResolver

Modified: branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt (241158 => 241159)


--- branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt	2019-02-07 23:36:57 UTC (rev 241159)
@@ -3,6 +3,16 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+Test setting required contact fields in a version 2 request.
+PASS internals.mockPaymentCoordinator.requiredBillingContactFields.name is true
+PASS internals.mockPaymentCoordinator.requiredBillingContactFields.email is false
+PASS internals.mockPaymentCoordinator.requiredBillingContactFields.phone is false
+PASS internals.mockPaymentCoordinator.requiredBillingContactFields.postalAddress is true
+PASS internals.mockPaymentCoordinator.requiredShippingContactFields.name is true
+PASS internals.mockPaymentCoordinator.requiredShippingContactFields.email is true
+PASS internals.mockPaymentCoordinator.requiredShippingContactFields.phone is false
+PASS internals.mockPaymentCoordinator.requiredShippingContactFields.postalAddress is true
+
 Test setting a default shipping contact in a version 2 request.
 PASS paymentResponse.details.shippingContact.phoneNumber is expectedPhoneNumber
 PASS paymentResponse.details.shippingContact.emailAddress is expectedEmailAddress

Modified: branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html (241158 => 241159)


--- branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html	2019-02-07 23:36:57 UTC (rev 241159)
@@ -83,6 +83,40 @@
 
 async function runTests() {
     await new Promise((resolve, reject) => {
+        debug("Test setting required contact fields in a version 2 request.");
+
+        var paymentMethod = validPaymentMethod(2, validShippingContact());
+        paymentMethod.data.requiredBillingContactFields = ["name", "postalAddress"];
+        paymentMethod.data.requiredShippingContactFields = ["email"];
+
+        var paymentOptions = validPaymentOptions();
+        paymentOptions.requestPayerEmail = false;
+        paymentOptions.requestPayerPhone = false;
+
+        var paymentRequest = new PaymentRequest([paymentMethod], validPaymentDetails(), paymentOptions);
+
+        activateThen(() => {
+            paymentRequest.show().then((response) => {
+                shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.name", "true");
+                shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.email", "false");
+                shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.phone", "false");
+                shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.postalAddress", "true");
+
+                shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.name", "true");
+                shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.email", "true");
+                shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.phone", "false");
+                shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.postalAddress", "true");
+
+                response.complete("success");
+                resolve();
+            });
+
+            internals.mockPaymentCoordinator.acceptPayment();
+        });
+    });
+    debug("");
+
+    await new Promise((resolve, reject) => {
         debug("Test setting a default shipping contact in a version 2 request.");
 
         var paymentRequest = new PaymentRequest([validPaymentMethod(2, validShippingContact())], validPaymentDetails(), validPaymentOptions());

Modified: branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt (241158 => 241159)


--- branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt	2019-02-07 23:36:57 UTC (rev 241159)
@@ -3,6 +3,18 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+Test setting required contact fields in a version 3 request.
+PASS internals.mockPaymentCoordinator.requiredBillingContactFields.name is false
+PASS internals.mockPaymentCoordinator.requiredBillingContactFields.phoneticName is false
+PASS internals.mockPaymentCoordinator.requiredBillingContactFields.email is false
+PASS internals.mockPaymentCoordinator.requiredBillingContactFields.phone is false
+PASS internals.mockPaymentCoordinator.requiredBillingContactFields.postalAddress is false
+PASS internals.mockPaymentCoordinator.requiredShippingContactFields.name is true
+PASS internals.mockPaymentCoordinator.requiredShippingContactFields.phoneticName is true
+PASS internals.mockPaymentCoordinator.requiredShippingContactFields.email is true
+PASS internals.mockPaymentCoordinator.requiredShippingContactFields.phone is true
+PASS internals.mockPaymentCoordinator.requiredShippingContactFields.postalAddress is true
+
 Test setting a default shipping contact in a version 3 request.
 PASS paymentResponse.details.shippingContact.phoneticGivenName is expectedGivenName
 PASS paymentResponse.details.shippingContact.phoneticFamilyName is expectedFamilyName

Modified: branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html (241158 => 241159)


--- branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html	2019-02-07 23:36:57 UTC (rev 241159)
@@ -83,6 +83,37 @@
 
 async function runTests() {
     await new Promise((resolve, reject) => {
+        debug("Test setting required contact fields in a version 3 request.");
+
+        var paymentMethod = validPaymentMethod(3, validShippingContact());
+        paymentMethod.data.requiredShippingContactFields = ["phoneticName"];
+
+        var paymentRequest = new PaymentRequest([paymentMethod], validPaymentDetails(), validPaymentOptions());
+
+        activateThen(() => {
+            paymentRequest.show().then((response) => {
+                shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.name", "false");
+                shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.phoneticName", "false");
+                shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.email", "false");
+                shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.phone", "false");
+                shouldBe("internals.mockPaymentCoordinator.requiredBillingContactFields.postalAddress", "false");
+
+                shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.name", "true");
+                shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.phoneticName", "true");
+                shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.email", "true");
+                shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.phone", "true");
+                shouldBe("internals.mockPaymentCoordinator.requiredShippingContactFields.postalAddress", "true");
+
+                response.complete("success");
+                resolve();
+            });
+
+            internals.mockPaymentCoordinator.acceptPayment();
+        });
+    });
+    debug("");
+
+    await new Promise((resolve, reject) => {
         debug("Test setting a default shipping contact in a version 3 request.");
 
         var paymentRequest = new PaymentRequest([validPaymentMethod(3, validShippingContact())], validPaymentDetails(), validPaymentOptions());

Modified: branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https-expected.txt (241158 => 241159)


--- branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https-expected.txt	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https-expected.txt	2019-02-07 23:36:57 UTC (rev 241159)
@@ -124,6 +124,43 @@
 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.billingContact = 7;
 PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with InvalidStateError: The object is in an invalid state..
 
+Testing ApplePayRequest.requiredShippingContactFields
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = '';
+PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with TypeError: Value is not a sequence.
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = null;
+PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with TypeError: Value is not a sequence.
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = 7;
+PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with TypeError: Value is not a sequence.
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = { };
+PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with TypeError: Type error.
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [''];
+PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with TypeError: Type error.
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [null];
+PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with TypeError: Type error.
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [undefined];
+PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with TypeError: Type error.
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [{}];
+PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with TypeError: Type error.
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = ['invalid'];
+PASS request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with TypeError: Type error.
+
+Testing ApplePayRequest.shippingContact
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.shippingContact = '';
+PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with InvalidStateError: The object is in an invalid state..
+
+SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.shippingContact = 7;
+PASS new PaymentRequest([paymentMethod], validPaymentDetails()); request.show() rejected promise  with InvalidStateError: The object is in an invalid state..
+
 Testing ApplePayRequest.applicationData
 
 SETUP: paymentMethod = validPaymentMethod(); paymentMethod.data.applicationData = { toString: function() { throw '"Error in toString"'; } };

Modified: branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https.html (241158 => 241159)


--- branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https.html	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/LayoutTests/http/tests/ssl/applepay/PaymentRequest.https.html	2019-02-07 23:36:57 UTC (rev 241159)
@@ -142,6 +142,34 @@
     debug("")
     await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.billingContact = 7;", "new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
     debug("")
+
+    debug("Testing ApplePayRequest.requiredShippingContactFields")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = '';", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = null;", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = 7;", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = { };", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [''];", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [null];", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [undefined];", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = [{}];", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.requiredShippingContactFields = ['invalid'];", "request = new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
+
+    debug("Testing ApplePayRequest.shippingContact")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.shippingContact = '';", "new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
+    await logAndShouldReject("paymentMethod = validPaymentMethod(); paymentMethod.data.shippingContact = 7;", "new PaymentRequest([paymentMethod], validPaymentDetails()); request.show()")
+    debug("")
     
     debug("Testing ApplePayRequest.applicationData")
     debug("")

Modified: branches/safari-607-branch/Source/WebCore/ChangeLog (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/ChangeLog	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,127 @@
 2019-02-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r241105. rdar://problem/47893571
+
+    [Payment Request] It should be possible to require a phonetic name for shipping contacts
+    https://bugs.webkit.org/show_bug.cgi?id=194311
+    <rdar://46733045>
+    
+    Reviewed by Alex Christensen.
+    
+    Source/WebCore:
+    
+    It should be possible to require that a shipping contact has a phonetic name in Payment Request.
+    To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to
+    ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data.
+    
+    Since required shipping contact fields can now be specified both in
+    requiredShippingContactFields and PaymentOptions, we merge the required fields from these
+    two sources such that, e.g., email is required if it is specified in either place.
+    
+    So that clients can detect this new feature, the API version number is bumped from 5 to 6.
+    
+    Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html.
+    
+    * DerivedSources.make:
+    * Modules/applepay/ApplePayPaymentRequest.h:
+    * Modules/applepay/ApplePayPaymentRequest.idl:
+    * Modules/applepay/ApplePayRequestBase.cpp:
+    (WebCore::convertAndValidate):
+    * Modules/applepay/ApplePayRequestBase.h:
+    * Modules/applepay/ApplePayRequestBase.idl:
+    * Modules/applepay/ApplePaySession.cpp:
+    (WebCore::convertAndValidate):
+    * Modules/applepay/PaymentCoordinatorClient.cpp: Added.
+    (WebCore::PaymentCoordinatorClient::supportsVersion):
+    * Modules/applepay/PaymentCoordinatorClient.h:
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+    (WebCore::mergePaymentOptions):
+    (WebCore::ApplePayPaymentHandler::show):
+    * SourcesCocoa.txt:
+    * WebCore.xcodeproj/project.pbxproj:
+    * loader/EmptyClients.cpp:
+    * testing/MockPaymentContactFields.h: Added.
+    (WebCore::MockPaymentContactFields::MockPaymentContactFields):
+    * testing/MockPaymentContactFields.idl: Added.
+    * testing/MockPaymentCoordinator.cpp:
+    (WebCore::MockPaymentCoordinator::showPaymentUI):
+    (WebCore::MockPaymentCoordinator::supportsVersion): Deleted.
+    * testing/MockPaymentCoordinator.h:
+    * testing/MockPaymentCoordinator.idl:
+    
+    Source/WebKit:
+    
+    * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+    (WebKit::WebPaymentCoordinator::supportsVersion): Deleted.
+    * WebProcess/ApplePay/WebPaymentCoordinator.h:
+    
+    Source/WebKitLegacy/mac:
+    
+    * WebCoreSupport/WebPaymentCoordinatorClient.h:
+    * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+    (WebPaymentCoordinatorClient::supportsVersion): Deleted.
+    
+    LayoutTests:
+    
+    * http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html:
+    * http/tests/ssl/applepay/PaymentRequest.https-expected.txt:
+    * http/tests/ssl/applepay/PaymentRequest.https.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-06  Andy Estes  <[email protected]>
+
+            [Payment Request] It should be possible to require a phonetic name for shipping contacts
+            https://bugs.webkit.org/show_bug.cgi?id=194311
+            <rdar://46733045>
+
+            Reviewed by Alex Christensen.
+
+            It should be possible to require that a shipping contact has a phonetic name in Payment Request.
+            To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to
+            ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data.
+
+            Since required shipping contact fields can now be specified both in
+            requiredShippingContactFields and PaymentOptions, we merge the required fields from these
+            two sources such that, e.g., email is required if it is specified in either place.
+
+            So that clients can detect this new feature, the API version number is bumped from 5 to 6.
+
+            Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html.
+
+            * DerivedSources.make:
+            * Modules/applepay/ApplePayPaymentRequest.h:
+            * Modules/applepay/ApplePayPaymentRequest.idl:
+            * Modules/applepay/ApplePayRequestBase.cpp:
+            (WebCore::convertAndValidate):
+            * Modules/applepay/ApplePayRequestBase.h:
+            * Modules/applepay/ApplePayRequestBase.idl:
+            * Modules/applepay/ApplePaySession.cpp:
+            (WebCore::convertAndValidate):
+            * Modules/applepay/PaymentCoordinatorClient.cpp: Added.
+            (WebCore::PaymentCoordinatorClient::supportsVersion):
+            * Modules/applepay/PaymentCoordinatorClient.h:
+            * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+            (WebCore::mergePaymentOptions):
+            (WebCore::ApplePayPaymentHandler::show):
+            * SourcesCocoa.txt:
+            * WebCore.xcodeproj/project.pbxproj:
+            * loader/EmptyClients.cpp:
+            * testing/MockPaymentContactFields.h: Added.
+            (WebCore::MockPaymentContactFields::MockPaymentContactFields):
+            * testing/MockPaymentContactFields.idl: Added.
+            * testing/MockPaymentCoordinator.cpp:
+            (WebCore::MockPaymentCoordinator::showPaymentUI):
+            (WebCore::MockPaymentCoordinator::supportsVersion): Deleted.
+            * testing/MockPaymentCoordinator.h:
+            * testing/MockPaymentCoordinator.idl:
+
+2019-02-07  Alan Coon  <[email protected]>
+
         Cherry-pick r241022. rdar://problem/47893580
 
     CoreAudioCaptureSource should not configure its audio unit until it starts producing data

Modified: branches/safari-607-branch/Source/WebCore/DerivedSources.make (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/DerivedSources.make	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/DerivedSources.make	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1040,6 +1040,7 @@
     $(WebCore)/testing/MockContentFilterSettings.idl \
     $(WebCore)/testing/MockPageOverlay.idl \
     $(WebCore)/testing/MockPaymentAddress.idl \
+    $(WebCore)/testing/MockPaymentContactFields.idl \
     $(WebCore)/testing/MockPaymentCoordinator.idl \
     $(WebCore)/testing/MockPaymentError.idl \
     $(WebCore)/testing/ServiceWorkerInternals.idl \

Modified: branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.h	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -40,8 +40,6 @@
 
     String currencyCode;
 
-    Optional<Vector<ApplePayContactField>> requiredShippingContactFields;
-
     ShippingType shippingType { ShippingType::Shipping };
     Optional<Vector<ApplePayShippingMethod>> shippingMethods;
 

Modified: branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.idl (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.idl	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.idl	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -40,8 +40,6 @@
 
     required DOMString currencyCode;
 
-    sequence<ApplePayContactField> requiredShippingContactFields;
-
     ApplePayShippingType shippingType = "shipping";
     sequence<ApplePayShippingMethod> shippingMethods;
 };

Modified: branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.cpp	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -78,6 +78,13 @@
 
     if (request.billingContact)
         result.setBillingContact(PaymentContact::fromApplePayPaymentContact(version, *request.billingContact));
+    
+    if (request.requiredShippingContactFields) {
+        auto requiredShippingContactFields = convertAndValidate(version, *request.requiredShippingContactFields);
+        if (requiredShippingContactFields.hasException())
+            return requiredShippingContactFields.releaseException();
+        result.setRequiredShippingContactFields(requiredShippingContactFields.releaseReturnValue());
+    }
 
     if (request.shippingContact)
         result.setShippingContact(PaymentContact::fromApplePayPaymentContact(version, *request.shippingContact));

Modified: branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.h (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.h	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.h	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -43,6 +43,7 @@
     Optional<Vector<ApplePayContactField>> requiredBillingContactFields;
     Optional<ApplePayPaymentContact> billingContact;
 
+    Optional<Vector<ApplePayContactField>> requiredShippingContactFields;
     Optional<ApplePayPaymentContact> shippingContact;
 
     String applicationData;

Modified: branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.idl (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.idl	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayRequestBase.idl	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2016-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2016-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -33,6 +33,7 @@
     sequence<ApplePayContactField> requiredBillingContactFields;
     ApplePayPaymentContact billingContact;
 
+    sequence<ApplePayContactField> requiredShippingContactFields;
     ApplePayPaymentContact shippingContact;
 
     DOMString applicationData;

Modified: branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePaySession.cpp (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePaySession.cpp	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -227,13 +227,6 @@
         return lineItems.releaseException();
     result.setLineItems(lineItems.releaseReturnValue());
 
-    if (paymentRequest.requiredShippingContactFields) {
-        auto requiredShippingContactFields = convertAndValidate(version, WTFMove(*paymentRequest.requiredShippingContactFields));
-        if (requiredShippingContactFields.hasException())
-            return requiredShippingContactFields.releaseException();
-        result.setRequiredShippingContactFields(requiredShippingContactFields.releaseReturnValue());
-    }
-
     result.setShippingType(paymentRequest.shippingType);
 
     if (paymentRequest.shippingMethods) {

Copied: branches/safari-607-branch/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.cpp (from rev 241158, branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.idl) (0 => 241159)


--- branches/safari-607-branch/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.cpp	                        (rev 0)
+++ branches/safari-607-branch/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.cpp	2019-02-07 23:36:57 UTC (rev 241159)
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "PaymentCoordinatorClient.h"
+
+#if ENABLE(APPLE_PAY)
+
+namespace WebCore {
+
+bool PaymentCoordinatorClient::supportsVersion(unsigned version)
+{
+    ASSERT(version > 0);
+
+#if !ENABLE(APPLE_PAY_SESSION_V3)
+    static const unsigned currentVersion = 2;
+#elif !ENABLE(APPLE_PAY_SESSION_V4)
+    static const unsigned currentVersion = 3;
+#else
+    static const unsigned currentVersion = 6;
+#endif
+
+    return version <= currentVersion;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(APPLE_PAY)

Modified: branches/safari-607-branch/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -45,7 +45,8 @@
 
 class PaymentCoordinatorClient {
 public:
-    virtual bool supportsVersion(unsigned version) = 0;
+    bool supportsVersion(unsigned version);
+
     virtual Optional<String> validatedPaymentNetwork(const String&) = 0;
     virtual bool canMakePayments() = 0;
     virtual void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) = 0;

Modified: branches/safari-607-branch/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -129,16 +129,6 @@
     return { WTFMove(result) };
 }
 
-static ApplePaySessionPaymentRequest::ContactFields convert(const PaymentOptions& options)
-{
-    ApplePaySessionPaymentRequest::ContactFields result;
-    result.email = options.requestPayerEmail;
-    result.name = options.requestPayerName;
-    result.phone = options.requestPayerPhone;
-    result.postalAddress = options.requestShipping;
-    return result;
-}
-
 static ApplePaySessionPaymentRequest::ShippingType convert(PaymentShippingType type)
 {
     switch (type) {
@@ -182,6 +172,19 @@
     return { };
 }
 
+static void mergePaymentOptions(const PaymentOptions& options, ApplePaySessionPaymentRequest& request)
+{
+    auto requiredShippingContactFields = request.requiredShippingContactFields();
+    requiredShippingContactFields.email |= options.requestPayerEmail;
+    requiredShippingContactFields.name |= options.requestPayerName;
+    requiredShippingContactFields.phone |= options.requestPayerPhone;
+    requiredShippingContactFields.postalAddress |= options.requestShipping;
+    request.setRequiredShippingContactFields(requiredShippingContactFields);
+
+    if (options.requestShipping)
+        request.setShippingType(convert(options.shippingType));
+}
+
 ExceptionOr<void> ApplePayPaymentHandler::show()
 {
     auto validatedRequest = convertAndValidate(m_applePayRequest->version, *m_applePayRequest, paymentCoordinator());
@@ -203,9 +206,7 @@
         return convertedLineItems.releaseException();
     request.setLineItems(convertedLineItems.releaseReturnValue());
 
-    request.setRequiredShippingContactFields(convert(m_paymentRequest->paymentOptions()));
-    if (m_paymentRequest->paymentOptions().requestShipping)
-        request.setShippingType(convert(m_paymentRequest->paymentOptions().shippingType));
+    mergePaymentOptions(m_paymentRequest->paymentOptions(), request);
 
     auto shippingMethods = computeShippingMethods();
     if (shippingMethods.hasException())

Modified: branches/safari-607-branch/Source/WebCore/SourcesCocoa.txt (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/SourcesCocoa.txt	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/SourcesCocoa.txt	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2018 Apple Inc. All rights reserved.
+// Copyright (C) 2017-2019 Apple Inc. All rights reserved.
 //
 // Redistribution and use in source and binary forms, with or without
 // modification, are permitted provided that the following conditions
@@ -591,6 +591,7 @@
     Modules/applepay/ApplePayShippingMethodSelectedEvent.cpp
     Modules/applepay/ApplePayValidateMerchantEvent.cpp
     Modules/applepay/PaymentCoordinator.cpp
+    Modules/applepay/PaymentCoordinatorClient.cpp
     Modules/applepay/PaymentRequestValidator.mm
     Modules/applepay/PaymentSession.cpp
 

Modified: branches/safari-607-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2019-02-07 23:36:57 UTC (rev 241159)
@@ -2917,6 +2917,9 @@
 		A0EE0DF6144F825500F80B0D /* WebGLDebugRendererInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF2144F825500F80B0D /* WebGLDebugRendererInfo.h */; };
 		A0EE0DF7144F825500F80B0D /* WebGLDebugShaders.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */; };
 		A0EE0DF8144F825500F80B0D /* WebGLDebugShaders.h in Headers */ = {isa = PBXBuildFile; fileRef = A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */; };
+		A104EC5A220A3DE000CBF67A /* MockPaymentContactFields.h in Headers */ = {isa = PBXBuildFile; fileRef = A104EC55220A39B400CBF67A /* MockPaymentContactFields.h */; };
+		A104EC5D220A3E4B00CBF67A /* JSMockPaymentContactFields.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A104EC5B220A3E4300CBF67A /* JSMockPaymentContactFields.cpp */; };
+		A104EC5E220A3E4E00CBF67A /* JSMockPaymentContactFields.h in Headers */ = {isa = PBXBuildFile; fileRef = A104EC5C220A3E4400CBF67A /* JSMockPaymentContactFields.h */; };
 		A104F24414C71F7A009E2C23 /* CachedSVGDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A10BB5851484E3A700B2E87A /* RenderSVGRect.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5831484E3A700B2E87A /* RenderSVGRect.h */; };
 		A10BB58B1484E3B300B2E87A /* RenderSVGShape.h in Headers */ = {isa = PBXBuildFile; fileRef = A10BB5891484E3B300B2E87A /* RenderSVGShape.h */; };
@@ -11042,6 +11045,11 @@
 		A0EE0DF2144F825500F80B0D /* WebGLDebugRendererInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLDebugRendererInfo.h; sourceTree = "<group>"; };
 		A0EE0DF3144F825500F80B0D /* WebGLDebugShaders.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebGLDebugShaders.cpp; sourceTree = "<group>"; };
 		A0EE0DF4144F825500F80B0D /* WebGLDebugShaders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLDebugShaders.h; sourceTree = "<group>"; };
+		A104EC53220A017400CBF67A /* PaymentCoordinatorClient.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = PaymentCoordinatorClient.cpp; sourceTree = "<group>"; };
+		A104EC55220A39B400CBF67A /* MockPaymentContactFields.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MockPaymentContactFields.h; sourceTree = "<group>"; };
+		A104EC57220A39B400CBF67A /* MockPaymentContactFields.idl */ = {isa = PBXFileReference; lastKnownFileType = text; path = MockPaymentContactFields.idl; sourceTree = "<group>"; };
+		A104EC5B220A3E4300CBF67A /* JSMockPaymentContactFields.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = JSMockPaymentContactFields.cpp; sourceTree = "<group>"; };
+		A104EC5C220A3E4400CBF67A /* JSMockPaymentContactFields.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSMockPaymentContactFields.h; sourceTree = "<group>"; };
 		A104F24114C71F7A009E2C23 /* CachedSVGDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedSVGDocument.cpp; sourceTree = "<group>"; };
 		A104F24214C71F7A009E2C23 /* CachedSVGDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedSVGDocument.h; sourceTree = "<group>"; };
 		A10BB5821484E3A700B2E87A /* RenderSVGRect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderSVGRect.cpp; sourceTree = "<group>"; };
@@ -16519,6 +16527,7 @@
 				1A8A64381D19FC5300D0E00F /* PaymentContact.h */,
 				1A58E86B1D19E42D00C0EA73 /* PaymentCoordinator.cpp */,
 				1A58E86C1D19E42D00C0EA73 /* PaymentCoordinator.h */,
+				A104EC53220A017400CBF67A /* PaymentCoordinatorClient.cpp */,
 				1A58E8621D19D3BF00C0EA73 /* PaymentCoordinatorClient.h */,
 				7CF930E61E01F9AD00BAFFBE /* PaymentHeaders.h */,
 				1AE96A871D1A0CEB00B86768 /* PaymentMerchantSession.h */,
@@ -17485,6 +17494,8 @@
 				A146D31C1F99C9C200D29196 /* MockPaymentAddress.h */,
 				A146D31E1F99C9C200D29196 /* MockPaymentAddress.idl */,
 				A146D3241F99D69800D29196 /* MockPaymentContact.h */,
+				A104EC55220A39B400CBF67A /* MockPaymentContactFields.h */,
+				A104EC57220A39B400CBF67A /* MockPaymentContactFields.idl */,
 				A1AFEDE51F8BFF6D0087013F /* MockPaymentCoordinator.cpp */,
 				A1AFEDE41F8BFF6D0087013F /* MockPaymentCoordinator.h */,
 				A146D3161F99B53D00D29196 /* MockPaymentCoordinator.idl */,
@@ -17526,6 +17537,8 @@
 				2D6F3E931C1F85550061DBD4 /* JSMockPageOverlay.h */,
 				A146D3201F99CA3E00D29196 /* JSMockPaymentAddress.cpp */,
 				A146D31F1F99CA3D00D29196 /* JSMockPaymentAddress.h */,
+				A104EC5B220A3E4300CBF67A /* JSMockPaymentContactFields.cpp */,
+				A104EC5C220A3E4400CBF67A /* JSMockPaymentContactFields.h */,
 				A146D3191F99BCBB00D29196 /* JSMockPaymentCoordinator.cpp */,
 				A146D3181F99BCBA00D29196 /* JSMockPaymentCoordinator.h */,
 				A1BB85B42159B3890067E07D /* JSMockPaymentError.cpp */,
@@ -27805,6 +27818,7 @@
 				A19AEA211AAA808600B52B25 /* JSMockContentFilterSettings.h in Headers */,
 				538EC9341F99B9F7004D22A8 /* JSMockPageOverlay.h in Headers */,
 				A146D3231F99D0EF00D29196 /* JSMockPaymentAddress.h in Headers */,
+				A104EC5E220A3E4E00CBF67A /* JSMockPaymentContactFields.h in Headers */,
 				A146D31B1F99BCFB00D29196 /* JSMockPaymentCoordinator.h in Headers */,
 				A1BB85B92159B3AE0067E07D /* JSMockPaymentError.h in Headers */,
 				427DA71E13735DFA007C57FB /* JSServiceWorkerInternals.h in Headers */,
@@ -27820,6 +27834,7 @@
 				A14BB0A01F9813B800605A35 /* MockPayment.h in Headers */,
 				A146D3211F99CB1A00D29196 /* MockPaymentAddress.h in Headers */,
 				A146D3251F99D69800D29196 /* MockPaymentContact.h in Headers */,
+				A104EC5A220A3DE000CBF67A /* MockPaymentContactFields.h in Headers */,
 				A1AFEDE61F8BFF6D0087013F /* MockPaymentCoordinator.h in Headers */,
 				A1CBEF641F9F11290028DE7C /* MockPaymentMethod.h in Headers */,
 				A140618C1E2ECA0A0032B34E /* MockPreviewLoaderClient.h in Headers */,
@@ -32303,6 +32318,7 @@
 				A19AEA221AAA808A00B52B25 /* JSMockContentFilterSettings.cpp in Sources */,
 				2D4150DE1C1F868C000A3BA2 /* JSMockPageOverlay.cpp in Sources */,
 				A146D3221F99D0EC00D29196 /* JSMockPaymentAddress.cpp in Sources */,
+				A104EC5D220A3E4B00CBF67A /* JSMockPaymentContactFields.cpp in Sources */,
 				A146D31A1F99BCF800D29196 /* JSMockPaymentCoordinator.cpp in Sources */,
 				A1BB85B82159B3A40067E07D /* JSMockPaymentError.cpp in Sources */,
 				427DA71D13735DFA007C57FB /* JSServiceWorkerInternals.cpp in Sources */,

Modified: branches/safari-607-branch/Source/WebCore/loader/EmptyClients.cpp (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/loader/EmptyClients.cpp	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/loader/EmptyClients.cpp	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2006 Eric Seidel <[email protected]>
- * Copyright (C) 2008-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2008-2019 Apple Inc. All rights reserved.
  * Copyright (C) Research In Motion Limited 2011. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -311,7 +311,6 @@
 #if ENABLE(APPLE_PAY)
 
 class EmptyPaymentCoordinatorClient final : public PaymentCoordinatorClient {
-    bool supportsVersion(unsigned) final { return false; }
     Optional<String> validatedPaymentNetwork(const String&) final { return WTF::nullopt; }
     bool canMakePayments() final { return false; }
     void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void(bool)>&& completionHandler) final { callOnMainThread([completionHandler = WTFMove(completionHandler)] { completionHandler(false); }); }

Copied: branches/safari-607-branch/Source/WebCore/testing/MockPaymentContactFields.h (from rev 241158, branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.idl) (0 => 241159)


--- branches/safari-607-branch/Source/WebCore/testing/MockPaymentContactFields.h	                        (rev 0)
+++ branches/safari-607-branch/Source/WebCore/testing/MockPaymentContactFields.h	2019-02-07 23:36:57 UTC (rev 241159)
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(APPLE_PAY)
+
+#include "ApplePaySessionPaymentRequest.h"
+
+namespace WebCore {
+
+struct MockPaymentContactFields : public ApplePaySessionPaymentRequest::ContactFields {
+    MockPaymentContactFields() = default;
+    MockPaymentContactFields(const ApplePaySessionPaymentRequest::ContactFields& contactFields)
+        : ApplePaySessionPaymentRequest::ContactFields { contactFields }
+    {
+    }
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(APPLE_PAY)

Copied: branches/safari-607-branch/Source/WebCore/testing/MockPaymentContactFields.idl (from rev 241158, branches/safari-607-branch/Source/WebCore/Modules/applepay/ApplePayPaymentRequest.idl) (0 => 241159)


--- branches/safari-607-branch/Source/WebCore/testing/MockPaymentContactFields.idl	                        (rev 0)
+++ branches/safari-607-branch/Source/WebCore/testing/MockPaymentContactFields.idl	2019-02-07 23:36:57 UTC (rev 241159)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2019 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+[
+    Conditional=APPLE_PAY,
+    JSGenerateToJSObject,
+] dictionary MockPaymentContactFields {
+    boolean postalAddress = false;
+    boolean phone = false;
+    boolean email = false;
+    boolean name = false;
+    boolean phoneticName = false;
+};

Modified: branches/safari-607-branch/Source/WebCore/testing/MockPaymentCoordinator.cpp (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/testing/MockPaymentCoordinator.cpp	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/testing/MockPaymentCoordinator.cpp	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -53,21 +53,6 @@
     m_availablePaymentNetworks.add("visa");
 }
 
-bool MockPaymentCoordinator::supportsVersion(unsigned version)
-{
-    ASSERT(version > 0);
-
-#if !ENABLE(APPLE_PAY_SESSION_V3)
-    static const unsigned currentVersion = 2;
-#elif !ENABLE(APPLE_PAY_SESSION_V4)
-    static const unsigned currentVersion = 3;
-#else
-    static const unsigned currentVersion = 5;
-#endif
-
-    return version <= currentVersion;
-}
-
 Optional<String> MockPaymentCoordinator::validatedPaymentNetwork(const String& paymentNetwork)
 {
     auto result = m_availablePaymentNetworks.find(paymentNetwork);
@@ -119,6 +104,8 @@
     if (request.shippingContact().pkContact())
         m_shippingAddress = request.shippingContact().toApplePayPaymentContact(request.version());
     m_shippingMethods = convert(request.shippingMethods());
+    m_requiredBillingContactFields = request.requiredBillingContactFields();
+    m_requiredShippingContactFields = request.requiredShippingContactFields();
 
     ASSERT(showCount == hideCount);
     ++showCount;

Modified: branches/safari-607-branch/Source/WebCore/testing/MockPaymentCoordinator.h (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/testing/MockPaymentCoordinator.h	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/testing/MockPaymentCoordinator.h	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -30,6 +30,7 @@
 #include "ApplePayLineItem.h"
 #include "ApplePayShippingMethod.h"
 #include "MockPaymentAddress.h"
+#include "MockPaymentContactFields.h"
 #include "MockPaymentError.h"
 #include "PaymentCoordinatorClient.h"
 #include <wtf/HashSet.h>
@@ -56,12 +57,13 @@
     const Vector<ApplePayLineItem>& lineItems() const { return m_lineItems; }
     const Vector<MockPaymentError>& errors() const { return m_errors; }
     const Vector<ApplePayShippingMethod>& shippingMethods() const { return m_shippingMethods; }
+    const MockPaymentContactFields& requiredBillingContactFields() const { return m_requiredBillingContactFields; }
+    const MockPaymentContactFields& requiredShippingContactFields() const { return m_requiredShippingContactFields; }
 
     void ref() const { }
     void deref() const { }
 
 private:
-    bool supportsVersion(unsigned) final;
     Optional<String> validatedPaymentNetwork(const String&) final;
     bool canMakePayments() final;
     void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void(bool)>&&);
@@ -89,6 +91,8 @@
     Vector<MockPaymentError> m_errors;
     Vector<ApplePayShippingMethod> m_shippingMethods;
     HashSet<String, ASCIICaseInsensitiveHash> m_availablePaymentNetworks;
+    MockPaymentContactFields m_requiredBillingContactFields;
+    MockPaymentContactFields m_requiredShippingContactFields;
 };
 
 } // namespace WebCore

Modified: branches/safari-607-branch/Source/WebCore/testing/MockPaymentCoordinator.idl (241158 => 241159)


--- branches/safari-607-branch/Source/WebCore/testing/MockPaymentCoordinator.idl	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebCore/testing/MockPaymentCoordinator.idl	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2017-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2017-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -39,4 +39,6 @@
     readonly attribute sequence<ApplePayLineItem> lineItems;
     readonly attribute sequence<MockPaymentError> errors;
     readonly attribute sequence<ApplePayShippingMethod> shippingMethods;
+    readonly attribute MockPaymentContactFields requiredBillingContactFields;
+    readonly attribute MockPaymentContactFields requiredShippingContactFields;
 };

Modified: branches/safari-607-branch/Source/WebKit/ChangeLog (241158 => 241159)


--- branches/safari-607-branch/Source/WebKit/ChangeLog	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebKit/ChangeLog	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,92 @@
 2019-02-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r241105. rdar://problem/47893571
+
+    [Payment Request] It should be possible to require a phonetic name for shipping contacts
+    https://bugs.webkit.org/show_bug.cgi?id=194311
+    <rdar://46733045>
+    
+    Reviewed by Alex Christensen.
+    
+    Source/WebCore:
+    
+    It should be possible to require that a shipping contact has a phonetic name in Payment Request.
+    To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to
+    ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data.
+    
+    Since required shipping contact fields can now be specified both in
+    requiredShippingContactFields and PaymentOptions, we merge the required fields from these
+    two sources such that, e.g., email is required if it is specified in either place.
+    
+    So that clients can detect this new feature, the API version number is bumped from 5 to 6.
+    
+    Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html.
+    
+    * DerivedSources.make:
+    * Modules/applepay/ApplePayPaymentRequest.h:
+    * Modules/applepay/ApplePayPaymentRequest.idl:
+    * Modules/applepay/ApplePayRequestBase.cpp:
+    (WebCore::convertAndValidate):
+    * Modules/applepay/ApplePayRequestBase.h:
+    * Modules/applepay/ApplePayRequestBase.idl:
+    * Modules/applepay/ApplePaySession.cpp:
+    (WebCore::convertAndValidate):
+    * Modules/applepay/PaymentCoordinatorClient.cpp: Added.
+    (WebCore::PaymentCoordinatorClient::supportsVersion):
+    * Modules/applepay/PaymentCoordinatorClient.h:
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+    (WebCore::mergePaymentOptions):
+    (WebCore::ApplePayPaymentHandler::show):
+    * SourcesCocoa.txt:
+    * WebCore.xcodeproj/project.pbxproj:
+    * loader/EmptyClients.cpp:
+    * testing/MockPaymentContactFields.h: Added.
+    (WebCore::MockPaymentContactFields::MockPaymentContactFields):
+    * testing/MockPaymentContactFields.idl: Added.
+    * testing/MockPaymentCoordinator.cpp:
+    (WebCore::MockPaymentCoordinator::showPaymentUI):
+    (WebCore::MockPaymentCoordinator::supportsVersion): Deleted.
+    * testing/MockPaymentCoordinator.h:
+    * testing/MockPaymentCoordinator.idl:
+    
+    Source/WebKit:
+    
+    * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+    (WebKit::WebPaymentCoordinator::supportsVersion): Deleted.
+    * WebProcess/ApplePay/WebPaymentCoordinator.h:
+    
+    Source/WebKitLegacy/mac:
+    
+    * WebCoreSupport/WebPaymentCoordinatorClient.h:
+    * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+    (WebPaymentCoordinatorClient::supportsVersion): Deleted.
+    
+    LayoutTests:
+    
+    * http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html:
+    * http/tests/ssl/applepay/PaymentRequest.https-expected.txt:
+    * http/tests/ssl/applepay/PaymentRequest.https.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-06  Andy Estes  <[email protected]>
+
+            [Payment Request] It should be possible to require a phonetic name for shipping contacts
+            https://bugs.webkit.org/show_bug.cgi?id=194311
+            <rdar://46733045>
+
+            Reviewed by Alex Christensen.
+
+            * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+            (WebKit::WebPaymentCoordinator::supportsVersion): Deleted.
+            * WebProcess/ApplePay/WebPaymentCoordinator.h:
+
+2019-02-07  Alan Coon  <[email protected]>
+
         Cherry-pick r241026. rdar://problem/47774548
 
     Roll out parts of r238819 since it is a PLT performance regression.

Modified: branches/safari-607-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp (241158 => 241159)


--- branches/safari-607-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.cpp	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -51,21 +51,6 @@
     WebProcess::singleton().removeMessageReceiver(*this);
 }
 
-bool WebPaymentCoordinator::supportsVersion(unsigned version)
-{
-    ASSERT(version > 0);
-
-#if !ENABLE(APPLE_PAY_SESSION_V3)
-    static const unsigned currentVersion = 2;
-#elif !ENABLE(APPLE_PAY_SESSION_V4)
-    static const unsigned currentVersion = 3;
-#else
-    static const unsigned currentVersion = 5;
-#endif
-
-    return version <= currentVersion;
-}
-
 const WebPaymentCoordinator::AvailablePaymentNetworksSet& WebPaymentCoordinator::availablePaymentNetworks()
 {
     if (m_availablePaymentNetworks)

Modified: branches/safari-607-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h (241158 => 241159)


--- branches/safari-607-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebKit/WebProcess/ApplePay/WebPaymentCoordinator.h	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -55,7 +55,6 @@
 
 private:
     // WebCore::PaymentCoordinatorClient.
-    bool supportsVersion(unsigned version) override;
     Optional<String> validatedPaymentNetwork(const String&) override;
     bool canMakePayments() override;
     void canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) override;

Modified: branches/safari-607-branch/Source/WebKitLegacy/mac/ChangeLog (241158 => 241159)


--- branches/safari-607-branch/Source/WebKitLegacy/mac/ChangeLog	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebKitLegacy/mac/ChangeLog	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,92 @@
 2019-02-07  Alan Coon  <[email protected]>
 
+        Cherry-pick r241105. rdar://problem/47893571
+
+    [Payment Request] It should be possible to require a phonetic name for shipping contacts
+    https://bugs.webkit.org/show_bug.cgi?id=194311
+    <rdar://46733045>
+    
+    Reviewed by Alex Christensen.
+    
+    Source/WebCore:
+    
+    It should be possible to require that a shipping contact has a phonetic name in Payment Request.
+    To accomplish this, move requiredShippingContactFields from ApplePayPaymentRequest to
+    ApplePayRequestBase so that it can be used as part of an Apple Pay payment method data.
+    
+    Since required shipping contact fields can now be specified both in
+    requiredShippingContactFields and PaymentOptions, we merge the required fields from these
+    two sources such that, e.g., email is required if it is specified in either place.
+    
+    So that clients can detect this new feature, the API version number is bumped from 5 to 6.
+    
+    Added test cases to ApplePayRequestShippingContact.https.html and ApplePayRequestShippingContactV3.https.html.
+    
+    * DerivedSources.make:
+    * Modules/applepay/ApplePayPaymentRequest.h:
+    * Modules/applepay/ApplePayPaymentRequest.idl:
+    * Modules/applepay/ApplePayRequestBase.cpp:
+    (WebCore::convertAndValidate):
+    * Modules/applepay/ApplePayRequestBase.h:
+    * Modules/applepay/ApplePayRequestBase.idl:
+    * Modules/applepay/ApplePaySession.cpp:
+    (WebCore::convertAndValidate):
+    * Modules/applepay/PaymentCoordinatorClient.cpp: Added.
+    (WebCore::PaymentCoordinatorClient::supportsVersion):
+    * Modules/applepay/PaymentCoordinatorClient.h:
+    * Modules/applepay/paymentrequest/ApplePayPaymentHandler.cpp:
+    (WebCore::mergePaymentOptions):
+    (WebCore::ApplePayPaymentHandler::show):
+    * SourcesCocoa.txt:
+    * WebCore.xcodeproj/project.pbxproj:
+    * loader/EmptyClients.cpp:
+    * testing/MockPaymentContactFields.h: Added.
+    (WebCore::MockPaymentContactFields::MockPaymentContactFields):
+    * testing/MockPaymentContactFields.idl: Added.
+    * testing/MockPaymentCoordinator.cpp:
+    (WebCore::MockPaymentCoordinator::showPaymentUI):
+    (WebCore::MockPaymentCoordinator::supportsVersion): Deleted.
+    * testing/MockPaymentCoordinator.h:
+    * testing/MockPaymentCoordinator.idl:
+    
+    Source/WebKit:
+    
+    * WebProcess/ApplePay/WebPaymentCoordinator.cpp:
+    (WebKit::WebPaymentCoordinator::supportsVersion): Deleted.
+    * WebProcess/ApplePay/WebPaymentCoordinator.h:
+    
+    Source/WebKitLegacy/mac:
+    
+    * WebCoreSupport/WebPaymentCoordinatorClient.h:
+    * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+    (WebPaymentCoordinatorClient::supportsVersion): Deleted.
+    
+    LayoutTests:
+    
+    * http/tests/ssl/applepay/ApplePayRequestShippingContact.https-expected.txt:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContact.https.html:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https-expected.txt:
+    * http/tests/ssl/applepay/ApplePayRequestShippingContactV3.https.html:
+    * http/tests/ssl/applepay/PaymentRequest.https-expected.txt:
+    * http/tests/ssl/applepay/PaymentRequest.https.html:
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@241105 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2019-02-06  Andy Estes  <[email protected]>
+
+            [Payment Request] It should be possible to require a phonetic name for shipping contacts
+            https://bugs.webkit.org/show_bug.cgi?id=194311
+            <rdar://46733045>
+
+            Reviewed by Alex Christensen.
+
+            * WebCoreSupport/WebPaymentCoordinatorClient.h:
+            * WebCoreSupport/WebPaymentCoordinatorClient.mm:
+            (WebPaymentCoordinatorClient::supportsVersion): Deleted.
+
+2019-02-07  Alan Coon  <[email protected]>
+
         Cherry-pick r240808. rdar://problem/47774548
 
     Revert r238819 which is unneeded and caused a performance regression.

Modified: branches/safari-607-branch/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h (241158 => 241159)


--- branches/safari-607-branch/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.h	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -36,7 +36,6 @@
 private:
     ~WebPaymentCoordinatorClient();
 
-    bool supportsVersion(unsigned) override;
     Optional<String> validatedPaymentNetwork(const String&) override;
     bool canMakePayments() override;
     void canMakePaymentsWithActiveCard(const String&, const String&, WTF::Function<void (bool)>&& completionHandler) override;

Modified: branches/safari-607-branch/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm (241158 => 241159)


--- branches/safari-607-branch/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm	2019-02-07 23:36:46 UTC (rev 241158)
+++ branches/safari-607-branch/Source/WebKitLegacy/mac/WebCoreSupport/WebPaymentCoordinatorClient.mm	2019-02-07 23:36:57 UTC (rev 241159)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -38,11 +38,6 @@
 {
 }
 
-bool WebPaymentCoordinatorClient::supportsVersion(unsigned)
-{
-    return false;
-}
-
 Optional<String> WebPaymentCoordinatorClient::validatedPaymentNetwork(const String&)
 {
     return WTF::nullopt;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to