Bug 180143

Summary: ServiceWorkerClient objects should be reused if there is already one existing with the same identifier
Product: WebKit Reporter: youenn fablet <youennf>
Component: WebCore Misc.Assignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: beidson, cdumez, commit-queue, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch for landing
none
Rebasing none

youenn fablet
Reported 2017-11-29 08:42:16 PST
ServiceWorkerClient objects should be reused if there is already one existing with the same identifier.
Attachments
Patch (16.79 KB, patch)
2017-11-29 11:19 PST, youenn fablet
no flags
Patch (17.27 KB, patch)
2017-11-29 13:51 PST, youenn fablet
no flags
Patch for landing (17.33 KB, patch)
2017-11-29 16:31 PST, youenn fablet
no flags
Rebasing (17.33 KB, patch)
2017-11-29 16:46 PST, youenn fablet
no flags
youenn fablet
Comment 1 2017-11-29 11:19:16 PST
Chris Dumez
Comment 2 2017-11-29 11:56:03 PST
Comment on attachment 327879 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=327879&action=review > Source/WebCore/workers/service/ServiceWorkerClientIdentifier.h:97 > + static bool isDeletedValue(const WebCore::ServiceWorkerClientIdentifier& slot) { return slot == WebCore::ServiceWorkerClientIdentifier { }; } How does it differentiate empty from deleted values? It seems they are both { }, which seems wrong, no? > Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp:67 > +Ref<ServiceWorkerClient> ServiceWorkerGlobalScope::getOrCreateServiceWorkerClient(ServiceWorkerClientIdentifier identifier, ServiceWorkerClientData&& data) For ServiceWorker / ServiceWorkerRegistration, we put the getOrCreate() method on the ServiceWorker / ServiceWorkerRegistration class. Could we follow the same pattern here for consistency?
Chris Dumez
Comment 3 2017-11-29 11:59:14 PST
(In reply to Chris Dumez from comment #2) > Comment on attachment 327879 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=327879&action=review > > > Source/WebCore/workers/service/ServiceWorkerClientIdentifier.h:97 > > + static bool isDeletedValue(const WebCore::ServiceWorkerClientIdentifier& slot) { return slot == WebCore::ServiceWorkerClientIdentifier { }; } > > How does it differentiate empty from deleted values? It seems they are both > { }, which seems wrong, no? > > > Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp:67 > > +Ref<ServiceWorkerClient> ServiceWorkerGlobalScope::getOrCreateServiceWorkerClient(ServiceWorkerClientIdentifier identifier, ServiceWorkerClientData&& data) > > For ServiceWorker / ServiceWorkerRegistration, we put the getOrCreate() > method on the ServiceWorker / ServiceWorkerRegistration class. Could we > follow the same pattern here for consistency? And we should probably drop ServiceWorkerClient::create().
youenn fablet
Comment 4 2017-11-29 13:51:45 PST
youenn fablet
Comment 5 2017-11-29 15:00:15 PST
(In reply to youenn fablet from comment #4) > Created attachment 327897 [details] > Patch gtk failure is unrelated, patch updated according Chris comments.
Chris Dumez
Comment 6 2017-11-29 15:18:31 PST
Comment on attachment 327897 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=327897&action=review r=me with comment. > Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp:67 > +ServiceWorkerClient* ServiceWorkerGlobalScope::getServiceWorkerClient(ServiceWorkerClientIdentifier identifier) We normally avoid "get" prefix. I think this should be serviceWorkerClient(identifier).
youenn fablet
Comment 7 2017-11-29 16:31:52 PST
Created attachment 327923 [details] Patch for landing
WebKit Commit Bot
Comment 8 2017-11-29 16:33:12 PST
Comment on attachment 327923 [details] Patch for landing Rejecting attachment 327923 [details] from commit-queue. Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'apply-attachment', '--no-update', '--non-interactive', 327923, '--port=mac']" exit_code: 2 cwd: /Volumes/Data/EWS/WebKit Last 500 characters of output: Source/WebCore/workers/service/ServiceWorkerWindowClient.h patching file Source/WebCore/workers/service/context/ServiceWorkerThread.cpp patching file LayoutTests/ChangeLog patching file LayoutTests/http/tests/workers/service/resources/basic-ServiceWorker-postMessage-worker.js patching file LayoutTests/http/tests/workers/service/resources/basic-ServiceWorker-postMessage.js Failed to run "[u'/Volumes/Data/EWS/WebKit/Tools/Scripts/svn-apply', '--force']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit Full output: http://webkit-queues.webkit.org/results/5410834
youenn fablet
Comment 9 2017-11-29 16:46:41 PST
Created attachment 327926 [details] Rebasing
WebKit Commit Bot
Comment 10 2017-11-29 17:19:29 PST
Comment on attachment 327926 [details] Rebasing Clearing flags on attachment: 327926 Committed r225308: <https://trac.webkit.org/changeset/225308>
WebKit Commit Bot
Comment 11 2017-11-29 17:19:30 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 12 2017-11-29 17:20:53 PST
Note You need to log in before you can comment on or make changes to this bug.