Service worker script fetching currently always uses the network cache
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Dec 2017 19:55:01 +0000 (19:55 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Dec 2017 19:55:01 +0000 (19:55 +0000)
commit3677d71f3ae80939072da2dcb14b8c9455862931
tree6f29c6a15e85df71ab80a304643c15ec56f89958
parent81f827f6d5f43e947edafe713724ef5efd0f0599
Service worker script fetching currently always uses the network cache
https://bugs.webkit.org/show_bug.cgi?id=180816

Reviewed by Alex Christensen.

Source/WebCore:

Service worker script fetching currently always uses the network cache. This is incorrect as per:
- https://w3c.github.io/ServiceWorker/#update-algorithm (step 7.2)

Tests: http/tests/workers/service/registration-updateViaCache-all.html
       http/tests/workers/service/registration-updateViaCache-none.html

* workers/Worker.cpp:
(WebCore::Worker::create):
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadAsynchronously):
* workers/WorkerScriptLoader.h:
* workers/service/SWClientConnection.cpp:
(WebCore::SWClientConnection::startScriptFetchForServer):
* workers/service/SWClientConnection.h:
* workers/service/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::startScriptFetchForJob):
* workers/service/ServiceWorkerContainer.h:
* workers/service/ServiceWorkerJob.cpp:
(WebCore::ServiceWorkerJob::startScriptFetch):
(WebCore::ServiceWorkerJob::fetchScriptWithContext):
* workers/service/ServiceWorkerJob.h:
* workers/service/ServiceWorkerJobClient.h:
* workers/service/server/SWServer.cpp:
(WebCore::SWServer::startScriptFetch):
* workers/service/server/SWServer.h:
* workers/service/server/SWServerJobQueue.cpp:
(WebCore::SWServerJobQueue::runUpdateJob):
* workers/service/server/SWServerRegistration.h:
(WebCore::SWServerRegistration::lastUpdateTime const):

Source/WebKit:

* StorageProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::startScriptFetchInClient):
* StorageProcess/ServiceWorker/WebSWServerConnection.h:
* WebProcess/Storage/WebSWClientConnection.messages.in:

LayoutTests:

Add layout test coverage.

* http/tests/workers/service/registration-updateViaCache-all-expected.txt: Added.
* http/tests/workers/service/registration-updateViaCache-all.html: Added.
* http/tests/workers/service/registration-updateViaCache-none-expected.txt: Added.
* http/tests/workers/service/registration-updateViaCache-none.html: Added.
* http/tests/workers/service/resources/cacheable-script-worker.php: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225916 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/registration-updateViaCache-all-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/registration-updateViaCache-all.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/registration-updateViaCache-none-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/registration-updateViaCache-none.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/cacheable-script-worker.php [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/workers/Worker.cpp
Source/WebCore/workers/WorkerScriptLoader.cpp
Source/WebCore/workers/WorkerScriptLoader.h
Source/WebCore/workers/service/SWClientConnection.cpp
Source/WebCore/workers/service/SWClientConnection.h
Source/WebCore/workers/service/ServiceWorkerContainer.cpp
Source/WebCore/workers/service/ServiceWorkerContainer.h
Source/WebCore/workers/service/ServiceWorkerJob.cpp
Source/WebCore/workers/service/ServiceWorkerJob.h
Source/WebCore/workers/service/ServiceWorkerJobClient.h
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebCore/workers/service/server/SWServerJobQueue.cpp
Source/WebCore/workers/service/server/SWServerRegistration.h
Source/WebKit/ChangeLog
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.cpp
Source/WebKit/StorageProcess/ServiceWorker/WebSWServerConnection.h
Source/WebKit/WebProcess/Storage/WebSWClientConnection.messages.in