- From: Yoshisato Yanagisawa <notifications@github.com>
- Date: Thu, 23 Feb 2023 19:04:01 -0800
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/ServiceWorker/pull/1672/review/1312446154@github.com>
@yoshisatoyanagisawa 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 am not fully understand the comment, but I tried to update the steps as suggested. https://github.com/w3c/ServiceWorker/pull/1672/commits/27f0e006edf2af02c1c11a9421879aa11f467c51 -- Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/pull/1672#discussion_r1116459636 You are receiving this because you are subscribed to this thread. Message ID: <w3c/ServiceWorker/pull/1672/review/1312446154@github.com>
Received on Friday, 24 February 2023 03:04:13 UTC