WebSWClientConnection should do IPC to StorageProcess if its WebSWOriginTable is...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Nov 2017 20:28:34 +0000 (20:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Nov 2017 20:28:34 +0000 (20:28 +0000)
commit52213a7376cd21a23bd2c7511ebd13c6c22e2472
tree67f0601804f83dfa256b402c4365d493361eb7b5
parentd7099bdfef2fa9acf202197319ff3faefaa45291
WebSWClientConnection should do IPC to StorageProcess if its WebSWOriginTable is not yet initialized
https://bugs.webkit.org/show_bug.cgi?id=179668

Patch by Youenn Fablet <youenn@apple.com> on 2017-11-14
Reviewed by Chris Dumez.

Source/WebCore:

Covered by existing updated tests.

Removing hasServiceWorkerRegisteredForOrigin and using hasServiceWorkerRegistration instead.
The former is only checking the shared map which might not be initialized at the time the function is called.
The latter is going to the StorageProcess if the map is not yet initialized.

* testing/Internals.cpp:
(WebCore::Internals::hasServiceWorkerRegisteredForOrigin): Deleted.
* testing/Internals.h:
* testing/Internals.idl:
* workers/service/server/SWClientConnection.h:

Source/WebKit:

There may be cases where the origin table is not initialized and we would think there is no service worker registration.
In such a case, we should go to the StorageProcess.
StorageProcess is now sending an IPC message back to each registered SW connection so that WebProcess will know whether its map
is correctly initialized or not.

Renaming hasServiceWorkerRegisteredForOrigin in mayHaveServiceWorkerRegisteredForOrigin.

* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::mayHaveServiceWorkerRegisteredForOrigin const):
(WebKit::WebSWClientConnection::matchRegistration):
(WebKit::WebSWClientConnection::hasServiceWorkerRegisteredForOrigin const): Deleted.
* WebProcess/Storage/WebSWClientConnection.h:
* WebProcess/Storage/WebSWOriginTable.h:
(WebKit::WebSWOriginTable::isInitialized const):
* WebProcess/Storage/WebServiceWorkerProvider.cpp:
(WebKit::shouldHandleFetch):

LayoutTests:

Updated tests to use hasServiceWorkerRegistration instead of hasServiceWorkerRegisteredForOrigin.
Since the latter is trying to match a registration and compares scopes, we need the scopes to be set right on the tests.

* http/tests/workers/service/basic-unregister.https-expected.txt:
* http/tests/workers/service/resources/basic-register.js:
* http/tests/workers/service/resources/basic-unregister.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224832 268f45cc-cd09-0410-ab3c-d52691b4dbfc
17 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/basic-unregister.https-expected.txt
LayoutTests/http/tests/workers/service/resources/basic-register.js
LayoutTests/http/tests/workers/service/resources/basic-unregister.js
Source/WebCore/ChangeLog
Source/WebCore/testing/Internals.cpp
Source/WebCore/testing/Internals.h
Source/WebCore/testing/Internals.idl
Source/WebCore/workers/service/server/SWClientConnection.h
Source/WebKit/ChangeLog
Source/WebKit/StorageProcess/ServiceWorker/WebSWOriginStore.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp
Source/WebKit/WebProcess/Storage/WebSWClientConnection.h
Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in
Source/WebKit/WebProcess/Storage/WebSWOriginTable.cpp
Source/WebKit/WebProcess/Storage/WebSWOriginTable.h
Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp