service worker: Clarify SetAllowAssociation().

This is one of the tricky parts of service worker code, and its role has
changed after various changes over the years.

There is no longer such thing as a "new registration" associating
with a provider host. Association happens only during:
1) main resource requests in ServiceWorkerControlleeRequestHandler
2) claim() in ServiceWorkerRegistration.

There is no need for ServiceWorkerControlleeRequestHandler to defend
against itself. So claim() is the only thing to defend against.

So the whole point of it is to stop claim() from claiming provider
hosts that are still undergoing their main resource request. This
should be the same thing as |is_execution_ready_|. But
unfortunately there is still edge cases/trickiness around
shared workers and about:blank iframes. Add some comments and
revisit after NetS13nServiceWorker.

Change-Id: I508f13c52fc30aa40776e17d4966ff05c0c57e14
Bug: 866353
Reviewed-on: https://chromium-review.googlesource.com/1146414
Commit-Queue: Matt Falkenhagen <falken@chromium.org>
Reviewed-by: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Makoto Shimazu <shimazu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577134}
3 files changed