зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1483470 - Handling PaymentRequestUpdateEvent::updateWith() to a responed PaymentRequest. r=baku
1. Checking if the PaymentRequest::mState equals to eInteractive when calling PaymentRequest::UpdatePayment() and PaymentRequest::AbortUpdate. 2. Removing the non-suitable MOZ_ASSERT in PaymentRequest::RespondShowPayment()
This commit is contained in:
Родитель
6fddec41b3
Коммит
a29e2c4da2
|
@ -746,7 +746,7 @@ void
|
|||
PaymentRequest::RejectShowPayment(nsresult aRejectReason)
|
||||
{
|
||||
MOZ_ASSERT(mAcceptPromise);
|
||||
MOZ_ASSERT(ReadyForUpdate());
|
||||
MOZ_ASSERT(mState == eInteractive);
|
||||
|
||||
mAcceptPromise->MaybeReject(aRejectReason);
|
||||
mState = eClosed;
|
||||
|
@ -762,7 +762,6 @@ PaymentRequest::RespondShowPayment(const nsAString& aMethodName,
|
|||
nsresult aRv)
|
||||
{
|
||||
MOZ_ASSERT(mAcceptPromise);
|
||||
MOZ_ASSERT(ReadyForUpdate());
|
||||
MOZ_ASSERT(mState == eInteractive);
|
||||
|
||||
if (NS_FAILED(aRv)) {
|
||||
|
@ -866,6 +865,9 @@ PaymentRequest::UpdatePayment(JSContext* aCx, const PaymentDetailsUpdate& aDetai
|
|||
bool aDeferredShow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCx);
|
||||
if (mState != eInteractive) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
RefPtr<PaymentRequestManager> manager = PaymentRequestManager::GetSingleton();
|
||||
if (NS_WARN_IF(!manager)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -883,6 +885,9 @@ PaymentRequest::AbortUpdate(nsresult aRv, bool aDeferredShow)
|
|||
{
|
||||
MOZ_ASSERT(NS_FAILED(aRv));
|
||||
|
||||
if (mState != eInteractive) {
|
||||
return;
|
||||
}
|
||||
// Close down any remaining user interface.
|
||||
RefPtr<PaymentRequestManager> manager = PaymentRequestManager::GetSingleton();
|
||||
MOZ_ASSERT(manager);
|
||||
|
|
Загрузка…
Ссылка в новой задаче