Modified: trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp (295645 => 295646)
--- trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp 2022-06-17 22:18:20 UTC (rev 295645)
+++ trunk/Source/WebCore/Modules/paymentrequest/PaymentRequest.cpp 2022-06-17 23:09:22 UTC (rev 295646)
@@ -560,10 +560,13 @@
{
whenDetailsSettled([this, protectedThis = Ref { *this }, methodName, methodDetailsFunction = WTFMove(methodDetailsFunction)]() mutable {
auto& eventName = eventNames().paymentmethodchangeEvent;
- if (hasEventListeners(eventName))
+ if (hasEventListeners(eventName)) {
dispatchAndCheckUpdateEvent(PaymentMethodChangeEvent::create(eventName, methodName, WTFMove(methodDetailsFunction)));
- else
- activePaymentHandler()->detailsUpdated(UpdateReason::PaymentMethodChanged, { }, { }, { }, { });
+ return;
+ }
+
+ Ref activePaymentHandler = *this->activePaymentHandler();
+ activePaymentHandler->detailsUpdated(UpdateReason::PaymentMethodChanged, { }, { }, { }, { });
});
}
@@ -641,6 +644,8 @@
return;
}
+ Ref activePaymentHandler = *this->activePaymentHandler();
+
auto& context = *m_detailsPromise->scriptExecutionContext();
auto throwScope = DECLARE_THROW_SCOPE(context.vm());
auto detailsUpdate = convertDictionary<PaymentDetailsUpdate>(*context.globalObject(), m_detailsPromise->result());
@@ -678,7 +683,7 @@
m_serializedModifierData = WTFMove(std::get<1>(shippingOptionAndModifierData));
}
- auto result = activePaymentHandler()->detailsUpdated(reason, WTFMove(detailsUpdate.error), WTFMove(detailsUpdate.shippingAddressErrors), WTFMove(detailsUpdate.payerErrors), detailsUpdate.paymentMethodErrors.get());
+ auto result = activePaymentHandler->detailsUpdated(reason, WTFMove(detailsUpdate.error), WTFMove(detailsUpdate.shippingAddressErrors), WTFMove(detailsUpdate.payerErrors), detailsUpdate.paymentMethodErrors.get());
if (result.hasException()) {
abortWithException(result.releaseException());
return;
@@ -775,7 +780,8 @@
if (!m_activePaymentHandler)
return Exception { AbortError };
- auto exception = activePaymentHandler()->complete(document, WTFMove(result), WTFMove(serializedData));
+ Ref activePaymentHandler = *this->activePaymentHandler();
+ auto exception = activePaymentHandler->complete(document, WTFMove(result), WTFMove(serializedData));
if (exception.hasException())
return exception.releaseException();
@@ -790,7 +796,9 @@
return Exception { AbortError };
m_state = State::Interactive;
- return activePaymentHandler()->retry(WTFMove(errors));
+
+ Ref activePaymentHandler = *this->activePaymentHandler();
+ return activePaymentHandler->retry(WTFMove(errors));
}
void PaymentRequest::cancel()