Re: [w3c/ServiceWorker] Define Purge Service Worker Registrations (#1506)

jungkees commented on this pull request.



> +    <h3 id="purge-service-worker-registration-algorithm"><dfn export>Purge Service Worker Registrations</dfn></h3>
+
+      : Input
+      :: |origin|, an [=/origin=]
+      :: |unclaim|, an optional boolean, false by default
+      : Output
+      :: None
+
+      1. [=map/For each=] <var ignore=''>scope</var> → |registration| of [=scope to registration map=]:
+          1. Let |scopeURL| be |registration|'s [=service worker registration/scope url=].
+          1. If |scopeURL|'s [=/origin=] is |origin|, then:
+              1. Let |job| be the result of running [=Create Job=] with *unregister*, |scopeURL|, null, null, and null.
+              1. Set |job|'s [=immediate unregister flag=].
+              1. Let |jobQueue| be [=scope to job queue map=][|job|'s [=job/scope url=], [=URL serializer|serialized=]].
+              1. Assert: |jobQueue| is not null.
+              1. [=While=] |jobQueue| is not empty:

I made the caller (Clear-Site-Data) purge the registrations with [the _unclaim_ enabled]((https://github.com/w3c/webappsec-clear-site-data/pull/63/files#diff-117d6498d2aa8019cc0abf5eeb87a9faR631)). I wanted to consider the possibility of any future change where a caller may want to purge the storage without unclaiming.

However, if our decision is making Clear-Site-Data: "strorage" unclaim by default, I can move the unclaiming steps into Unregister algorithm so it runs when job's _immediate unregister flag_ is set.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1506#discussion_r385324155

Received on Thursday, 27 February 2020 19:29:23 UTC