Skip to content

Commit

Permalink
Define the time origin for service workers (#1621)
Browse files Browse the repository at this point in the history
In [this HTML PR](whatwg/html#7339) we add
a `time origin` getter to the `environment settings object`.
We need to account for that value in service workers, which would be the
time the worker environment is created.
  • Loading branch information
noamr committed Jan 25, 2022
1 parent 9c7a50f commit d64ffd5
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions docs/index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2895,6 +2895,7 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231

Note: This algorithm blocks until the service worker is [=running=] or fails to start.

1. Let |unsafeCreationTime| be the [=unsafe shared current time=].
1. If |serviceWorker| is [=running=], then return |serviceWorker|'s [=start status=].
1. If |serviceWorker|'s [=state=] is "`redundant`", then return *failure*.
1. Assert: |serviceWorker|'s [=start status=] is null.
Expand All @@ -2919,6 +2920,8 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
:: Return its registering [=/service worker client=]'s [=environment settings object/origin=].
: The [=environment settings object/policy container=]
:: Return |workerGlobalScope|'s [=WorkerGlobalScope/policy container=].
: The [=environment settings object/time origin=]
:: Return the result of [=coarsen time|coarsening=] |unsafeCreationTime| given |workerGlobalScope|'s [=WorkerGlobalScope/cross-origin isolated capability=].

1. Set |settingsObject|'s [=environment/id=] to a new unique opaque string, [=creation URL=] to |serviceWorker|'s [=service worker/script url=], [=environment/top-level creation URL=] to null, [=environment/top-level origin=] to an [=implementation-defined=] value, [=environment/target browsing context=] to null, and [=active service worker=] to null.
1. Set |workerGlobalScope|'s [=WorkerGlobalScope/url=] to |serviceWorker|'s [=service worker/script url=].
Expand Down

0 comments on commit d64ffd5

Please sign in to comment.