RESOLVED FIXED Bug 239122
Shared workers should match service worker registrations
https://bugs.webkit.org/show_bug.cgi?id=239122
Summary Shared workers should match service worker registrations
youenn fablet
Reported 2022-04-12 05:37:07 PDT
Shared workers should match service worker registrations
Attachments
Patch (65.04 KB, patch)
2022-04-12 05:40 PDT, youenn fablet
no flags
Patch (65.56 KB, patch)
2022-04-14 02:30 PDT, youenn fablet
no flags
Patch (66.11 KB, patch)
2022-04-14 06:24 PDT, youenn fablet
ews-feeder: commit-queue-
Patch (68.55 KB, patch)
2022-04-14 08:17 PDT, youenn fablet
no flags
Patch (68.65 KB, patch)
2022-04-15 00:17 PDT, youenn fablet
no flags
Patch for landing (67.47 KB, patch)
2022-04-21 06:37 PDT, youenn fablet
no flags
Fix remote worker process change (80.23 KB, patch)
2022-04-22 03:14 PDT, youenn fablet
no flags
Fix remote worker process change (80.23 KB, patch)
2022-04-22 05:56 PDT, youenn fablet
no flags
Rebasing (80.45 KB, patch)
2022-04-22 07:15 PDT, youenn fablet
no flags
Patch (81.77 KB, patch)
2022-04-26 02:37 PDT, youenn fablet
no flags
Rebasing (81.81 KB, patch)
2022-04-26 04:52 PDT, youenn fablet
ews-feeder: commit-queue-
Fix build (81.83 KB, patch)
2022-04-26 05:04 PDT, youenn fablet
no flags
Fix WinCairo (81.94 KB, patch)
2022-04-26 23:17 PDT, youenn fablet
ews-feeder: commit-queue-
Fix WinCairo (81.95 KB, patch)
2022-04-26 23:52 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2022-04-12 05:40:37 PDT
youenn fablet
Comment 2 2022-04-14 02:30:15 PDT
youenn fablet
Comment 3 2022-04-14 06:24:32 PDT
youenn fablet
Comment 4 2022-04-14 08:17:23 PDT
youenn fablet
Comment 5 2022-04-15 00:17:09 PDT
Chris Dumez
Comment 6 2022-04-15 07:32:16 PDT
Comment on attachment 457680 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=457680&action=review r=me > Source/WebCore/workers/service/SWClientConnection.cpp:134 > + worker->postTaskToWorkerGlobalScope([message = WTFMove(message), sourceData = WTFMove(sourceData), sourceOrigin = WTFMove(sourceOrigin).isolatedCopy()] (auto& context) mutable { WTFMove(sourceData).isolatedCopy() Let the optimization in `ServiceWorkerData isolatedCopy() &&;` determine if moving is safe. > Source/WebCore/workers/service/SWClientConnection.cpp:141 > + sharedWorker->thread().runLoop().postTask([message = WTFMove(message), sourceData = WTFMove(sourceData), sourceOrigin = WTFMove(sourceOrigin).isolatedCopy()] (auto& context) mutable { WTFMove(sourceData).isolatedCopy() > Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.cpp:54 > + static NeverDestroyed<HashMap<ScriptExecutionContextIdentifier, SharedWorkerThreadProxy*>> map; Should probably use MainThreadNeverDestroyed. > Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.cpp:93 > + , m_clientIdentifier(*initializationData.clientIdentifier) use-after-move of initializationData. While this may work in practice, it looks unsafe and should be avoided. > Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.h:88 > + ScriptExecutionContextIdentifier m_clientIdentifier; I am a bit unclear about what this means. A sharedWorker doesn't necessarily have a single client.
youenn fablet
Comment 7 2022-04-15 07:53:54 PDT
> > Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.cpp:93 > > + , m_clientIdentifier(*initializationData.clientIdentifier) > > use-after-move of initializationData. While this may work in practice, it > looks unsafe and should be avoided. > > > Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.h:88 > > + ScriptExecutionContextIdentifier m_clientIdentifier; > > I am a bit unclear about what this means. A sharedWorker doesn't necessarily > have a single client. It is the id of the shared worker context, exposed as client.id.
Chris Dumez
Comment 8 2022-04-15 07:59:32 PDT
(In reply to youenn fablet from comment #7) > > > Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.cpp:93 > > > + , m_clientIdentifier(*initializationData.clientIdentifier) > > > > use-after-move of initializationData. While this may work in practice, it > > looks unsafe and should be avoided. > > > > > Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.h:88 > > > + ScriptExecutionContextIdentifier m_clientIdentifier; > > > > I am a bit unclear about what this means. A sharedWorker doesn't necessarily > > have a single client. > > It is the id of the shared worker context, exposed as client.id. I see but the naming is confusing in the context of a shared worker when we say "client". I thought you meant client of the shared worker. When you meant that the shared worker is the client of the service worker. Not sure how to clarify though.
Chris Dumez
Comment 9 2022-04-15 08:00:08 PDT
(In reply to Chris Dumez from comment #8) > (In reply to youenn fablet from comment #7) > > > > Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.cpp:93 > > > > + , m_clientIdentifier(*initializationData.clientIdentifier) > > > > > > use-after-move of initializationData. While this may work in practice, it > > > looks unsafe and should be avoided. > > > > > > > Source/WebCore/workers/shared/context/SharedWorkerThreadProxy.h:88 > > > > + ScriptExecutionContextIdentifier m_clientIdentifier; > > > > > > I am a bit unclear about what this means. A sharedWorker doesn't necessarily > > > have a single client. > > > > It is the id of the shared worker context, exposed as client.id. > > I see but the naming is confusing in the context of a shared worker when we > say "client". I thought you meant client of the shared worker. When you > meant that the shared worker is the client of the service worker. Not sure > how to clarify though. Maybe it should be m_contextIdentifier?
Radar WebKit Bug Importer
Comment 10 2022-04-19 05:38:12 PDT
youenn fablet
Comment 11 2022-04-21 03:16:18 PDT
> Maybe it should be m_contextIdentifier? Sounds good.
youenn fablet
Comment 12 2022-04-21 06:37:10 PDT
Created attachment 458056 [details] Patch for landing
youenn fablet
Comment 13 2022-04-22 03:14:37 PDT
Created attachment 458130 [details] Fix remote worker process change
youenn fablet
Comment 14 2022-04-22 05:56:13 PDT
Created attachment 458139 [details] Fix remote worker process change
youenn fablet
Comment 15 2022-04-22 07:15:37 PDT
Created attachment 458144 [details] Rebasing
youenn fablet
Comment 16 2022-04-26 02:37:40 PDT
youenn fablet
Comment 17 2022-04-26 04:52:54 PDT
Created attachment 458351 [details] Rebasing
youenn fablet
Comment 18 2022-04-26 05:04:00 PDT
Created attachment 458353 [details] Fix build
youenn fablet
Comment 19 2022-04-26 23:17:55 PDT
Created attachment 458420 [details] Fix WinCairo
youenn fablet
Comment 20 2022-04-26 23:52:10 PDT
Created attachment 458423 [details] Fix WinCairo
EWS
Comment 21 2022-04-27 01:22:32 PDT
Committed r293501 (250032@main): <https://commits.webkit.org/250032@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 458423 [details].
Note You need to log in before you can comment on or make changes to this bug.