- From: Jake Archibald <notifications@github.com>
- Date: Wed, 22 Feb 2023 02:28:13 -0800
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/pull/1672/review/1308952645@github.com>
@jakearchibald commented on this pull request.
> + <h3 id="empty-fetch-handler-identification-algorithm"><dfn>Empty Fetch Handler Identification</dfn></h3>
+
+ : Input
+ :: |workerGlobalScope|, a [=service worker/global object=].
+ : Output
+ :: a boolean
+
+ 1. If |workerGlobalScope|'s [=set of event types to handle=] does not [=set/contain=] <code>fetch</code>, then returns false.
+ 1. Let |eventListenerList| be an empty [=list=].
+ 1. [=list/For each=] |eventListener| of |workerGlobalScope|'s [=set of event types to handle=]:
+ 1. If |eventListener|'s <a spec="dom">type</a> is <code>fetch</code>, then [=list/append=] |eventListener| to |eventListenerList|.
+ 1. [=list/For each=] |eventListener| of |eventListenerList|:
+ 1. If |eventListener|'s [=callback=] is not null:
+ 1. Set |callback| to the result of [=converting|convert to an ECMAScript value=] |eventListener|'s [=callback=] to an ECMAScript value.
+ 1. If [$IsCallable$](|callback|) is false:
+ 1. Let |getResult| be [=Completion=]([$Get$](|callback|), <code>handleEvent</code>).
+ 1. If |getResult| is [=abrupt completion=], then return false.
+ 1. Set |callback| to |getResult|.
+ 1. If [$IsCallable$](|callback|) is false, then return false.
+ 1. If |callback|'s [=function body=] is not empty (i.e. either a [=statement=] or [=declaration=] exist), then return false.
+
+ Note: it detects something like `onfetch = () => {}`. Some sites have a fetch event listener with empty body to make them recognized as progressive web application (PWA).
I think that was fixed in an earlier review
--
Reply to this email directly or view it on GitHub:
https://github.com/w3c/ServiceWorker/pull/1672#discussion_r1114132139
You are receiving this because you are subscribed to this thread.
Message ID: <w3c/ServiceWorker/pull/1672/review/1308952645@github.com>
Received on Wednesday, 22 February 2023 10:28:25 UTC