OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <title>Service Workers: ready</title> |
| 4 <head> |
| 5 <link rel="help" href="https://w3c.github.io/ServiceWorker/#navigator-se
rvice-worker-ready"> |
| 6 <script src="/resources/testharness.js"></script> |
| 7 <script src="/resources/testharnessreport.js"></script> |
| 8 |
| 9 </head> |
| 10 <body> |
| 11 |
| 12 <!-- |
| 13 |
| 14 `navigator.serviceWorker.ready` attribute must return the result of running |
| 15 these steps: |
| 16 |
| 17 1. Let `promise` be a newly-created [promise][1]. |
| 18 2. Return `promise`. |
| 19 3. Run the following steps asynchronously: |
| 20 1. Let `registration` be the result of running [_ScopeMatch |
| 21 algorithm][2] with document's url as its argument. |
| 22 2. If `registration` is null, then: |
| 23 1. Wait for the document to have a matching [registration][3]. |
| 24 3. If the [registration][3], represented by `registration`, for the |
| 25 document has an [active worker][4], then: |
| 26 1. Resolve `promise` with the [ServiceWorker][5] object associated |
| 27 with the [active worker][4]. |
| 28 2. Abort these steps. |
| 29 4. If the [registration][3], represented by `registration`, for the |
| 30 document has a [worker in waiting][6], then: |
| 31 1. Resolve `promise` with the [ServiceWorker][5] object associated |
| 32 with the [worker in waiting][6]. |
| 33 2. Abort these steps. |
| 34 5. Wait until the [registration][3], represented by `registration`, |
| 35 for the document acquires a [worker in waiting][6] through a new |
| 36 [installation process][7]. |
| 37 6. Resolve `promise` with the [ServiceWorker][5] object associated |
| 38 with the [worker in waiting][6]. |
| 39 Note that `ready` attribute is desinged in a way that the returned [promise][1] |
| 40 will never reject. Instead, it waits until the [promise][1] resolves with a |
| 41 newly installed [worker in waiting][6]. Hence, the `state` of the acquired |
| 42 [`ServiceWorker`][8] object is either `installed`, `activating` or `activated`. |
| 43 |
| 44 |
| 45 |
| 46 [1]: http://goo.gl/3TobQS |
| 47 [2]: #scope-match-algorithm |
| 48 [3]: #registration |
| 49 [4]: #active-worker |
| 50 [5]: #service-worker-interface |
| 51 [6]: #worker-in-waiting |
| 52 [7]: #installation-process |
| 53 [8]: #service-worker |
| 54 |
| 55 --> |
| 56 |
| 57 |
| 58 |
| 59 <script> |
| 60 test(function() { |
| 61 // not_implemented(); |
| 62 }, "There are no tests for section ready so far."); |
| 63 </script> |
| 64 |
| 65 </body> |
| 66 </html> |
| 67 |
OLD | NEW |