OMT script fetch: Set ID of AppCache after main script load

Before this CL, WebSharedWorkerImpl didn't call SelectAppCacheID()
after the main script fetch when off-the-main-thread script fetch
is enabled. This CL moves the callsite of SelectAppCacheID()
to DidFetchScript(). DidFetchScript() is called in both "on" and
"off" the main thread script fetch so it will get called in both
code paths.

For off-the-main-thread script fetch, the appcache ID is plumbed
from WorkerClassicScriptLoader in SharedWorkerGlobalScope.

Also there could be a potential race between IPC messages for
appcache selection and subresource requests if we evaluate the
top-level script immediately after script fetch. To avoid the race
this CL introduces a callback to SelectAppCacheID(). The callback
is invoked when the browser process sends
AppCacheFrontend::CacheSelected mojo IPC. SharedWorkerGlobalScope
evaluates the top-level script after the callback is invoked.

This fixes shared worker related tests in
wpt/html/browsers/offline/appcache/workers/appcache-worker.https.html

Bug: 945673
Change-Id: I03c965bff166d6265e9a8479745fa7c1ae1a976c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1614656
Commit-Queue: Kenichi Ishibashi <bashi@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Hiroki Nakagawa <nhiroki@chromium.org>
Reviewed-by: Marijn Kruisselbrink <mek@chromium.org>
Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org>
Cr-Commit-Position: refs/heads/master@{#662894}
21 files changed