Skip to content

Commit 669e786

Browse files
committed
Change behavior of skipWaiting()
Before this, skipWaiting() promises when called multiple times on a waiting worker had different behaviors among each other where the winner waits unitl the Activate is complete while others don't. This makes the behavior consistent by making the Activate be called only once. To achieve that, this removes the steps in skipWaiting() that call the Activate on a waiting worker (so promise resolves right away after setting the skip waiting flag) and simplifies the call sites of the Activate in the Install algorithm. Related issue: #1015.
1 parent ddf95c3 commit 669e786

File tree

4 files changed

+250
-292
lines changed

4 files changed

+250
-292
lines changed

docs/index.bs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,6 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
814814
1. Let |promise| be a new <a>promise</a>.
815815
1. Run the following substeps <a>in parallel</a>:
816816
1. Set [=/service worker=]'s <a>skip waiting flag</a>.
817-
1. If [=/service worker=]'s <a>state</a> is *installed*, then:
818-
1. Run <a>Activate</a> algorithm passing [=/service worker=]'s [=service worker/registration=] as the argument.
819817
1. Resolve |promise| with undefined.
820818
1. Return |promise|.
821819
</section>
@@ -2578,13 +2576,10 @@ spec: webappsec-referrer-policy; urlPrefix: https://w3c.github.io/webappsec-refe
25782576
1. Run the <a>Update Registration State</a> algorithm passing |registration|, "<code>installing</code>" and null as the arguments.
25792577
1. Run the <a>Update Worker State</a> algorithm passing |registration|'s <a>waiting worker</a> and *installed* as the arguments.
25802578
1. If |redundantWorker| is not null, run the <a>Update Worker State</a> algorithm passing |redundantWorker| and *redundant* as the arguments.
2581-
1. If |registration|'s <a>waiting worker</a>'s <a>skip waiting flag</a> is set, then:
2582-
1. Run <a>Activate</a> algorithm passing |registration| as the argument.
2583-
1. Invoke <a>Finish Job</a> with |job| and abort these steps.
25842579
1. Invoke <a>Finish Job</a> with |job|.
25852580
1. Wait for all the <a>tasks</a> <a lt="queue a task">queued</a> by <a>Update Worker State</a> invoked in this algorithm have executed.
25862581
1. Wait until no [=/service worker client=] is <a>using</a> |registration| or |registration|'s <a>waiting worker</a>'s <a>skip waiting flag</a> is set.
2587-
1. If |registration|'s <a>waiting worker</a> |waitingWorker| is not null and |waitingWorker|'s <a>skip waiting flag</a> is not set, invoke <a>Activate</a> algorithm with |registration| as its argument.
2582+
1. If |registration|'s <a>waiting worker</a> is not null, invoke <a>Activate</a> algorithm with |registration| as its argument.
25882583
</section>
25892584

25902585
<section algorithm>

0 commit comments

Comments
 (0)