service worker: Improve async waitUntil/respondWith().

This CL:
* Stops a crash that occurred when respondWith() was called in
  a microtask during event dispatch. The crash occurred because
  RespondWithObserver is expected to determine the response before
  WaitUntilObserver decides the event is finished. RespondWithObserver
  was relying on WaitUntilObserver to respect the respondWith()
  promise, but in some cases WaitUntilObserver would drop the promise
  silently.
* Improves determination of when an extendable event is active.
  We had tricky logic to consider an event inactive during the
  microtask checkpoint at the end of event dispatch, but according to
  the spec that's still part of event dispatch and the event is still
  active.
* Removes some early returns when the execution context is null, which
  made it more unclear when the promises would be observed. It should
  only be necessary to check the execution context when the context is
  about to be accessed.
* Removes clearing of |observer_|. This was already unnecessary due to
  Oilpan gc, and RespondWithObserver now needs |observer_| in some cases
  after reaching state_ kDone, to check observer_->IsDispatchingEvent().

Bug: 941875, 942414
Change-Id: I14f008f7e76ec76d90fe25104cc6f3849808fb2f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1523207
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#641520}
8 files changed