Bug 225096 - SWContextManager::postMessageToServiceWorker should check for valid service worker
Summary: SWContextManager::postMessageToServiceWorker should check for valid service w...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-27 03:04 PDT by youenn fablet
Modified: 2021-04-27 11:39 PDT (History)
3 users (show)

See Also:


Attachments
Patch (1.91 KB, patch)
2021-04-27 03:07 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 2021-04-27 03:04:24 PDT
SWContextManager::postMessageToServiceWorker should check for valid service worker
Comment 1 youenn fablet 2021-04-27 03:04:34 PDT
<rdar://76718162>
Comment 2 youenn fablet 2021-04-27 03:07:28 PDT
Created attachment 427131 [details]
Patch
Comment 3 Chris Dumez 2021-04-27 07:39:26 PDT
Comment on attachment 427131 [details]
Patch

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

> Source/WebCore/workers/service/context/SWContextManager.cpp:87
> +    if (!serviceWorker)

Should we also return early in the isTerminatingOrTerminated() case?
Comment 4 youenn fablet 2021-04-27 08:00:45 PDT
(In reply to Chris Dumez from comment #3)
> Comment on attachment 427131 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=427131&action=review
> 
> > Source/WebCore/workers/service/context/SWContextManager.cpp:87
> > +    if (!serviceWorker)
> 
> Should we also return early in the isTerminatingOrTerminated() case?

We probably could since enqueuing the task will be useless work in that case.
I went this way to align this message event to other events like install or activate.
Comment 5 Chris Dumez 2021-04-27 08:01:33 PDT
Comment on attachment 427131 [details]
Patch

Ok. If this is consistent with others, let's go this way.
Comment 6 EWS 2021-04-27 11:39:10 PDT
Committed r276649 (237076@main): <https://commits.webkit.org/237076@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 427131 [details].