Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEvent.cpp

Issue 2170783002: Add a timeout to the update event in case page doesn't resolve promise from updateWith (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEvent.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEvent.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEvent.cpp
index d04dd8b983de79b8b739c1e8e234ca1952eccfe4..17e2728a7dfc93bcde266fda97ff9f59a7836d60 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEvent.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequestUpdateEvent.cpp
@@ -93,6 +93,7 @@ PaymentRequestUpdateEvent* PaymentRequestUpdateEvent::create(const AtomicString&
void PaymentRequestUpdateEvent::setPaymentDetailsUpdater(PaymentUpdater* updater)
{
+ m_abortTimer.startOneShot(s_abortTimeout, BLINK_FROM_HERE);
please use gerrit instead 2016/07/21 16:35:24 #include "public/platform/WebTraceLocation.h" Thi
haraken 2016/07/21 16:37:27 What happens if you hit setPaymentDetailsUpdater b
please use gerrit instead 2016/07/21 16:46:42 Should not happen. setPaymentDetailsUpdater is inv
pals 2016/07/22 04:06:19 Done.
m_updater = updater;
}
@@ -113,11 +114,20 @@ void PaymentRequestUpdateEvent::updateWith(ScriptState* scriptState, ScriptPromi
stopImmediatePropagation();
m_waitForUpdate = true;
+ m_abortTimer.stop();
promise.then(UpdatePaymentDetailsFunction::createFunction(scriptState, m_updater),
UpdatePaymentDetailsErrorFunction::createFunction(scriptState, m_updater));
}
+void PaymentRequestUpdateEvent::onTimerFired(Timer<PaymentRequestUpdateEvent>*)
+{
+ if (!m_updater)
+ return;
+
+ m_updater->onUpdatePaymentDetailsFailure(ScriptValue());
+}
+
DEFINE_TRACE(PaymentRequestUpdateEvent)
{
visitor->trace(m_updater);
@@ -126,12 +136,14 @@ DEFINE_TRACE(PaymentRequestUpdateEvent)
PaymentRequestUpdateEvent::PaymentRequestUpdateEvent()
: m_waitForUpdate(false)
+ , m_abortTimer(this, &PaymentRequestUpdateEvent::onTimerFired)
{
}
PaymentRequestUpdateEvent::PaymentRequestUpdateEvent(const AtomicString& type, const PaymentRequestUpdateEventInit& init)
: Event(type, init)
, m_waitForUpdate(false)
+ , m_abortTimer(this, &PaymentRequestUpdateEvent::onTimerFired)
{
}

Powered by Google App Engine
This is Rietveld 408576698