Minor improvements around importScripts. (#1380)
* Minor improvements around importScripts.
- In the "perform the fetch" steps for importScripts(), return the
response, not its unsafe response. These steps run inside "fetch a
classic worker-imported script"[1], which extract the unsafe response,
so getting the unsafe response twice is redundant or wrong.
- Extract a "bad import script response" definition for resuability.
- Rename variables to avoid shadowing.
- Skip fetching the main resource again, when doing the import scripts
update check.
- Make the "perform the fetch" steps in Update asynchronously
complete with a response rather than returning true, as is expected
of these steps.[2]
[1] https://html.spec.whatwg.org/multipage/webappapis.html#fetch-a-classic-worker-imported-script
[2] https://html.spec.whatwg.org/multipage/webappapis.html#fetching-scripts-perform-fetch