void PaymentRequestUpdateEvent::updateWith(ScriptState* scriptState,
                                           ScriptPromise promise,
                                           ExceptionState& exceptionState) {
  if (!m_updater)
    return;

  if (!isBeingDispatched()) {
    exceptionState.throwDOMException(
        InvalidStateError,
        "Cannot update details when the event is not being dispatched");
    return;
  }

  if (m_waitForUpdate) {
    exceptionState.throwDOMException(InvalidStateError,
                                     "Cannot update details twice");
    return;
  }

  stopImmediatePropagation();
  m_waitForUpdate = true;
  m_abortTimer.stop();

  promise.then(
      UpdatePaymentDetailsFunction::createFunction(scriptState, m_updater),
      UpdatePaymentDetailsErrorFunction::createFunction(scriptState,
                                                        m_updater));
}
ScriptPromise ServicePortConnectEvent::respondWith(ScriptState* scriptState, const ScriptPromise& response, ExceptionState& exceptionState)
{
    stopImmediatePropagation();
    if (m_observer)
        return m_observer->respondWith(scriptState, response, exceptionState);
    return ScriptPromise::rejectWithDOMException(scriptState, DOMException::create(NotSupportedError));
}
void FetchEvent::respondWith(ScriptState* scriptState, const ScriptValue& value, ExceptionState& exceptionState)
{
    stopImmediatePropagation();
    m_observer->respondWith(scriptState, value, exceptionState);
}
void CrossOriginConnectEvent::acceptConnection(ScriptState* scriptState, const ScriptPromise& value , ExceptionState& exceptionState)
{
    stopImmediatePropagation();
    if (m_observer)
        m_observer->acceptConnection(scriptState, value, exceptionState);
}
Esempio n. 5
0
void FetchEvent::respondWith(ScriptState* scriptState, ScriptPromise scriptPromise, ExceptionState& exceptionState)
{
    stopImmediatePropagation();
    m_observer->respondWith(scriptState, scriptPromise, exceptionState);
}