Bug 225096

Summary: SWContextManager::postMessageToServiceWorker should check for valid service worker
Product: WebKit Reporter: youenn fablet <youennf>
Component: Service WorkersAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, cdumez, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

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].