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

annevk commented on this pull request.

Via some indirection user agents must implement the algorithm as written. Any must statement in the algorithm is redundant with that. A "should" statement or some such would work however, although that's not applicable here.

> @@ -1118,11 +1120,12 @@ and an <a>event listener</a> <var>listener</var>, set <var>listener</var>'s
 method, when invoked, must run these steps:
 
 <ol>
- <li><p>If the <a>context object</a>'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]]
+ <li><p>If the <a>context 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>report a warning to the console</a> with a description explaining that the user agent will still
+ start the <a>service worker</a> for the <a>service worker event</a> that was synchronously added.

We don't really know whether it was added at the correct time, right?

> -  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
+  <a>report a warning to the console</a> with a description explaining that the
+  <a>service worker event</a> is to be added synchronously, otherwise the user agent will not start
+  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,

This doesn't read well. I also don't think we should use "synchronous" and "asynchronous" as it's not really clear relative to what they're being used. I'm not really sure what to suggest that doesn't get very wordy though.

-- 
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-275436521

Received on Thursday, 15 August 2019 13:53:29 UTC