Bug 1442453 - Don't enforce "one interactive request" in the wrong place. r=baku draft
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 30 May 2018 14:04:32 -0700
changeset 808269 f2582a5386ea023bfb542ccb0b3a830ba1a184cd
parent 808182 9b74b9f2939a7ae3a0ea6e711dc32ed5203e03ff
child 808270 9718d0d139089f755823471041632b7d4a7cbecd
push id113333
push userbmo:mrbkap@mozilla.com
push dateMon, 18 Jun 2018 22:37:33 +0000
reviewersbaku
bugs1442453
milestone62.0a1
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
dom/payments/PaymentRequestManager.cpp
--- 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;
 }