Bug 201174 - Skip fetch event dispatching if no fetch event handler is added at script evaluation time
Summary: Skip fetch event dispatching if no fetch event handler is added at script eva...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-08-27 00:50 PDT by youenn fablet
Modified: 2019-08-29 12:25 PDT (History)
3 users (show)

See Also:


Attachments
Patch (42.20 KB, patch)
2019-08-27 01:23 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (42.14 KB, patch)
2019-08-29 06:44 PDT, youenn fablet
no flags Details | Formatted Diff | Diff
Patch for landing (42.09 KB, patch)
2019-08-29 08:24 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2019-08-27 00:50:26 PDT
Skip fetch event dispatching if no fetch event handler is added at script evaluation time 
https://w3c.github.io/ServiceWorker/#handle-fetch step 16
Comment 1 youenn fablet 2019-08-27 01:23:44 PDT
Created attachment 377326 [details]
Patch
Comment 2 Chris Dumez 2019-08-28 10:16:40 PDT
Comment on attachment 377326 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=377326&action=review

> Source/WebCore/workers/service/server/SWServerWorker.h:115
> +    bool shouldSkipFetchEvent() const { return m_shouldSkipHandleFetch && *m_shouldSkipHandleFetch; }

return m_shouldSkipHandleFetch.valueOr(false); would look nicer IMO.

> Source/WebCore/workers/service/server/SWServerWorker.h:135
> +    Optional<bool> m_shouldSkipHandleFetch;

Do we really need an Optional<> ? Why cannot it be a bool that is default-initialized to false? Nobody seems to rely on it being nullopt at the moment.
Comment 3 youenn fablet 2019-08-29 06:19:05 PDT
Comment on attachment 377326 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=377326&action=review

>> Source/WebCore/workers/service/server/SWServerWorker.h:135
>> +    Optional<bool> m_shouldSkipHandleFetch;
> 
> Do we really need an Optional<> ? Why cannot it be a bool that is default-initialized to false? Nobody seems to rely on it being nullopt at the moment.

Will change it to a bool.
Comment 4 youenn fablet 2019-08-29 06:44:16 PDT
Created attachment 377575 [details]
Patch for landing
Comment 5 youenn fablet 2019-08-29 08:24:14 PDT
Created attachment 377588 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2019-08-29 12:24:52 PDT
Comment on attachment 377588 [details]
Patch for landing

Clearing flags on attachment: 377588

Committed r249287: <https://trac.webkit.org/changeset/249287>
Comment 7 WebKit Commit Bot 2019-08-29 12:24:54 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2019-08-29 12:25:19 PDT
<rdar://problem/54848514>