self.importScripts() should obey updateViaCache inside service workers
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Dec 2017 23:59:40 +0000 (23:59 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 14 Dec 2017 23:59:40 +0000 (23:59 +0000)
commitda1ed5403928234cb9df5e5e3c1763595d2b26ee
treeed1ae7be22f22d09b35cc19410c8e2cd8bcb89ec
parenta42b9ebb96bbc30023235e0b097ccbad5d86fd18
self.importScripts() should obey updateViaCache inside service workers
https://bugs.webkit.org/show_bug.cgi?id=180826

Reviewed by Youenn Fablet.

Source/WebCore:

self.importScripts() should obey updateViaCache inside service workers, as per:
- https://html.spec.whatwg.org/multipage/workers.html#dom-workerglobalscope-importscripts

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

* workers/WorkerGlobalScope.cpp:
(WebCore::WorkerGlobalScope::importScripts):
* workers/WorkerScriptLoader.cpp:
(WebCore::WorkerScriptLoader::loadSynchronously):
* workers/WorkerScriptLoader.h:
* workers/service/SWClientConnection.cpp:
(WebCore::SWClientConnection::setRegistrationLastUpdateTime):
* workers/service/SWClientConnection.h:
* workers/service/ServiceWorkerRegistration.cpp:
(WebCore::ServiceWorkerRegistration::lastUpdateTime const):
(WebCore::ServiceWorkerRegistration::setLastUpdateTime):
* workers/service/ServiceWorkerRegistration.h:
* workers/service/server/SWServer.h:
* workers/service/server/SWServerRegistration.cpp:
(WebCore::SWServerRegistration::setLastUpdateTime):
* workers/service/server/SWServerRegistration.h:

Source/WebKit:

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

LayoutTests:

Add layout test coverage.

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225940 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
LayoutTests/ChangeLog
LayoutTests/http/tests/workers/service/registration-updateViaCache-all-importScripts-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/registration-updateViaCache-all-importScripts.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/registration-updateViaCache-imports-importScripts-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/registration-updateViaCache-imports-importScripts.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/registration-updateViaCache-none-importScripts-expected.txt [new file with mode: 0644]
LayoutTests/http/tests/workers/service/registration-updateViaCache-none-importScripts.html [new file with mode: 0644]
LayoutTests/http/tests/workers/service/resources/import-cacheable-script-worker.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/workers/WorkerGlobalScope.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/ServiceWorkerRegistration.cpp
Source/WebCore/workers/service/ServiceWorkerRegistration.h
Source/WebCore/workers/service/server/SWServer.cpp
Source/WebCore/workers/service/server/SWServer.h
Source/WebCore/workers/service/server/SWServerRegistration.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