Bug 1442453 - Don't enforce "one interactive request" in the wrong place. r=baku
The existing code assumed that the only reason that there could be a
PaymentRequestChild was due to an active show() call. That is not the case. We
already know whether there's an "interactive" PaymentRequest through
mShowingRequest, so we should just use that instead.
MozReview-Commit-ID: IA9bXn7hS63
--- a/dom/payments/PaymentRequestManager.cpp
+++ b/dom/payments/PaymentRequestManager.cpp
@@ -268,33 +268,16 @@ PaymentRequestManager::GetPaymentChild(P
nsPIDOMWindowInner* win = aRequest->GetOwner();
NS_ENSURE_TRUE(win, NS_ERROR_FAILURE);
TabChild* tabChild = TabChild::GetFrom(win->GetDocShell());
NS_ENSURE_TRUE(tabChild, NS_ERROR_FAILURE);
nsAutoString requestId;
aRequest->GetInternalId(requestId);
- // Only one payment request can interact with user at the same time.
- // Before we create a new PaymentRequestChild, make sure there is no other
- // payment request are interacting on the same tab.
- for (auto iter = mPaymentChildHash.ConstIter(); !iter.Done(); iter.Next()) {
- RefPtr<PaymentRequest> request = iter.Key();
- if (request->Equals(requestId)) {
- continue;
- }
- nsPIDOMWindowInner* requestOwner = request->GetOwner();
- NS_ENSURE_TRUE(requestOwner, NS_ERROR_FAILURE);
- TabChild* tmpChild = TabChild::GetFrom(requestOwner->GetDocShell());
- NS_ENSURE_TRUE(tmpChild, NS_ERROR_FAILURE);
- if (tmpChild->GetTabId() == tabChild->GetTabId()) {
- return NS_ERROR_FAILURE;
- }
- }
-
paymentChild = new PaymentRequestChild();
tabChild->SendPPaymentRequestConstructor(paymentChild);
if (!mPaymentChildHash.Put(aRequest, paymentChild, mozilla::fallible) ) {
return NS_ERROR_OUT_OF_MEMORY;
}
paymentChild.forget(aChild);
return NS_OK;
}