Skip to content

Commit

Permalink
Unregister SW on 4xx #204
Browse files Browse the repository at this point in the history
  • Loading branch information
jungkees committed Mar 31, 2014
1 parent 1a6e6e8 commit 846d408
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions spec/service_worker/algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,25 @@ Service Workers Algorithms
2. If _promise_ has been rejected (eg, another registration has aborted it), then
1. Set _serviceWorkerRegistration_.*updatePromise* to null.
2. Abort these steps.
3. If fetching the script fails due to the server returning a 4xx or 5xx response or equivalent, or there is a DNS error, or the connection times out, then
3. If fetching the script fails due to the server returning a 4xx response, then
1. Reject _promise_ with **_Unregister**(_serviceWorkerRegistration_.*scope*).
2. Set _serviceWorkerRegistration_.*updatePromise* to null.
3. Abort these steps.
4. Else if fetching the script fails due to the server returning 5xx response, or there is a DNS error, or the connection times out, then
1. Reject _promise_ with a new NetworkError.
2. Set _serviceWorkerRegistration_.*updatePromise* to null.
3. Abort these steps.
4. If the server returned a redirect, then
5. Else if the server returned a redirect, then
1. Reject _promise_ with a new SecurityError.
2. Set _serviceWorkerRegistration_.*updatePromise* to null.
3. Abort these steps.
5. Let _fetchedScript_ be the fetched script.
6. Let _activeWorker_ be _serviceWorkerRegistration_.*activeWorker*.
7. If _activeWorker_ is not null, and _activeWorker_.*url* is equal to _serviceWorkerRegistration_.*scriptUrl* and _fetchedScript_ is a byte-for-byte match with the script of _activeWorker_, then
6. Let _fetchedScript_ be the fetched script.

This comment has been minimized.

Copy link
@jyasskin

jyasskin Apr 1, 2014

Member

FYI, you don't have to renumber the source in order for the rendered Markdown to include accurate numbers. To make it clearer what's changed in each revision, it can be better to use "1." for every numbered bullet.

This comment has been minimized.

Copy link
@jungkees

jungkees Apr 2, 2014

Author Collaborator

Got it! Thanks.

7. Let _activeWorker_ be _serviceWorkerRegistration_.*activeWorker*.
8. If _activeWorker_ is not null, and _activeWorker_.*url* is equal to _serviceWorkerRegistration_.*scriptUrl* and _fetchedScript_ is a byte-for-byte match with the script of _activeWorker_, then
1. Resolve _promise_ with _activeWorker_.
2. Set _serviceWorkerRegistration_.*updatePromise* to null.
3. Abort these steps.
8. Else,
9. Else,
1. Let _serviceWorker_ be a newly-created ServiceWorker object, using _fetchedScript_.
2. If _promise_ has been rejected (e.g, another registration has aborted it), then
1. Set _serviceWorkerRegistration_.*updatePromise* to null.
Expand Down Expand Up @@ -203,6 +207,11 @@ Service Workers Algorithms
--
**Unregister**(_scope_)

1. Return **_Unregister**(_scope_).

--
**_Unregister**(_scope_)

1. Let _promise_ be a newly-created _Promise_.
2. Return _promise_.
3. Run the following steps asynchronously.
Expand Down

0 comments on commit 846d408

Please sign in to comment.