fetch
FetchEvent
@@ -4394,16 +4404,16 @@ Acti
If registration ’s waiting worker is null, abort these steps.
Let redundantWorker be null.
- If registration ’s active worker is not null, then:
+ If registration ’s active worker is not null, then:
- Set redundantWorker to registration ’s active worker .
+ Set redundantWorker to registration ’s active worker .
Wait for redundantWorker to finish handling any in-progress requests.
Terminate redundantWorker .
Run the Update Registration State algorithm passing registration , "active
" and registration ’s waiting worker as the arguments.
Run the Update Registration State algorithm passing registration , "waiting
" and null as the arguments.
- Run the Update Worker State algorithm passing registration ’s active worker and activating as the arguments.
+ Run the Update Worker State algorithm passing registration ’s active worker and activating as the arguments.
Once an active worker is activating, neither a runtime script error nor a force termination of the active worker prevents the active worker from getting activated.
If redundantWorker is not null, run the Update Worker State algorithm passing redundantWorker and redundant as the arguments.
@@ -4416,10 +4426,10 @@ Acti
For each service worker client client who is using registration :
- Set client ’s active worker to registration ’s active worker .
+ Set client ’s active worker to registration ’s active worker .
Invoke Notify Controller Change algorithm with client as the argument.
- Let activeWorker be registration ’s active worker .
+ Let activeWorker be registration ’s active worker .
Invoke Run Service Worker algorithm with activeWorker as the argument.
Queue a task task to run the following substeps:
@@ -4430,7 +4440,7 @@ Acti
Wait for task to have executed or been discarded, or the script to have been aborted by the termination of activeWorker .
Wait for the step labeled WaitForAsynchronousExtensions to complete.
- Run the Update Worker State algorithm passing registration ’s active worker and activated as the arguments.
+ Run the Update Worker State algorithm passing registration ’s active worker and activated as the arguments.
@@ -4480,7 +4490,7 @@ referrer policy to serviceWorker ’s script resource ’s referrer policy .
Set workerGlobalScope ’s type to serviceWorker ’s type .
Create a new WorkerLocation
object and associate it with workerGlobalScope .
- If serviceWorker is an active worker , and there are any tasks queued in serviceWorker ’s containing service worker registration ’s task queues , queue them to serviceWorker ’s event loop ’s task queues in the same order using their original task sources .
+ If serviceWorker is an active worker , and there are any tasks queued in serviceWorker ’s containing service worker registration ’s task queues , queue them to serviceWorker ’s event loop ’s task queues in the same order using their original task sources .
If script is a classic script , then run the classic script script . Otherwise, it is a module script ; run the module script script .
In addition to the usual possibilities of returning a value or failing due to an exception, this could be prematurely aborted by the kill a worker or terminate a worker algorithms.
@@ -4556,8 +4566,8 @@ navigation request and the navigation triggering it was initiated with a shift+reload or equivalent, return null.
Set registration to the result of running Match Service Worker Registration algorithm passing request ’s url as the argument.
- If registration is null or registration ’s active worker is null, return null.
- If request ’s destination is not "report
", set reservedClient ’s active service worker to registration ’s active worker .
+ If registration is null or registration ’s active worker is null, return null.
+ If request ’s destination is not "report
", set reservedClient ’s active service worker to registration ’s active worker .
From this point, the service worker client starts to use its active service worker ’s containing service worker registration .
@@ -4566,7 +4576,7 @@ Else, return null.
- Let activeWorker be registration ’s active worker .
+ Let activeWorker be registration ’s active worker .
If activeWorker ’s set of event types to handle does not contain fetch
, return null.
To avoid unnecessary delays, the Handle Fetch enforces early return when no event listeners have been deterministically added in the service worker’s global during the very first script execution.
@@ -4724,8 +4734,8 @@ Assert: a Record with the [[value]] equals to registration is contained in scope to registration map .
- Assert : registration ’s active worker is not null.
- Let activeWorker be registration ’s active worker .
+ Assert : registration ’s active worker is not null.
+ Let activeWorker be registration ’s active worker .
If activeWorker ’s set of event types to handle does not contain the event type for this functional event, return.
To avoid unnecessary delays, the Handle Functional Event enforces early return when no event listeners have been deterministically added in the service worker’s global during the very first script execution.
@@ -4859,9 +4869,9 @@ Update Worker State algorithm passing redundantWorker and redundant as the arguments.
- If registration ’s active worker is not null, then:
+ If registration ’s active worker is not null, then:
- Set redundantWorker to registration ’s active worker .
+ Set redundantWorker to registration ’s active worker .
Terminate redundantWorker .
The user agent may abort in-flight requests triggered by redundantWorker .
Run the Update Registration State algorithm passing registration , "active
" and null as the arguments.
@@ -4905,11 +4915,11 @@
Else if target is "active
", then:
- Set registration ’s active worker to source .
+ Set registration ’s active worker to source .
For each registrationObject in registrationObjects :
- Queue a task to set the active attribute of registrationObject to the ServiceWorker
object that represents registration ’s active worker , or null if registration ’s active worker is null.
+ Queue a task to set the active attribute of registrationObject to the ServiceWorker
object that represents registration ’s active worker , or null if registration ’s active worker is null.
The task must use registrationObject ’s relevant settings object ’s responsible event loop and the DOM manipulation task source .
@@ -4947,11 +4957,11 @@ Up
activating
"activating
"
- The service worker in this state is considered an active worker . During this state, event.waitUntil(f )
can be called inside the onactivate
event handler to extend the life of the active worker until the passed promise resolves successfully. No functional events are dispatched until the state becomes activated .
+ The service worker in this state is considered an active worker . During this state, event.waitUntil(f )
can be called inside the onactivate
event handler to extend the life of the active worker until the passed promise resolves successfully. No functional events are dispatched until the state becomes activated .
activated
"activated
"
- The service worker in this state is considered an active worker ready to handle functional events .
+ The service worker in this state is considered an active worker ready to handle functional events .
redundant
"redundant
"
@@ -5011,7 +5021,7 @@ Run the following steps atomically.
Let registration be the result of running the Match Service Worker Registration algorithm passing requestURL as the argument.
If registration is null, return null.
- Let worker be registration ’s active worker .
+ Let worker be registration ’s active worker .
If worker is null, return null.
Let requestURLString be the serialized requestURL .
@@ -5057,7 +5067,7 @@ installing worker is not null, set newestWorker to registration ’s installing worker .
Else if registration ’s waiting worker is not null, set newestWorker to registration ’s waiting worker .
- Else if registration ’s active worker is not null, set newestWorker to registration ’s active worker .
+ Else if registration ’s active worker is not null, set newestWorker to registration ’s active worker .
Return newestWorker .
@@ -6384,6 +6394,7 @@
For environment type clients, the environment’s creation URL’s origin should be used for the origin check instead of the client’s origin. See
the issue to define the environment’s origin algorithm.
↵
For environment type clients, the environment’s creation URL’s origin should be used for the origin check instead of the client’s origin. See
the issue to define the environment’s origin algorithm.
↵
+ For environment type clients, the environment’s creation URL’s origin should be used for the origin check instead of the client’s origin. See
the issue to define the environment’s origin algorithm.
↵
The response’s cache state concept had been removed from fetch. The fetch issue
#376 tracks the request to restore the concept or add some similar way to check this state.
↵
diff --git a/docs/v1/index.bs b/docs/v1/index.bs
index d1a3707a..4a61bce7 100644
--- a/docs/v1/index.bs
+++ b/docs/v1/index.bs
@@ -1435,14 +1435,24 @@ spec: rfc7231; urlPrefix: https://tools.ietf.org/html/rfc7231
Run the following substeps in parallel :
For each service worker client client whose origin is the same as the service worker 's origin :
+ For environment type clients, the environment's creation URL's origin should be used for the origin check instead of the client's origin. See the issue to define the environment's origin algorithm.
- If client is not a secure context , continue to the next iteration of the loop.
+ If client is a type of environment , then:
+
+ If client ’s creation URL is not a potentially trustworthy URL , continue to the next iteration of the loop.
+
+
+ Else:
+
+ If client is not a secure context , continue to the next iteration of the loop.
+
+
Let registration be the result of running Match Service Worker Registration algorithm passing client 's creation URL as the argument.
If registration is not the service worker 's containing service worker registration , continue to the next iteration of the loop.
- If client 's active worker is not the service worker , then:
+ If client 's active service worker is not the service worker , then:
Invoke Handle Service Worker Client Unload with client as the argument.
- Set client 's active worker to service worker .
+ Set client 's active service worker to service worker .
Invoke Notify Controller Change algorithm with client as the argument.
diff --git a/docs/v1/index.html b/docs/v1/index.html
index e0218fff..c159260e 100644
--- a/docs/v1/index.html
+++ b/docs/v1/index.html
@@ -2717,15 +2717,25 @@ service worker client client whose origin is the same as the service worker ’s origin :
+ For environment type clients, the environment’s creation URL’s origin should be used for the origin check instead of the client’s origin. See the issue to define the environment’s origin algorithm.
- If client is not a secure context , continue to the next iteration of the loop.
+
+ If client is a type of environment , then:
+
+ If client ’s creation URL is not a potentially trustworthy URL , continue to the next iteration of the loop.
+
+
+ Else:
+
+ If client is not a secure context , continue to the next iteration of the loop.
+
Let registration be the result of running Match Service Worker Registration algorithm passing client ’s creation URL as the argument.
If registration is not the service worker ’s containing service worker registration , continue to the next iteration of the loop.
- If client ’s active worker is not the service worker , then:
+ If client ’s active service worker is not the service worker , then:
Invoke Handle Service Worker Client Unload with client as the argument.
- Set client ’s active worker to service worker .
+ Set client ’s active service worker to service worker .
Invoke Notify Controller Change algorithm with client as the argument.
@@ -2782,7 +2792,7 @@ Service workers define the following behaviors for install
event and activate
event, respectively:
@@ -2990,7 +3000,7 @@
activate
ExtendableEvent
- [Lifecycle event ] The service worker ’s containing service worker registration ’s active worker changes. (See step 12.2 of the Activate algorithm.)
+ [Lifecycle event ] The service worker ’s containing service worker registration ’s active worker changes. (See step 12.2 of the Activate algorithm.)
fetch
FetchEvent
@@ -4093,16 +4103,16 @@ Acti
If registration ’s waiting worker is null, abort these steps.
Let redundantWorker be null.
- If registration ’s active worker is not null, then:
+ If registration ’s active worker is not null, then:
- Set redundantWorker to registration ’s active worker .
+ Set redundantWorker to registration ’s active worker .
Wait for redundantWorker to finish handling any in-progress requests.
Terminate redundantWorker .
Run the Update Registration State algorithm passing registration , "active
" and registration ’s waiting worker as the arguments.
Run the Update Registration State algorithm passing registration , "waiting
" and null as the arguments.
- Run the Update Worker State algorithm passing registration ’s active worker and activating as the arguments.
+ Run the Update Worker State algorithm passing registration ’s active worker and activating as the arguments.
Once an active worker is activating, neither a runtime script error nor a force termination of the active worker prevents the active worker from getting activated.
If redundantWorker is not null, run the Update Worker State algorithm passing redundantWorker and redundant as the arguments.
@@ -4115,10 +4125,10 @@ Acti
For each service worker client client who is using registration :
- Set client ’s active worker to registration ’s active worker .
+ Set client ’s active worker to registration ’s active worker .
Invoke Notify Controller Change algorithm with client as the argument.
- Let activeWorker be registration ’s active worker .
+ Let activeWorker be registration ’s active worker .
Invoke Run Service Worker algorithm with activeWorker as the argument.
Queue a task task to run the following substeps:
@@ -4129,7 +4139,7 @@ Acti
Wait for task to have executed or been discarded, or the script to have been aborted by the termination of activeWorker .
Wait for the step labeled WaitForAsynchronousExtensions to complete.
- Run the Update Worker State algorithm passing registration ’s active worker and activated as the arguments.
+ Run the Update Worker State algorithm passing registration ’s active worker and activated as the arguments.
@@ -4179,7 +4189,7 @@ referrer policy to serviceWorker ’s script resource ’s referrer policy .
Set workerGlobalScope ’s type to serviceWorker ’s type .
Create a new WorkerLocation
object and associate it with workerGlobalScope .
- If serviceWorker is an active worker , and there are any tasks queued in serviceWorker ’s containing service worker registration ’s task queues , queue them to serviceWorker ’s event loop ’s task queues in the same order using their original task sources .
+ If serviceWorker is an active worker , and there are any tasks queued in serviceWorker ’s containing service worker registration ’s task queues , queue them to serviceWorker ’s event loop ’s task queues in the same order using their original task sources .
If script is a classic script , then run the classic script script . Otherwise, it is a module script ; run the module script script .
In addition to the usual possibilities of returning a value or failing due to an exception, this could be prematurely aborted by the kill a worker or terminate a worker algorithms.
@@ -4255,8 +4265,8 @@ navigation request and the navigation triggering it was initiated with a shift+reload or equivalent, return null.
Set registration to the result of running Match Service Worker Registration algorithm passing request ’s url as the argument.
- If registration is null or registration ’s active worker is null, return null.
- If request ’s destination is not "report
", set reservedClient ’s active service worker to registration ’s active worker .
+ If registration is null or registration ’s active worker is null, return null.
+ If request ’s destination is not "report
", set reservedClient ’s active service worker to registration ’s active worker .
From this point, the service worker client starts to use its active service worker ’s containing service worker registration .
@@ -4265,7 +4275,7 @@ Else, return null.
- Let activeWorker be registration ’s active worker .
+ Let activeWorker be registration ’s active worker .
If activeWorker ’s set of event types to handle does not contain fetch
, return null.
To avoid unnecessary delays, the Handle Fetch enforces early return when no event listeners have been deterministically added in the service worker’s global during the very first script execution.
@@ -4327,8 +4337,8 @@ Assert: a Record with the [[value]] equals to registration is contained in scope to registration map .
- Assert : registration ’s active worker is not null.
- Let activeWorker be registration ’s active worker .
+ Assert : registration ’s active worker is not null.
+ Let activeWorker be registration ’s active worker .
If activeWorker ’s set of event types to handle does not contain the event type for this functional event, return.
To avoid unnecessary delays, the Handle Functional Event enforces early return when no event listeners have been deterministically added in the service worker’s global during the very first script execution.
@@ -4462,9 +4472,9 @@ Update Worker State algorithm passing redundantWorker and redundant as the arguments.
- If registration ’s active worker is not null, then:
+ If registration ’s active worker is not null, then:
- Set redundantWorker to registration ’s active worker .
+ Set redundantWorker to registration ’s active worker .
Terminate redundantWorker .
The user agent may abort in-flight requests triggered by redundantWorker .
Run the Update Registration State algorithm passing registration , "active
" and null as the arguments.
@@ -4508,11 +4518,11 @@
Else if target is "active
", then:
- Set registration ’s active worker to source .
+ Set registration ’s active worker to source .
For each registrationObject in registrationObjects :
- Queue a task to set the active attribute of registrationObject to the ServiceWorker
object that represents registration ’s active worker , or null if registration ’s active worker is null.
+ Queue a task to set the active attribute of registrationObject to the ServiceWorker
object that represents registration ’s active worker , or null if registration ’s active worker is null.
The task must use registrationObject ’s relevant settings object ’s responsible event loop and the DOM manipulation task source .
@@ -4550,11 +4560,11 @@ Up
activating
"activating
"
- The service worker in this state is considered an active worker . During this state, event.waitUntil(f )
can be called inside the onactivate
event handler to extend the life of the active worker until the passed promise resolves successfully. No functional events are dispatched until the state becomes activated .
+ The service worker in this state is considered an active worker . During this state, event.waitUntil(f )
can be called inside the onactivate
event handler to extend the life of the active worker until the passed promise resolves successfully. No functional events are dispatched until the state becomes activated .
activated
"activated
"
- The service worker in this state is considered an active worker ready to handle functional events .
+ The service worker in this state is considered an active worker ready to handle functional events .
redundant
"redundant
"
@@ -4636,7 +4646,7 @@ installing worker is not null, set newestWorker to registration ’s installing worker .
Else if registration ’s waiting worker is not null, set newestWorker to registration ’s waiting worker .
- Else if registration ’s active worker is not null, set newestWorker to registration ’s active worker .
+ Else if registration ’s active worker is not null, set newestWorker to registration ’s active worker .
Return newestWorker .
@@ -5845,6 +5855,7 @@