service worker: Wait for inflight requests before activating

This patch makes changes as per discussion at
https://github.com/slightlyoff/ServiceWorker/issues/916

Namely,
* The waiting worker gets promoted to active once there are no
controllees and the incumbent worker has no in-flight events
(fetch/sync/push/message etc).
* skipWaiting bypasses the no controllees requirement, but we
still wait until there are no in-flight events.
* As usual, incoming fetch/sync/push events always go to the
active worker.

BUG=616331

Review-Url: https://codereview.chromium.org/2119143002
Cr-Commit-Position: refs/heads/master@{#405628}
9 files changed