OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "modules/payments/PaymentRequestUpdateEvent.h" | 5 #include "modules/payments/PaymentRequestUpdateEvent.h" |
6 | 6 |
7 #include "bindings/core/v8/ExceptionState.h" | 7 #include "bindings/core/v8/ExceptionState.h" |
8 #include "bindings/core/v8/ScriptFunction.h" | 8 #include "bindings/core/v8/ScriptFunction.h" |
9 #include "core/dom/DOMException.h" | 9 #include "core/dom/DOMException.h" |
10 #include "core/dom/ExceptionCode.h" | 10 #include "core/dom/ExceptionCode.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 private: | 64 private: |
65 UpdatePaymentDetailsErrorFunction(ScriptState* scriptState, PaymentUpdater* updater) | 65 UpdatePaymentDetailsErrorFunction(ScriptState* scriptState, PaymentUpdater* updater) |
66 : ScriptFunction(scriptState) | 66 : ScriptFunction(scriptState) |
67 , m_updater(updater) | 67 , m_updater(updater) |
68 { | 68 { |
69 DCHECK(m_updater); | 69 DCHECK(m_updater); |
70 } | 70 } |
71 | 71 |
72 ScriptValue call(ScriptValue value) override | 72 ScriptValue call(ScriptValue value) override |
73 { | 73 { |
74 m_updater->onUpdatePaymentDetailsFailure(value); | 74 m_updater->onUpdatePaymentDetailsFailure(value); |
please use gerrit instead
2016/07/29 15:40:50
String message;
value.toString(message);
m_updater
pals
2016/08/01 11:18:23
It was crashing if we do exactly like above. Doing
please use gerrit instead
2016/08/01 16:57:45
Acknowledged.
| |
75 return ScriptValue(); | 75 return ScriptValue(); |
76 } | 76 } |
77 | 77 |
78 Member<PaymentUpdater> m_updater; | 78 Member<PaymentUpdater> m_updater; |
79 }; | 79 }; |
80 | 80 |
81 } // namespace | 81 } // namespace |
82 | 82 |
83 PaymentRequestUpdateEvent::~PaymentRequestUpdateEvent() | 83 PaymentRequestUpdateEvent::~PaymentRequestUpdateEvent() |
84 { | 84 { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 | 122 |
123 promise.then(UpdatePaymentDetailsFunction::createFunction(scriptState, m_upd ater), | 123 promise.then(UpdatePaymentDetailsFunction::createFunction(scriptState, m_upd ater), |
124 UpdatePaymentDetailsErrorFunction::createFunction(scriptState, m_updater )); | 124 UpdatePaymentDetailsErrorFunction::createFunction(scriptState, m_updater )); |
125 } | 125 } |
126 | 126 |
127 void PaymentRequestUpdateEvent::onTimerFired(Timer<PaymentRequestUpdateEvent>*) | 127 void PaymentRequestUpdateEvent::onTimerFired(Timer<PaymentRequestUpdateEvent>*) |
128 { | 128 { |
129 if (!m_updater) | 129 if (!m_updater) |
130 return; | 130 return; |
131 | 131 |
132 m_updater->onUpdatePaymentDetailsFailure(ScriptValue()); | 132 m_updater->abortPaymentRequest("Timed out as the page didn't resolve the pro mise from change event"); |
please use gerrit instead
2016/07/29 15:40:50
Call onUpdatePaymentDetailsFailure("Timed out...")
pals
2016/08/01 11:18:23
Done.
| |
133 } | 133 } |
134 | 134 |
135 DEFINE_TRACE(PaymentRequestUpdateEvent) | 135 DEFINE_TRACE(PaymentRequestUpdateEvent) |
136 { | 136 { |
137 visitor->trace(m_updater); | 137 visitor->trace(m_updater); |
138 Event::trace(visitor); | 138 Event::trace(visitor); |
139 } | 139 } |
140 | 140 |
141 PaymentRequestUpdateEvent::PaymentRequestUpdateEvent() | 141 PaymentRequestUpdateEvent::PaymentRequestUpdateEvent() |
142 : m_waitForUpdate(false) | 142 : m_waitForUpdate(false) |
143 , m_abortTimer(this, &PaymentRequestUpdateEvent::onTimerFired) | 143 , m_abortTimer(this, &PaymentRequestUpdateEvent::onTimerFired) |
144 { | 144 { |
145 } | 145 } |
146 | 146 |
147 PaymentRequestUpdateEvent::PaymentRequestUpdateEvent(const AtomicString& type, c onst PaymentRequestUpdateEventInit& init) | 147 PaymentRequestUpdateEvent::PaymentRequestUpdateEvent(const AtomicString& type, c onst PaymentRequestUpdateEventInit& init) |
148 : Event(type, init) | 148 : Event(type, init) |
149 , m_waitForUpdate(false) | 149 , m_waitForUpdate(false) |
150 , m_abortTimer(this, &PaymentRequestUpdateEvent::onTimerFired) | 150 , m_abortTimer(this, &PaymentRequestUpdateEvent::onTimerFired) |
151 { | 151 { |
152 } | 152 } |
153 | 153 |
154 } // namespace blink | 154 } // namespace blink |
OLD | NEW |