Diff
Modified: trunk/LayoutTests/ChangeLog (238040 => 238041)
--- trunk/LayoutTests/ChangeLog 2018-11-09 18:19:07 UTC (rev 238040)
+++ trunk/LayoutTests/ChangeLog 2018-11-09 18:22:14 UTC (rev 238041)
@@ -1,3 +1,13 @@
+2018-11-09 Andy Estes <aes...@apple.com>
+
+ [Payment Request] PaymentResponse.details should be updated when the user accepts a rpayment retry
+ https://bugs.webkit.org/show_bug.cgi?id=191440
+
+ Reviewed by Dean Jackson.
+
+ * http/tests/paymentrequest/payment-response-retry-method.https-expected.txt:
+ * http/tests/paymentrequest/payment-response-retry-method.https.html:
+
2018-11-09 Chris Dumez <cdu...@apple.com>
HTML form validation bubble disappears
Modified: trunk/LayoutTests/http/tests/paymentrequest/payment-response-retry-method.https-expected.txt (238040 => 238041)
--- trunk/LayoutTests/http/tests/paymentrequest/payment-response-retry-method.https-expected.txt 2018-11-09 18:19:07 UTC (rev 238040)
+++ trunk/LayoutTests/http/tests/paymentrequest/payment-response-retry-method.https-expected.txt 2018-11-09 18:22:14 UTC (rev 238041)
@@ -11,4 +11,5 @@
PASS When "abort the update" occurs because of an update error, the `retryPromise` is rejected and response.[[complete]] becomes true.
PASS Calling retry() multiple times is always a new object.
PASS When retrying without errors, the user is shown an `unknown` error.
+PASS response.details should be updated after the user accepts a retry.
Modified: trunk/LayoutTests/http/tests/paymentrequest/payment-response-retry-method.https.html (238040 => 238041)
--- trunk/LayoutTests/http/tests/paymentrequest/payment-response-retry-method.https.html 2018-11-09 18:19:07 UTC (rev 238040)
+++ trunk/LayoutTests/http/tests/paymentrequest/payment-response-retry-method.https.html 2018-11-09 18:22:14 UTC (rev 238041)
@@ -199,4 +199,14 @@
await response.complete("success");
}, "When retrying without errors, the user is shown an `unknown` error.");
+promise_test(async t => {
+ const { response, request } = await getPaymentRequestResponse({ requestShipping: true });
+ var originalDetails = response.details;
+ const retryPromise = response.retry();
+ internals.mockPaymentCoordinator.acceptPayment();
+ await retryPromise;
+ assert_not_equals(response.details, originalDetails, "response.details should be a new object after the user accepts a retry");
+ await response.complete("success");
+}, "response.details should be updated after the user accepts a retry.");
+
</script>
Modified: trunk/Source/WebCore/ChangeLog (238040 => 238041)
--- trunk/Source/WebCore/ChangeLog 2018-11-09 18:19:07 UTC (rev 238040)
+++ trunk/Source/WebCore/ChangeLog 2018-11-09 18:22:14 UTC (rev 238041)
@@ -1,3 +1,22 @@
+2018-11-09 Andy Estes <aes...@apple.com>
+
+ [Payment Request] PaymentResponse.details should be updated when the user accepts a retried payment
+ https://bugs.webkit.org/show_bug.cgi?id=191440
+
+ Reviewed by Dean Jackson.
+
+ PaymentResponse.details was being initialized in the PaymentResponse constructor and never
+ updated when the user accepts a retried payment. We need to update it.
+
+ Added a test case to http/tests/paymentrequest/payment-response-retry-method.https.html.
+
+ * Modules/paymentrequest/PaymentRequest.cpp:
+ (WebCore::PaymentRequest::accept):
+ * Modules/paymentrequest/PaymentResponse.cpp:
+ (WebCore::PaymentResponse::PaymentResponse):
+ (WebCore::PaymentResponse::setDetailsFunction):
+ * Modules/paymentrequest/PaymentResponse.h:
+
2018-11-09 Fujii Hironori <hironori.fu...@sony.com>
MediaPlayerPrivateMediaFoundation.h: warning: 'GetService' overrides a member function but is not marked 'override' [-Winconsistent-missing-override]
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp (238040 => 238041)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp 2018-11-09 18:19:07 UTC (rev 238040)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp 2018-11-09 18:22:14 UTC (rev 238041)
@@ -703,11 +703,12 @@
bool isRetry = m_response;
if (!isRetry) {
- m_response = PaymentResponse::create(scriptExecutionContext(), *this, WTFMove(detailsFunction));
+ m_response = PaymentResponse::create(scriptExecutionContext(), *this);
m_response->setRequestId(m_details.id);
}
m_response->setMethodName(methodName);
+ m_response->setDetailsFunction(WTFMove(detailsFunction));
m_response->setShippingAddress(m_options.requestShipping ? shippingAddress.ptr() : nullptr);
m_response->setShippingOption(m_options.requestShipping ? m_shippingOption : String { });
m_response->setPayerName(m_options.requestPayerName ? payerName : String { });
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp (238040 => 238041)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp 2018-11-09 18:19:07 UTC (rev 238040)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.cpp 2018-11-09 18:22:14 UTC (rev 238041)
@@ -34,12 +34,10 @@
namespace WebCore {
-PaymentResponse::PaymentResponse(ScriptExecutionContext* context, PaymentRequest& request, DetailsFunction&& detailsFunction)
+PaymentResponse::PaymentResponse(ScriptExecutionContext* context, PaymentRequest& request)
: ActiveDOMObject { context }
, m_request { makeWeakPtr(request) }
- , m_detailsFunction { WTFMove(detailsFunction) }
{
- ASSERT(m_detailsFunction);
suspendIfNeeded();
}
@@ -55,6 +53,12 @@
ASSERT(!hasRetryPromise());
}
+void PaymentResponse::setDetailsFunction(DetailsFunction&& detailsFunction)
+{
+ m_detailsFunction = WTFMove(detailsFunction);
+ m_cachedDetails = { };
+}
+
void PaymentResponse::complete(std::optional<PaymentComplete>&& result, DOMPromiseDeferred<void>&& promise)
{
if (m_state == State::Stopped || !m_request) {
Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.h (238040 => 238041)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.h 2018-11-09 18:19:07 UTC (rev 238040)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentResponse.h 2018-11-09 18:22:14 UTC (rev 238041)
@@ -46,9 +46,9 @@
public:
using DetailsFunction = Function<JSC::Strong<JSC::JSObject>(JSC::ExecState&)>;
- static Ref<PaymentResponse> create(ScriptExecutionContext* context, PaymentRequest& request, DetailsFunction&& detailsFunction)
+ static Ref<PaymentResponse> create(ScriptExecutionContext* context, PaymentRequest& request)
{
- auto response = adoptRef(*new PaymentResponse(context, request, WTFMove(detailsFunction)));
+ auto response = adoptRef(*new PaymentResponse(context, request));
response->finishConstruction();
return response;
}
@@ -62,6 +62,8 @@
void setMethodName(const String& methodName) { m_methodName = methodName; }
const DetailsFunction& detailsFunction() const { return m_detailsFunction; }
+ void setDetailsFunction(DetailsFunction&&);
+
JSValueInWrappedObject& cachedDetails() { return m_cachedDetails; }
PaymentAddress* shippingAddress() const { return m_shippingAddress.get(); }
@@ -89,7 +91,7 @@
using RefCounted<PaymentResponse>::deref;
private:
- PaymentResponse(ScriptExecutionContext*, PaymentRequest&, DetailsFunction&&);
+ PaymentResponse(ScriptExecutionContext*, PaymentRequest&);
void finishConstruction();
// ActiveDOMObject