service worker: When installed script data can't be read, tell the worker.

Before this CL, when ServiceWorkerInstalledScriptsSender failed to
read the script data from disk, it would call DeleteVersion() which
calls Doom() on the worker, which sends the Stop IPC. However, the
service worker thread would still be blocked waiting for the script data
so it wouldn't respond to the Stop IPC. Eventually start worker is
aborted because of the 5 second stop worker timeout on the browser
process, but this is slow and roundabout. It causes
ServiceWorkerVersionBrowserTest.ReadResourceFailure* to take over
5 seconds to run.

To fix this, break the Mojo connection with the service worker like
the other failure cases. This causes the service worker to quickly
terminate via:
1. The Internal instance in
   destructs due to Mojo strong binding and sets |are_all_data_added_|.
2. ThreadSafeScriptContainer::WaitOnWorkerThread() detects that
   the browser failed to send the script.
3. ServiceWorkerInstalledScriptsManager::GetScriptData() returns nullptr.
4. ServiceWorkerGlobalScope::RunInstalledClassicScript() reports
   failure to load the script and self-terminates with close().

Bug: 964201
Change-Id: I6f2ee8ef0864ba64b0a13827640d6bf2d44cbade
Reviewed-by: Makoto Shimazu <>
Commit-Queue: Matt Falkenhagen <>
Cr-Commit-Position: refs/heads/master@{#661600}
1 file changed