Re: [w3c/ServiceWorker] Avoid executing the code in the All Fetch Listeners Are Empty algorithm. (PR #1676)

@jakearchibald commented on this pull request.



> @@ -3009,7 +3009,11 @@ spec: storage; urlPrefix: https://storage.spec.whatwg.org/
           1. Let |callback| be null.
           1. If |eventHandler| is not null and |eventListenerCallback| equals |eventHandler|'s [=event handler/listener=]'s [=event listener/callback=], then set |callback| to the result of [=convert to an ECMAScript value|converting to an ECMAScript value=] |eventHandler|'s [=event handler/value=].
           1. Otherwise, set |callback| to the result of [=convert to an ECMAScript value|converting to an ECMAScript value=] |eventListenerCallback|.
-          1. If [$IsCallable$](|callback|) is false, or |callback|'s [=function body=] is not empty (i.e. either a [=statement=] or [=declaration=] exist), then return false.
+          1. If [$IsCallable$](|callback|) is false, then return false.
+
+          Note: This deliberately ignores the result of [=Completion=]([$Get$](|callback|), <code>handleEvent</code>) because running getters during the check adds a bunch of complexity.

```suggestion
              Note: [=Event listener/Callback=] objects that use {{handleEvent}} are assumed to be non-empty. This avoids calling the {{handleEvent}} getters, which could modify the event listeners during this check.
```

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

Message ID: <w3c/ServiceWorker/pull/1676/review/1368480000@github.com>

Received on Monday, 3 April 2023 07:56:06 UTC