diff --git a/dom/payments/PaymentRequest.cpp b/dom/payments/PaymentRequest.cpp index b28389dc5ed3..84ef129c929a 100644 --- a/dom/payments/PaymentRequest.cpp +++ b/dom/payments/PaymentRequest.cpp @@ -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 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 manager = PaymentRequestManager::GetSingleton(); MOZ_ASSERT(manager);