Bug 1442453 - Don't enforce "one interactive request" in the wrong place. r=baku
authorBlake Kaplan <mrbkap@gmail.com>
Wed, 30 May 2018 14:04:32 -0700
changeset 479617 cea1719a866e57c75823514fbe89e89cfdd9134f
parent 479616 bbc721db121cc1341e8c4cab9b2ec933b6030fa2
child 479618 a509c5193aaa4eda88a98a34bbaabed1ba0df0f6
push id1757
push userffxbld-merge
push dateFri, 24 Aug 2018 17:02:43 +0000
treeherdermozilla-release@736023aebdb1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1442453
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;
 }