Re: [whatwg/dom] Change add/remove event listener behavior for service workers (#653)

annevk commented on this pull request.

Thanks, mostly nits from me.

> @@ -1062,15 +1062,17 @@ and an <a>event listener</a> <var>listener</var>, run these steps:
 
 <ol>
  <li>
-  <p>If <var>eventTarget</var>'s <a>relevant global object</a> is a {{ServiceWorkerGlobalScope}}
-  object and its associated <a>service worker</a>'s <a for="service worker">script resource</a>'s
-  <a for="script resource">has ever been evaluated flag</a> is set, then <a>throw</a> a
-  <code>TypeError</code>.
-  [[!SERVICE-WORKERS]]
-
-  <p class="note no-backref">To optimize storing the event types allowed for the service worker and
-  to avoid non-deterministic changes to the event listeners, invocation of the method is allowed
-  only during the very first evaluation of the service worker script.
+  <p>If <var>eventTarget</var> is a {{ServiceWorkerGlobalScope}} object and its associated
+  <a>service worker</a>'s <a for="service worker">script resource</a>'s <a for="script resource">has
+  ever been evaluated flag</a> is set, then the user agent must <a>report a warning to the

`then <a>report ...` No need to say must here. (Also applies below.)

> @@ -1062,15 +1062,17 @@ and an <a>event listener</a> <var>listener</var>, run these steps:
 
 <ol>
  <li>
-  <p>If <var>eventTarget</var>'s <a>relevant global object</a> is a {{ServiceWorkerGlobalScope}}
-  object and its associated <a>service worker</a>'s <a for="service worker">script resource</a>'s
-  <a for="script resource">has ever been evaluated flag</a> is set, then <a>throw</a> a
-  <code>TypeError</code>.
-  [[!SERVICE-WORKERS]]
-
-  <p class="note no-backref">To optimize storing the event types allowed for the service worker and
-  to avoid non-deterministic changes to the event listeners, invocation of the method is allowed
-  only during the very first evaluation of the service worker script.
+  <p>If <var>eventTarget</var> is a {{ServiceWorkerGlobalScope}} object and its associated
+  <a>service worker</a>'s <a for="service worker">script resource</a>'s <a for="script resource">has
+  ever been evaluated flag</a> is set, then the user agent must <a>report a warning to the
+  console</a> with a description explaining that the <a>service worker event</a> should be added
+  synchronously, otherwise the user agent will not start</a> the <a>service worker</a> for the

This looks like a stray `</a>`. I'm surprised that builds.

> @@ -1062,15 +1062,17 @@ and an <a>event listener</a> <var>listener</var>, run these steps:
 
 <ol>
  <li>
-  <p>If <var>eventTarget</var>'s <a>relevant global object</a> is a {{ServiceWorkerGlobalScope}}
-  object and its associated <a>service worker</a>'s <a for="service worker">script resource</a>'s
-  <a for="script resource">has ever been evaluated flag</a> is set, then <a>throw</a> a
-  <code>TypeError</code>.
-  [[!SERVICE-WORKERS]]
-
-  <p class="note no-backref">To optimize storing the event types allowed for the service worker and
-  to avoid non-deterministic changes to the event listeners, invocation of the method is allowed
-  only during the very first evaluation of the service worker script.
+  <p>If <var>eventTarget</var> is a {{ServiceWorkerGlobalScope}} object and its associated
+  <a>service worker</a>'s <a for="service worker">script resource</a>'s <a for="script resource">has
+  ever been evaluated flag</a> is set, then the user agent must <a>report a warning to the
+  console</a> with a description explaining that the <a>service worker event</a> should be added

"is to be added" (let's not use "should" as it's meant to indicate requirements to the implementer within this document).

> -  <a for="script resource">has ever been evaluated flag</a> is set, then <a>throw</a> a
-  <code>TypeError</code>.
-  [[!SERVICE-WORKERS]]
-
-  <p class="note no-backref">To optimize storing the event types allowed for the service worker and
-  to avoid non-deterministic changes to the event listeners, invocation of the method is allowed
-  only during the very first evaluation of the service worker script.
+  <p>If <var>eventTarget</var> is a {{ServiceWorkerGlobalScope}} object and its associated
+  <a>service worker</a>'s <a for="service worker">script resource</a>'s <a for="script resource">has
+  ever been evaluated flag</a> is set, then the user agent must <a>report a warning to the
+  console</a> with a description explaining that the <a>service worker event</a> should be added
+  synchronously, otherwise the user agent will not start</a> the <a>service worker</a> for the
+  <a>event</a>. [[!SERVICE-WORKERS]]
+
+  <p class="note no-backref">To optimize with the set of <a>service worker events</a> to handle, the
+  Service Workers specification does not store the asynchronously added event. The <a>event

It might be better to say what object does not store the event.

> -  <a for="script resource">has ever been evaluated flag</a> is set, then <a>throw</a> a
-  <code>TypeError</code>.
-  [[!SERVICE-WORKERS]]
-
-  <p class="note no-backref">To optimize storing the event types allowed for the service worker and
-  to avoid non-deterministic changes to the event listeners, invocation of the method is allowed
-  only during the very first evaluation of the service worker script.
+  <p>If <var>eventTarget</var> is a {{ServiceWorkerGlobalScope}} object and its associated
+  <a>service worker</a>'s <a for="service worker">script resource</a>'s <a for="script resource">has
+  ever been evaluated flag</a> is set, then the user agent must <a>report a warning to the
+  console</a> with a description explaining that the <a>service worker event</a> should be added
+  synchronously, otherwise the user agent will not start</a> the <a>service worker</a> for the
+  <a>event</a>. [[!SERVICE-WORKERS]]
+
+  <p class="note no-backref">To optimize with the set of <a>service worker events</a> to handle, the
+  Service Workers specification does not store the asynchronously added event. The <a>event

No newlines inside `<a>`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/dom/pull/653#pullrequestreview-274144801

Received on Tuesday, 13 August 2019 08:59:25 UTC