5.9. Firing a success event
To fire a success event at a request, run these steps:
Let event be the result of creating an event using
[Event](https://dom.spec.whatwg.org/#event)
.Set event’s
[type](https://dom.spec.whatwg.org/#dom-event-type)
attribute to “success
“.Set event’s
[bubbles](https://dom.spec.whatwg.org/#dom-event-bubbles)
and[cancelable](https://dom.spec.whatwg.org/#dom-event-cancelable)
attributes to false.Let transaction be request’s transaction.
Let legacyOutputDidListenersThrowFlag be initially false.
If transaction’s state is inactive, then set transaction’s state to active.
Dispatch event at request with legacyOutputDidListenersThrowFlag.
If transaction’s state is active, then:
If legacyOutputDidListenersThrowFlag is true, then run abort a transaction with transaction and a newly created “
[AbortError](https://heycam.github.io/webidl/#aborterror)
“[DOMException](https://heycam.github.io/webidl/#idl-DOMException)
.If transaction’s request list is empty, then run commit a transaction with transaction.