[w3c/ServiceWorker] Minor improvements around importScripts. (#1380)

- 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 "network error import scripts" 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
You can view, comment on, or merge this pull request online at:

  https://github.com/w3c/ServiceWorker/pull/1380

-- Commit Summary --

  * Minor improvements around importScripts.

-- File Changes --

    M docs/index.bs (34)

-- Patch Links --

https://github.com/w3c/ServiceWorker/pull/1380.patch
https://github.com/w3c/ServiceWorker/pull/1380.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1380

Received on Thursday, 17 January 2019 07:40:43 UTC