blob: f3b1ca78f354240c3b4b7c7b4b954303c7a82096 [file] [log] [blame]
<!DOCTYPE html>
<html>
<title>Service Workers: ready</title>
<head>
<link rel="help" href="https://slightlyoff.github.io/ServiceWorker/spec/service_worker/#navigator-service-worker-ready">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<!--
`navigator.serviceWorker.ready` attribute must return the result of running
these steps:
1. Let `promise` be a newly-created [promise][1].
2. Return `promise`.
3. Run the following steps asynchronously:
1. Let `registration` be the result of running [_ScopeMatch
algorithm][2] with document's url as its argument.
2. If `registration` is null, then:
1. Wait for the document to have a matching [registration][3].
3. If the [registration][3], represented by `registration`, for the
document has an [active worker][4], then:
1. Resolve `promise` with the [ServiceWorker][5] object associated
with the [active worker][4].
2. Abort these steps.
4. If the [registration][3], represented by `registration`, for the
document has a [worker in waiting][6], then:
1. Resolve `promise` with the [ServiceWorker][5] object associated
with the [worker in waiting][6].
2. Abort these steps.
5. Wait until the [registration][3], represented by `registration`,
for the document acquires a [worker in waiting][6] through a new
[installation process][7].
6. Resolve `promise` with the [ServiceWorker][5] object associated
with the [worker in waiting][6].
Note that `ready` attribute is desinged in a way that the returned [promise][1]
will never reject. Instead, it waits until the [promise][1] resolves with a
newly installed [worker in waiting][6]. Hence, the `state` of the acquired
[`ServiceWorker`][8] object is either `installed`, `activating` or `activated`.
[1]: http://goo.gl/3TobQS
[2]: #scope-match-algorithm
[3]: #registration
[4]: #active-worker
[5]: #service-worker-interface
[6]: #worker-in-waiting
[7]: #installation-process
[8]: #service-worker
-->
<script>
test(function() {
// not_implemented();
}, "There are no tests for section ready so far.");
</script>
</body>
</html>