Title: [220539] trunk
Revision
220539
Author
beid...@apple.com
Date
2017-08-10 12:28:26 -0700 (Thu, 10 Aug 2017)

Log Message

Add ServiceWorkerJob.
https://bugs.webkit.org/show_bug.cgi?id=175241

Reviewed by Tim Horton.

Source/WebCore:

Test: http/tests/workers/service/basic-register.html

This patch does a few things:
- Adds the spec concept of a ServiceWorkerJob (in the WebProcess, at least)
- Adds a ServiceWorkerProvider interface for WebKit to implement
- Actually creates a job for service worker registration and "schedules" it,
  though it always immediately errors out the promise.

Actually queuing jobs and executing asynchronously is coming up soon.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:

* dom/Document.cpp:
(WebCore::Document::sessionID const):
* dom/Document.h:

* workers/ServiceWorkerContainer.cpp:
(WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
(WebCore::ServiceWorkerContainer::addRegistration):
(WebCore::ServiceWorkerContainer::scheduleJob):
(WebCore::ServiceWorkerContainer::jobDidFinish):
* workers/ServiceWorkerContainer.h:

* workers/ServiceWorkerJob.cpp: Added.
(WebCore::ServiceWorkerJob::ServiceWorkerJob):
(WebCore::ServiceWorkerJob::~ServiceWorkerJob):
(WebCore::ServiceWorkerJob::failedWithException):
* workers/ServiceWorkerJob.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
(WebCore::ServiceWorkerJob::createRegisterJob):
(WebCore::ServiceWorkerJob::identifier const):

* workers/ServiceWorkerJobClient.h: Added.
(WebCore::ServiceWorkerJobClient::~ServiceWorkerJobClient):

* workers/ServiceWorkerProvider.cpp: Added.
(WebCore::ServiceWorkerProvider::singleton):
(WebCore::ServiceWorkerProvider::setSharedProvider):
* workers/ServiceWorkerProvider.h: Added.
* workers/ServiceWorkerRegistrationOptions.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
* workers/ServiceWorkerRegistrationParameters.cpp: Added.
* workers/ServiceWorkerRegistrationParameters.h: Added.

Source/WebKit:

* CMakeLists.txt:
* WebKit.xcodeproj/project.pbxproj:

* WebProcess/Storage/WebServiceWorkerProvider.cpp: Added.
(WebKit::WebServiceWorkerProvider::singleton):
(WebKit::WebServiceWorkerProvider::WebServiceWorkerProvider):
(WebKit::WebServiceWorkerProvider::scheduleJob):
* WebProcess/Storage/WebServiceWorkerProvider.h: Added.

* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):

LayoutTests:

Verifies that the "serviceWorker.register()" job we currently schedule fails as expected.

* http/tests/workers/service/basic-register-expected.txt: Added.
* http/tests/workers/service/basic-register.html: Added.
* http/tests/workers/service/resources/basic-register.js: Added.
* http/tests/workers/service/resources/empty-worker.js: Added.
* platform/mac-wk1/TestExpectations:
* platform/win/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (220538 => 220539)


--- trunk/LayoutTests/ChangeLog	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/LayoutTests/ChangeLog	2017-08-10 19:28:26 UTC (rev 220539)
@@ -1,3 +1,19 @@
+2017-08-10  Brady Eidson  <beid...@apple.com>
+
+        Add ServiceWorkerJob.
+        https://bugs.webkit.org/show_bug.cgi?id=175241
+
+        Reviewed by Tim Horton.
+
+        Verifies that the "serviceWorker.register()" job we currently schedule fails as expected.
+
+        * http/tests/workers/service/basic-register-expected.txt: Added.
+        * http/tests/workers/service/basic-register.html: Added.
+        * http/tests/workers/service/resources/basic-register.js: Added.
+        * http/tests/workers/service/resources/empty-worker.js: Added.
+        * platform/mac-wk1/TestExpectations:
+        * platform/win/TestExpectations:
+
 2017-08-10  Commit Queue  <commit-qu...@webkit.org>
 
         Unreviewed, rolling out r220463.

Added: trunk/LayoutTests/http/tests/workers/service/basic-register-expected.txt (0 => 220539)


--- trunk/LayoutTests/http/tests/workers/service/basic-register-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/basic-register-expected.txt	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,2 @@
+CONSOLE MESSAGE: line 11: Registration failed with error: UnknownError: serviceWorker job scheduling is not yet implemented
+

Added: trunk/LayoutTests/http/tests/workers/service/basic-register.html (0 => 220539)


--- trunk/LayoutTests/http/tests/workers/service/basic-register.html	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/basic-register.html	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,9 @@
+<html>
+<head>
+<script src=""
+</head>
+<body>
+
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/http/tests/workers/service/resources/basic-register.js (0 => 220539)


--- trunk/LayoutTests/http/tests/workers/service/resources/basic-register.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/basic-register.js	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,17 @@
+function done()
+{
+    finishJSTest();
+}
+
+navigator.serviceWorker.register("resources/empty-worker.js", { })
+.then(function(r) {
+	console.log("Registered!");
+	done();
+}, function(e) {
+	console.log("Registration failed with error: " + e);
+	done();
+})
+.catch(function(e) {
+	console.log("Exception registering: " + e);
+	done();
+});

Added: trunk/LayoutTests/http/tests/workers/service/resources/empty-worker.js (0 => 220539)


--- trunk/LayoutTests/http/tests/workers/service/resources/empty-worker.js	                        (rev 0)
+++ trunk/LayoutTests/http/tests/workers/service/resources/empty-worker.js	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1 @@
+// This script intentionally left blank.

Modified: trunk/LayoutTests/platform/mac-wk1/TestExpectations (220538 => 220539)


--- trunk/LayoutTests/platform/mac-wk1/TestExpectations	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/LayoutTests/platform/mac-wk1/TestExpectations	2017-08-10 19:28:26 UTC (rev 220539)
@@ -390,3 +390,5 @@
 
 # requires wk2 speculative tiling
 fast/images/low-memory-decode.html [ Skip ]
+
+http/tests/workers/service [ Skip ]

Modified: trunk/LayoutTests/platform/win/TestExpectations (220538 => 220539)


--- trunk/LayoutTests/platform/win/TestExpectations	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/LayoutTests/platform/win/TestExpectations	2017-08-10 19:28:26 UTC (rev 220539)
@@ -4072,3 +4072,4 @@
 imported/w3c/web-platform-tests/fetch/api/basic/accept-header.any.html [ Slow ]
 imported/w3c/web-platform-tests/fetch/api/cors/cors-basic.any.html [ Slow ]
 
+http/tests/workers/service [ Skip ]

Modified: trunk/Source/WebCore/CMakeLists.txt (220538 => 220539)


--- trunk/Source/WebCore/CMakeLists.txt	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebCore/CMakeLists.txt	2017-08-10 19:28:26 UTC (rev 220539)
@@ -2979,7 +2979,10 @@
     workers/ServiceWorker.cpp
     workers/ServiceWorkerContainer.cpp
     workers/ServiceWorkerGlobalScope.cpp
+    workers/ServiceWorkerJob.cpp
+    workers/ServiceWorkerProvider.cpp
     workers/ServiceWorkerRegistration.cpp
+    workers/ServiceWorkerRegistrationParameters.cpp
     workers/Worker.cpp
     workers/WorkerConsoleClient.cpp
     workers/WorkerEventQueue.cpp

Modified: trunk/Source/WebCore/ChangeLog (220538 => 220539)


--- trunk/Source/WebCore/ChangeLog	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebCore/ChangeLog	2017-08-10 19:28:26 UTC (rev 220539)
@@ -1,3 +1,53 @@
+2017-08-10  Brady Eidson  <beid...@apple.com>
+
+        Add ServiceWorkerJob.
+        https://bugs.webkit.org/show_bug.cgi?id=175241
+
+        Reviewed by Tim Horton.
+
+        Test: http/tests/workers/service/basic-register.html
+
+        This patch does a few things:
+        - Adds the spec concept of a ServiceWorkerJob (in the WebProcess, at least)
+        - Adds a ServiceWorkerProvider interface for WebKit to implement
+        - Actually creates a job for service worker registration and "schedules" it,
+          though it always immediately errors out the promise.
+
+        Actually queuing jobs and executing asynchronously is coming up soon.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * dom/Document.cpp:
+        (WebCore::Document::sessionID const):
+        * dom/Document.h:
+
+        * workers/ServiceWorkerContainer.cpp:
+        (WebCore::ServiceWorkerContainer::~ServiceWorkerContainer):
+        (WebCore::ServiceWorkerContainer::addRegistration):
+        (WebCore::ServiceWorkerContainer::scheduleJob):
+        (WebCore::ServiceWorkerContainer::jobDidFinish):
+        * workers/ServiceWorkerContainer.h:
+
+        * workers/ServiceWorkerJob.cpp: Added.
+        (WebCore::ServiceWorkerJob::ServiceWorkerJob):
+        (WebCore::ServiceWorkerJob::~ServiceWorkerJob):
+        (WebCore::ServiceWorkerJob::failedWithException):
+        * workers/ServiceWorkerJob.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
+        (WebCore::ServiceWorkerJob::createRegisterJob):
+        (WebCore::ServiceWorkerJob::identifier const):
+
+        * workers/ServiceWorkerJobClient.h: Added.
+        (WebCore::ServiceWorkerJobClient::~ServiceWorkerJobClient):
+
+        * workers/ServiceWorkerProvider.cpp: Added.
+        (WebCore::ServiceWorkerProvider::singleton):
+        (WebCore::ServiceWorkerProvider::setSharedProvider):
+        * workers/ServiceWorkerProvider.h: Added.
+        * workers/ServiceWorkerRegistrationOptions.h: Copied from Source/WebCore/workers/ServiceWorkerContainer.h.
+        * workers/ServiceWorkerRegistrationParameters.cpp: Added.
+        * workers/ServiceWorkerRegistrationParameters.h: Added.
+
 2017-08-10  Tim Horton  <timothy_hor...@apple.com>
 
         Remove some unused lambda captures so that WebKit builds with -Wunused-lambda-capture

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (220538 => 220539)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2017-08-10 19:28:26 UTC (rev 220539)
@@ -2167,6 +2167,13 @@
 		510D4A37103165EE0049EA54 /* SocketStreamHandle.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A31103165EE0049EA54 /* SocketStreamHandle.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		510D4A38103165EE0049EA54 /* SocketStreamHandleClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5110FCFC1E03641D006F8D0B /* IDBCursorRecord.h in Headers */ = {isa = PBXBuildFile; fileRef = 5110FCFB1E0362A5006F8D0B /* IDBCursorRecord.h */; };
+		511CA6791F3904B10019E074 /* ServiceWorkerProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511CA6771F3904AA0019E074 /* ServiceWorkerProvider.cpp */; };
+		511CA67A1F3904B10019E074 /* ServiceWorkerProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 511CA6781F3904AA0019E074 /* ServiceWorkerProvider.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		511CA67D1F3905A60019E074 /* ServiceWorkerJob.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511CA67C1F3905710019E074 /* ServiceWorkerJob.cpp */; };
+		511CA67E1F3905A60019E074 /* ServiceWorkerJob.h in Headers */ = {isa = PBXBuildFile; fileRef = 511CA67B1F3905710019E074 /* ServiceWorkerJob.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		511CA6801F39331F0019E074 /* ServiceWorkerJobClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 511CA67F1F39331B0019E074 /* ServiceWorkerJobClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		511CA6831F3A3CD90019E074 /* ServiceWorkerRegistrationParameters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511CA6821F3A3CD50019E074 /* ServiceWorkerRegistrationParameters.cpp */; };
+		511CA6841F3A3CD90019E074 /* ServiceWorkerRegistrationParameters.h in Headers */ = {isa = PBXBuildFile; fileRef = 511CA6811F3A3CD50019E074 /* ServiceWorkerRegistrationParameters.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		511EC1271C50AACA0032F983 /* IDBSerialization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EC1251C50AA570032F983 /* IDBSerialization.cpp */; };
 		511EC1281C50AACA0032F983 /* IDBSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 511EC1261C50AA570032F983 /* IDBSerialization.h */; };
 		511EC12B1C50ABBF0032F983 /* SQLiteIDBTransaction.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 511EC1291C50ABBA0032F983 /* SQLiteIDBTransaction.cpp */; };
@@ -2311,7 +2318,7 @@
 		5182C23E1F313A090059BA7C /* ServiceWorker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5182C23C1F3139FC0059BA7C /* ServiceWorker.cpp */; };
 		5182C23F1F313A090059BA7C /* ServiceWorker.h in Headers */ = {isa = PBXBuildFile; fileRef = 5182C23B1F3139FC0059BA7C /* ServiceWorker.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5182C2401F313A090059BA7C /* ServiceWorkerContainer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5182C2381F3139FC0059BA7C /* ServiceWorkerContainer.cpp */; };
-		5182C2411F313A090059BA7C /* ServiceWorkerContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5182C2331F3139FC0059BA7C /* ServiceWorkerContainer.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		5182C2411F313A090059BA7C /* ServiceWorkerContainer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5182C2331F3139FC0059BA7C /* ServiceWorkerContainer.h */; };
 		5182C2421F313A090059BA7C /* ServiceWorkerGlobalScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5182C2361F3139FC0059BA7C /* ServiceWorkerGlobalScope.cpp */; };
 		5182C2431F313A090059BA7C /* ServiceWorkerGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 5182C23A1F3139FC0059BA7C /* ServiceWorkerGlobalScope.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		5182C2441F313A090059BA7C /* ServiceWorkerRegistration.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5182C2341F3139FC0059BA7C /* ServiceWorkerRegistration.cpp */; };
@@ -2416,6 +2423,7 @@
 		51BA4ACB1BBC5BD900DF3D6D /* MemoryIDBBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BA4AC91BBC5B9E00DF3D6D /* MemoryIDBBackingStore.h */; };
 		51BA4ACC1BBC5BDD00DF3D6D /* IDBBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BA4AC71BBC5AD600DF3D6D /* IDBBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51BE37E00DAEE00E001085FC /* StorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BE37DE0DAEE00E001085FC /* StorageArea.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		51BEB6391F3B94B0005029B9 /* ServiceWorkerRegistrationOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BEB6381F3B94AB005029B9 /* ServiceWorkerRegistrationOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51C0AA390F2AA10A001648C2 /* CachedFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C0AA380F2AA10A001648C2 /* CachedFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		51C0AA410F2AA15E001648C2 /* CachedFrame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51C0AA400F2AA15E001648C2 /* CachedFrame.cpp */; };
 		51C61B0A1DE536E7008A212D /* ScrollingMomentumCalculator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51C61B081DE536E7008A212D /* ScrollingMomentumCalculator.cpp */; };
@@ -9883,6 +9891,13 @@
 		510D4A31103165EE0049EA54 /* SocketStreamHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandle.h; sourceTree = "<group>"; };
 		510D4A32103165EE0049EA54 /* SocketStreamHandleClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketStreamHandleClient.h; sourceTree = "<group>"; };
 		5110FCFB1E0362A5006F8D0B /* IDBCursorRecord.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBCursorRecord.h; sourceTree = "<group>"; };
+		511CA6771F3904AA0019E074 /* ServiceWorkerProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerProvider.cpp; sourceTree = "<group>"; };
+		511CA6781F3904AA0019E074 /* ServiceWorkerProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerProvider.h; sourceTree = "<group>"; };
+		511CA67B1F3905710019E074 /* ServiceWorkerJob.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerJob.h; sourceTree = "<group>"; };
+		511CA67C1F3905710019E074 /* ServiceWorkerJob.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerJob.cpp; sourceTree = "<group>"; };
+		511CA67F1F39331B0019E074 /* ServiceWorkerJobClient.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerJobClient.h; sourceTree = "<group>"; };
+		511CA6811F3A3CD50019E074 /* ServiceWorkerRegistrationParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerRegistrationParameters.h; sourceTree = "<group>"; };
+		511CA6821F3A3CD50019E074 /* ServiceWorkerRegistrationParameters.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerRegistrationParameters.cpp; sourceTree = "<group>"; };
 		511EC1251C50AA570032F983 /* IDBSerialization.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBSerialization.cpp; sourceTree = "<group>"; };
 		511EC1261C50AA570032F983 /* IDBSerialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBSerialization.h; sourceTree = "<group>"; };
 		511EC1291C50ABBA0032F983 /* SQLiteIDBTransaction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLiteIDBTransaction.cpp; sourceTree = "<group>"; };
@@ -10133,6 +10148,7 @@
 		51BA4AC81BBC5B9E00DF3D6D /* MemoryIDBBackingStore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryIDBBackingStore.cpp; sourceTree = "<group>"; };
 		51BA4AC91BBC5B9E00DF3D6D /* MemoryIDBBackingStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryIDBBackingStore.h; sourceTree = "<group>"; };
 		51BE37DE0DAEE00E001085FC /* StorageArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageArea.h; sourceTree = "<group>"; };
+		51BEB6381F3B94AB005029B9 /* ServiceWorkerRegistrationOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ServiceWorkerRegistrationOptions.h; sourceTree = "<group>"; };
 		51C0AA380F2AA10A001648C2 /* CachedFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedFrame.h; sourceTree = "<group>"; };
 		51C0AA400F2AA15E001648C2 /* CachedFrame.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedFrame.cpp; sourceTree = "<group>"; };
 		51C61B081DE536E7008A212D /* ScrollingMomentumCalculator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingMomentumCalculator.cpp; sourceTree = "<group>"; };
@@ -17497,9 +17513,17 @@
 				5182C2361F3139FC0059BA7C /* ServiceWorkerGlobalScope.cpp */,
 				5182C23A1F3139FC0059BA7C /* ServiceWorkerGlobalScope.h */,
 				5182C2391F3139FC0059BA7C /* ServiceWorkerGlobalScope.idl */,
+				511CA67C1F3905710019E074 /* ServiceWorkerJob.cpp */,
+				511CA67B1F3905710019E074 /* ServiceWorkerJob.h */,
+				511CA67F1F39331B0019E074 /* ServiceWorkerJobClient.h */,
+				511CA6771F3904AA0019E074 /* ServiceWorkerProvider.cpp */,
+				511CA6781F3904AA0019E074 /* ServiceWorkerProvider.h */,
 				5182C2341F3139FC0059BA7C /* ServiceWorkerRegistration.cpp */,
 				5182C2371F3139FC0059BA7C /* ServiceWorkerRegistration.h */,
 				5182C2321F3139FC0059BA7C /* ServiceWorkerRegistration.idl */,
+				51BEB6381F3B94AB005029B9 /* ServiceWorkerRegistrationOptions.h */,
+				511CA6821F3A3CD50019E074 /* ServiceWorkerRegistrationParameters.cpp */,
+				511CA6811F3A3CD50019E074 /* ServiceWorkerRegistrationParameters.h */,
 				51F174FD1F35898800C74950 /* ServiceWorkerUpdateViaCache.h */,
 				51F174FB1F3588D700C74950 /* ServiceWorkerUpdateViaCache.idl */,
 				2E4346330F546A8200B0F1BA /* Worker.cpp */,
@@ -26740,6 +26764,7 @@
 				A584FE2C1863870F00843B10 /* CommandLineAPIModule.h in Headers */,
 				A584FE2618637DAB00843B10 /* CommandLineAPIModuleSource.h in Headers */,
 				6550B6A2099DF0270090D781 /* Comment.h in Headers */,
+				511CA67E1F3905A60019E074 /* ServiceWorkerJob.h in Headers */,
 				57E664FC1E73703300765536 /* CommonCryptoDERUtilities.h in Headers */,
 				E1FE137518402A6700892F13 /* CommonCryptoUtilities.h in Headers */,
 				0F60F32B1DFBB10700416D6C /* CommonVM.h in Headers */,
@@ -27457,6 +27482,7 @@
 				93F198E508245E59001E9ABC /* HTMLDocument.h in Headers */,
 				977B3867122883E900B81FF8 /* HTMLDocumentParser.h in Headers */,
 				93F198E608245E59001E9ABC /* HTMLElement.h in Headers */,
+				51BEB6391F3B94B0005029B9 /* ServiceWorkerRegistrationOptions.h in Headers */,
 				A17C81230F2A5CF7005DAAEB /* HTMLElementFactory.h in Headers */,
 				977B37241228721700B81FF8 /* HTMLElementStack.h in Headers */,
 				B562DB6017D3CD630010AF96 /* HTMLElementTypeHelpers.h in Headers */,
@@ -28711,6 +28737,7 @@
 				07EE76EC1BE96DB000F89133 /* MockRealtimeVideoSource.h in Headers */,
 				07EE76EF1BEA619800F89133 /* MockRealtimeVideoSourceMac.h in Headers */,
 				CDF2B0171820540700F2B424 /* MockSourceBufferPrivate.h in Headers */,
+				511CA6801F39331F0019E074 /* ServiceWorkerJobClient.h in Headers */,
 				CDF2B0191820540700F2B424 /* MockTracks.h in Headers */,
 				C6D74AD509AA282E000B0A52 /* ModifySelectionListLevel.h in Headers */,
 				709A01FE1E3D0BDD006B0D4C /* ModuleFetchFailureKind.h in Headers */,
@@ -29023,6 +29050,7 @@
 				07C1C0E51BFB60ED00BD2256 /* RealtimeMediaSourceSupportedConstraints.h in Headers */,
 				41103AAC1E39791000769F03 /* RealtimeOutgoingAudioSource.h in Headers */,
 				BC4368E80C226E32005EFB5F /* Rect.h in Headers */,
+				511CA6841F3A3CD90019E074 /* ServiceWorkerRegistrationParameters.h in Headers */,
 				FD45A958175D414C00C21EC8 /* RectangleShape.h in Headers */,
 				9831AE4A154225C900FE2644 /* ReferrerPolicy.h in Headers */,
 				BCAB418213E356E800D8AAF3 /* Region.h in Headers */,
@@ -29700,6 +29728,7 @@
 				83C1D42F178D5AB500141E68 /* SVGPathSegLinetoAbs.h in Headers */,
 				B2227A780D00BF220071B782 /* SVGPathSegLinetoHorizontal.h in Headers */,
 				83C1D430178D5AB500141E68 /* SVGPathSegLinetoHorizontalAbs.h in Headers */,
+				511CA67A1F3904B10019E074 /* ServiceWorkerProvider.h in Headers */,
 				83C1D431178D5AB500141E68 /* SVGPathSegLinetoHorizontalRel.h in Headers */,
 				83C1D432178D5AB500141E68 /* SVGPathSegLinetoRel.h in Headers */,
 				B2227A7D0D00BF220071B782 /* SVGPathSegLinetoVertical.h in Headers */,
@@ -31416,6 +31445,7 @@
 				51741D120B07259A00ED442C /* HistoryItem.cpp in Sources */,
 				5160F4980B0AA75F00C1D2AF /* HistoryItemMac.mm in Sources */,
 				4969B0F213D0B33F00DF3521 /* HitTestingTransformState.cpp in Sources */,
+				511CA6831F3A3CD90019E074 /* ServiceWorkerRegistrationParameters.cpp in Sources */,
 				2D8287F616E4A0380086BD00 /* HitTestLocation.cpp in Sources */,
 				9307F1D70AF2D59000DBA31A /* HitTestResult.cpp in Sources */,
 				FD31609812B026F700C1A359 /* HRTFDatabase.cpp in Sources */,
@@ -32480,6 +32510,7 @@
 				E1C8BE5D0E8BD15A0064CB7D /* JSWorker.cpp in Sources */,
 				E182568F0EF2B02D00933242 /* JSWorkerGlobalScope.cpp in Sources */,
 				E1C36D340EB0A094007410BC /* JSWorkerGlobalScopeBase.cpp in Sources */,
+				511CA6791F3904B10019E074 /* ServiceWorkerProvider.cpp in Sources */,
 				E18258AC0EF3CD7000933242 /* JSWorkerGlobalScopeCustom.cpp in Sources */,
 				E1C362F00EAF2AA9007410BC /* JSWorkerLocation.cpp in Sources */,
 				E1271A590EEECDE400F61213 /* JSWorkerNavigator.cpp in Sources */,
@@ -33025,6 +33056,7 @@
 				A8DF4AE80980C42C0052981B /* RenderTableCol.cpp in Sources */,
 				A8DF4AF00980C42C0052981B /* RenderTableRow.cpp in Sources */,
 				A8DF4AED0980C42C0052981B /* RenderTableSection.cpp in Sources */,
+				511CA67D1F3905A60019E074 /* ServiceWorkerJob.cpp in Sources */,
 				BCEA488B097D93020094C9E4 /* RenderText.cpp in Sources */,
 				AB67D1A8097F3AE300F9392E /* RenderTextControl.cpp in Sources */,
 				083DAEA60F01A7FB00342754 /* RenderTextControlMultiLine.cpp in Sources */,

Modified: trunk/Source/WebCore/dom/Document.cpp (220538 => 220539)


--- trunk/Source/WebCore/dom/Document.cpp	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebCore/dom/Document.cpp	2017-08-10 19:28:26 UTC (rev 220539)
@@ -4688,8 +4688,13 @@
 
 SessionID Document::sessionID() const
 {
-    auto* page = this->page();
-    return page ? page->sessionID() : SessionID();
+    if (m_sessionID.isValid())
+        return m_sessionID;
+
+    if (auto* page = this->page())
+        m_sessionID = page->sessionID();
+
+    return m_sessionID;
 }
 
 void Document::setPageCacheState(PageCacheState state)

Modified: trunk/Source/WebCore/dom/Document.h (220538 => 220539)


--- trunk/Source/WebCore/dom/Document.h	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebCore/dom/Document.h	2017-08-10 19:28:26 UTC (rev 220539)
@@ -45,6 +45,7 @@
 #include "Region.h"
 #include "RenderPtr.h"
 #include "ScriptExecutionContext.h"
+#include "SessionID.h"
 #include "StringWithDirection.h"
 #include "Supplementable.h"
 #include "TextResourceDecoder.h"
@@ -1820,6 +1821,7 @@
 #endif
 
     OrientationNotifier m_orientationNotifier;
+    mutable SessionID m_sessionID;
 
     static bool hasEverCreatedAnAXObjectCache;
 };

Modified: trunk/Source/WebCore/workers/ServiceWorkerContainer.cpp (220538 => 220539)


--- trunk/Source/WebCore/workers/ServiceWorkerContainer.cpp	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebCore/workers/ServiceWorkerContainer.cpp	2017-08-10 19:28:26 UTC (rev 220539)
@@ -32,6 +32,10 @@
 #include "JSDOMPromiseDeferred.h"
 #include "NavigatorBase.h"
 #include "ScriptExecutionContext.h"
+#include "SecurityOrigin.h"
+#include "ServiceWorkerJob.h"
+#include "ServiceWorkerProvider.h"
+#include "ServiceWorkerRegistrationParameters.h"
 #include "URL.h"
 #include <wtf/RunLoop.h>
 
@@ -46,6 +50,13 @@
     m_readyPromise.reject(Exception { UnknownError, ASCIILiteral("serviceWorker.ready() is not yet implemented") });
 }
 
+ServiceWorkerContainer::~ServiceWorkerContainer()
+{
+#ifndef NDEBUG
+    ASSERT(m_creationThread == currentThread());
+#endif
+}
+
 void ServiceWorkerContainer::refEventTarget()
 {
     m_navigator.ref();
@@ -64,7 +75,7 @@
 void ServiceWorkerContainer::addRegistration(const String& relativeScriptURL, const RegistrationOptions& options, Ref<DeferredPromise>&& promise)
 {
     auto* context = scriptExecutionContext();
-    if (!context) {
+    if (!context || !context->sessionID().isValid()) {
         ASSERT_NOT_REACHED();
         return;
     }
@@ -74,19 +85,20 @@
         return;
     }
 
-    auto scriptURL = context->completeURL(relativeScriptURL);
-    if (!scriptURL.isValid()) {
+    ServiceWorkerRegistrationParameters parameters;
+    parameters.scriptURL = context->completeURL(relativeScriptURL);
+    if (!parameters.scriptURL.isValid()) {
         promise->reject(Exception { TypeError, ASCIILiteral("serviceWorker.register() must be called with a valid relative script URL") });
         return;
     }
 
     // FIXME: The spec disallows scripts outside of HTTP(S), but we'll likely support app custom URL schemes in WebKit.
-    if (!scriptURL.protocolIsInHTTPFamily()) {
+    if (!parameters.scriptURL.protocolIsInHTTPFamily()) {
         promise->reject(Exception { TypeError, ASCIILiteral("serviceWorker.register() must be called with a script URL whose protocol is either HTTP or HTTPS") });
         return;
     }
 
-    String path = scriptURL.path();
+    String path = parameters.scriptURL.path();
     if (path.containsIgnoringASCIICase("%2f") || path.containsIgnoringASCIICase("%5c")) {
         promise->reject(Exception { TypeError, ASCIILiteral("serviceWorker.register() must be called with a script URL whose path does not contain '%%2f' or '%%5c'") });
         return;
@@ -93,14 +105,26 @@
     }
 
     String scope = options.scope.isEmpty() ? ASCIILiteral("./") : options.scope;
-    auto scopeURL = context->completeURL(scope);
+    if (!scope.isEmpty())
+        parameters.scopeURL = context->completeURL(scope);
 
-    // FIXME: At this point, create a Register job and add it to the job queue
-    UNUSED_PARAM(scopeURL);
+    parameters.sessionID = context->sessionID();
+    parameters.clientCreationURL = context->url();
+    parameters.topOrigin = SecurityOriginData::fromSecurityOrigin(context->topOrigin());
+    parameters.options = options;
 
-    promise->reject(Exception { UnknownError, ASCIILiteral("serviceWorker.register() is not yet implemented") });
+    scheduleJob(ServiceWorkerJob::createRegisterJob(*this, WTFMove(promise), WTFMove(parameters)));
 }
 
+void ServiceWorkerContainer::scheduleJob(Ref<ServiceWorkerJob>&& job)
+{
+    ServiceWorkerJob& rawJob = job.get();
+    auto result = m_jobMap.add(rawJob.identifier(), WTFMove(job));
+    ASSERT_UNUSED(result, result.isNewEntry);
+
+    ServiceWorkerProvider::singleton().scheduleJob(rawJob);
+}
+
 void ServiceWorkerContainer::getRegistration(const String&, Ref<DeferredPromise>&& promise)
 {
     promise->reject(Exception { UnknownError, ASCIILiteral("serviceWorker.getRegistration() is not yet implemented") });
@@ -115,6 +139,12 @@
 {
 }
 
+void ServiceWorkerContainer::jobDidFinish(ServiceWorkerJob& job)
+{
+    auto taken = m_jobMap.take(job.identifier());
+    ASSERT_UNUSED(taken, taken.get() == &job);
+}
+
 const char* ServiceWorkerContainer::activeDOMObjectName() const
 {
     return "ServiceWorkerContainer";

Modified: trunk/Source/WebCore/workers/ServiceWorkerContainer.h (220538 => 220539)


--- trunk/Source/WebCore/workers/ServiceWorkerContainer.h	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebCore/workers/ServiceWorkerContainer.h	2017-08-10 19:28:26 UTC (rev 220539)
@@ -30,7 +30,11 @@
 #include "ActiveDOMObject.h"
 #include "DOMPromiseProxy.h"
 #include "EventTarget.h"
+#include "ServiceWorkerJobClient.h"
 #include "ServiceWorkerRegistration.h"
+#include "ServiceWorkerRegistrationOptions.h"
+#include "SessionID.h"
+#include <wtf/Threading.h>
 
 namespace WebCore {
 
@@ -41,16 +45,12 @@
 enum class ServiceWorkerUpdateViaCache;
 enum class WorkerType;
 
-class ServiceWorkerContainer final : public EventTargetWithInlineData, public ActiveDOMObject {
+class ServiceWorkerContainer final : public EventTargetWithInlineData, public ActiveDOMObject, public ServiceWorkerJobClient {
 public:
     ServiceWorkerContainer(ScriptExecutionContext&, NavigatorBase&);
-    virtual ~ServiceWorkerContainer() = default;
+    ~ServiceWorkerContainer();
 
-    struct RegistrationOptions {
-        String scope;
-        WorkerType type;
-        ServiceWorkerUpdateViaCache updateViaCache;
-    };
+    typedef WebCore::RegistrationOptions RegistrationOptions;
 
     ServiceWorker* controller() const;
 
@@ -63,7 +63,13 @@
 
     void startMessages();
 
+    void ref() final { refEventTarget(); }
+    void deref() final { derefEventTarget(); }
+
 private:
+    void scheduleJob(Ref<ServiceWorkerJob>&&);
+    void jobDidFinish(ServiceWorkerJob&) final;
+
     const char* activeDOMObjectName() const final;
     bool canSuspendForDocumentSuspension() const final;
     ScriptExecutionContext* scriptExecutionContext() const final { return ActiveDOMObject::scriptExecutionContext(); }
@@ -74,6 +80,12 @@
     ReadyPromise m_readyPromise;
 
     NavigatorBase& m_navigator;
+
+    HashMap<uint64_t, RefPtr<ServiceWorkerJob>> m_jobMap;
+
+#ifndef NDEBUG
+    ThreadIdentifier m_creationThread { currentThread() };
+#endif
 };
 
 } // namespace WebCore

Added: trunk/Source/WebCore/workers/ServiceWorkerJob.cpp (0 => 220539)


--- trunk/Source/WebCore/workers/ServiceWorkerJob.cpp	                        (rev 0)
+++ trunk/Source/WebCore/workers/ServiceWorkerJob.cpp	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ServiceWorkerJob.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "JSDOMPromiseDeferred.h"
+#include "ServiceWorkerRegistrationParameters.h"
+
+namespace WebCore {
+
+static std::atomic<uint64_t> currentIdentifier;
+
+ServiceWorkerJob::ServiceWorkerJob(ServiceWorkerJobClient& client, Ref<DeferredPromise>&& promise, ServiceWorkerRegistrationParameters&& parameters)
+    : m_client(client)
+    , m_promise(WTFMove(promise))
+    , m_identifier(++currentIdentifier)
+{
+    m_registrationParameters = std::make_unique<ServiceWorkerRegistrationParameters>(WTFMove(parameters));
+}
+
+ServiceWorkerJob::~ServiceWorkerJob()
+{
+    ASSERT(currentThread() == m_creationThread);
+}
+
+void ServiceWorkerJob::failedWithException(Exception&& exception)
+{
+    ASSERT(currentThread() == m_creationThread);
+
+    ASSERT(!m_completed);
+    m_promise->reject(WTFMove(exception));
+    m_client->jobDidFinish(*this);
+    m_completed = true;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Copied: trunk/Source/WebCore/workers/ServiceWorkerJob.h (from rev 220538, trunk/Source/WebCore/workers/ServiceWorkerContainer.h) (0 => 220539)


--- trunk/Source/WebCore/workers/ServiceWorkerJob.h	                        (rev 0)
+++ trunk/Source/WebCore/workers/ServiceWorkerJob.h	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "ServiceWorkerJobClient.h"
+#include <wtf/RefPtr.h>
+#include <wtf/ThreadSafeRefCounted.h>
+#include <wtf/Threading.h>
+
+namespace WebCore {
+
+class DeferredPromise;
+class Exception;
+struct ServiceWorkerRegistrationParameters;
+
+class ServiceWorkerJob : public ThreadSafeRefCounted<ServiceWorkerJob> {
+public:
+    static Ref<ServiceWorkerJob> createRegisterJob(ServiceWorkerJobClient& client, Ref<DeferredPromise>&& promise, ServiceWorkerRegistrationParameters&& parameters)
+    {
+        return adoptRef(*new ServiceWorkerJob(client, WTFMove(promise), WTFMove(parameters)));
+    }
+
+    ~ServiceWorkerJob();
+
+    WEBCORE_EXPORT void failedWithException(Exception&&);
+
+    uint64_t identifier() const { return m_identifier; }
+
+private:
+    ServiceWorkerJob(ServiceWorkerJobClient&, Ref<DeferredPromise>&&, ServiceWorkerRegistrationParameters&&);
+
+    Ref<ServiceWorkerJobClient> m_client;
+    std::unique_ptr<ServiceWorkerRegistrationParameters> m_registrationParameters;
+    Ref<DeferredPromise> m_promise;
+
+    bool m_completed { false };
+    uint64_t m_identifier;
+
+#if !ASSERT_DISABLED
+    ThreadIdentifier m_creationThread { currentThread() };
+#endif
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)
+

Added: trunk/Source/WebCore/workers/ServiceWorkerJobClient.h (0 => 220539)


--- trunk/Source/WebCore/workers/ServiceWorkerJobClient.h	                        (rev 0)
+++ trunk/Source/WebCore/workers/ServiceWorkerJobClient.h	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SERVICE_WORKER)
+
+namespace WebCore {
+
+class ServiceWorkerJob;
+
+class ServiceWorkerJobClient {
+public:
+    virtual ~ServiceWorkerJobClient() { };
+
+    virtual void jobDidFinish(ServiceWorkerJob&) = 0;
+
+    virtual void ref() = 0;
+    virtual void deref() = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Added: trunk/Source/WebCore/workers/ServiceWorkerProvider.cpp (0 => 220539)


--- trunk/Source/WebCore/workers/ServiceWorkerProvider.cpp	                        (rev 0)
+++ trunk/Source/WebCore/workers/ServiceWorkerProvider.cpp	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ServiceWorkerProvider.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+namespace WebCore {
+
+static ServiceWorkerProvider* sharedProvider;
+
+ServiceWorkerProvider& ServiceWorkerProvider::singleton()
+{
+    RELEASE_ASSERT(sharedProvider);
+    return *sharedProvider;
+}
+
+void ServiceWorkerProvider::setSharedProvider(ServiceWorkerProvider& newProvider)
+{
+    sharedProvider = &newProvider;
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Added: trunk/Source/WebCore/workers/ServiceWorkerProvider.h (0 => 220539)


--- trunk/Source/WebCore/workers/ServiceWorkerProvider.h	                        (rev 0)
+++ trunk/Source/WebCore/workers/ServiceWorkerProvider.h	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SERVICE_WORKER)
+
+namespace WebCore {
+
+class ServiceWorkerJob;
+
+class WEBCORE_EXPORT ServiceWorkerProvider {
+public:
+    virtual ~ServiceWorkerProvider() { }
+
+    WEBCORE_EXPORT static ServiceWorkerProvider& singleton();
+    WEBCORE_EXPORT static void setSharedProvider(ServiceWorkerProvider&);
+
+    virtual void scheduleJob(ServiceWorkerJob&) = 0;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Copied: trunk/Source/WebCore/workers/ServiceWorkerRegistrationOptions.h (from rev 220538, trunk/Source/WebCore/workers/ServiceWorkerContainer.h) (0 => 220539)


--- trunk/Source/WebCore/workers/ServiceWorkerRegistrationOptions.h	                        (rev 0)
+++ trunk/Source/WebCore/workers/ServiceWorkerRegistrationOptions.h	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SERVICE_WORKER)
+
+#include <wtf/text/WTFString.h>
+
+namespace WebCore {
+
+enum class ServiceWorkerUpdateViaCache;
+enum class WorkerType;
+
+struct RegistrationOptions {
+    String scope;
+    WorkerType type;
+    ServiceWorkerUpdateViaCache updateViaCache;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Added: trunk/Source/WebCore/workers/ServiceWorkerRegistrationParameters.cpp (0 => 220539)


--- trunk/Source/WebCore/workers/ServiceWorkerRegistrationParameters.cpp	                        (rev 0)
+++ trunk/Source/WebCore/workers/ServiceWorkerRegistrationParameters.cpp	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "ServiceWorkerRegistrationParameters.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+namespace WebCore {
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Added: trunk/Source/WebCore/workers/ServiceWorkerRegistrationParameters.h (0 => 220539)


--- trunk/Source/WebCore/workers/ServiceWorkerRegistrationParameters.h	                        (rev 0)
+++ trunk/Source/WebCore/workers/ServiceWorkerRegistrationParameters.h	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SERVICE_WORKER)
+
+#include "SecurityOriginData.h"
+#include "ServiceWorkerRegistrationOptions.h"
+#include "SessionID.h"
+#include "URL.h"
+
+namespace WebCore {
+
+struct ServiceWorkerRegistrationParameters {
+    SessionID sessionID;
+    URL scriptURL;
+    URL clientCreationURL;
+    SecurityOriginData topOrigin;
+    URL scopeURL;
+    RegistrationOptions options;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebKit/CMakeLists.txt (220538 => 220539)


--- trunk/Source/WebKit/CMakeLists.txt	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebKit/CMakeLists.txt	2017-08-10 19:28:26 UTC (rev 220539)
@@ -522,6 +522,7 @@
     WebProcess/Plugins/Netscape/NetscapePluginNone.cpp
     WebProcess/Plugins/Netscape/NetscapePluginStream.cpp
 
+    WebProcess/Storage/WebServiceWorkerProvider.cpp
     WebProcess/Storage/WebToStorageProcessConnection.cpp
 
     WebProcess/UserContent/WebUserContentController.cpp

Modified: trunk/Source/WebKit/ChangeLog (220538 => 220539)


--- trunk/Source/WebKit/ChangeLog	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebKit/ChangeLog	2017-08-10 19:28:26 UTC (rev 220539)
@@ -1,3 +1,22 @@
+2017-08-10  Brady Eidson  <beid...@apple.com>
+
+        Add ServiceWorkerJob.
+        https://bugs.webkit.org/show_bug.cgi?id=175241
+
+        Reviewed by Tim Horton.
+
+        * CMakeLists.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+
+        * WebProcess/Storage/WebServiceWorkerProvider.cpp: Added.
+        (WebKit::WebServiceWorkerProvider::singleton):
+        (WebKit::WebServiceWorkerProvider::WebServiceWorkerProvider):
+        (WebKit::WebServiceWorkerProvider::scheduleJob):
+        * WebProcess/Storage/WebServiceWorkerProvider.h: Added.
+
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+
 2017-08-10  Tim Horton  <timothy_hor...@apple.com>
 
         Remove some unused lambda captures so that WebKit builds with -Wunused-lambda-capture

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (220538 => 220539)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2017-08-10 19:28:26 UTC (rev 220539)
@@ -1050,6 +1050,8 @@
 		51ACBBA1127A8F2C00D203B9 /* WebContextMenuProxyMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51ACBB9F127A8F2C00D203B9 /* WebContextMenuProxyMac.mm */; };
 		51B15A8413843A3900321AD8 /* EnvironmentUtilities.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51B15A8213843A3900321AD8 /* EnvironmentUtilities.cpp */; };
 		51B15A8513843A3900321AD8 /* EnvironmentUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		51BEB62B1F3A5AD7005029B9 /* WebServiceWorkerProvider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51BEB6291F3A5ACD005029B9 /* WebServiceWorkerProvider.cpp */; };
+		51BEB62C1F3A5AD7005029B9 /* WebServiceWorkerProvider.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BEB62A1F3A5ACD005029B9 /* WebServiceWorkerProvider.h */; };
 		51C0C9741DDD76000032CAD3 /* IconLoadingDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 51C0C9721DDD74F00032CAD3 /* IconLoadingDelegate.h */; };
 		51C0C9751DDD76030032CAD3 /* IconLoadingDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51C0C9731DDD74F00032CAD3 /* IconLoadingDelegate.mm */; };
 		51CD1C5D1B3493AF00142CA5 /* WKSecurityOriginRef.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51CD1C591B3493A900142CA5 /* WKSecurityOriginRef.cpp */; };
@@ -3321,6 +3323,8 @@
 		51ACC9351628064800342550 /* NetworkProcessMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkProcessMessages.h; sourceTree = "<group>"; };
 		51B15A8213843A3900321AD8 /* EnvironmentUtilities.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EnvironmentUtilities.cpp; path = unix/EnvironmentUtilities.cpp; sourceTree = "<group>"; };
 		51B15A8313843A3900321AD8 /* EnvironmentUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EnvironmentUtilities.h; path = unix/EnvironmentUtilities.h; sourceTree = "<group>"; };
+		51BEB6291F3A5ACD005029B9 /* WebServiceWorkerProvider.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WebServiceWorkerProvider.cpp; sourceTree = "<group>"; };
+		51BEB62A1F3A5ACD005029B9 /* WebServiceWorkerProvider.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = WebServiceWorkerProvider.h; sourceTree = "<group>"; };
 		51C0C9721DDD74F00032CAD3 /* IconLoadingDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IconLoadingDelegate.h; sourceTree = "<group>"; };
 		51C0C9731DDD74F00032CAD3 /* IconLoadingDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IconLoadingDelegate.mm; sourceTree = "<group>"; };
 		51C0C9791DDD78540032CAD3 /* _WKLinkIconParameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKLinkIconParameters.h; sourceTree = "<group>"; };
@@ -6026,6 +6030,8 @@
 		5118E9981F295259003EF9F5 /* Storage */ = {
 			isa = PBXGroup;
 			children = (
+				51BEB6291F3A5ACD005029B9 /* WebServiceWorkerProvider.cpp */,
+				51BEB62A1F3A5ACD005029B9 /* WebServiceWorkerProvider.h */,
 				5118E9991F295259003EF9F5 /* WebToStorageProcessConnection.cpp */,
 				5118E99A1F295259003EF9F5 /* WebToStorageProcessConnection.h */,
 			);
@@ -8825,6 +8831,7 @@
 				BCE0E425168B7A280057E66A /* WebProcessSupplement.h in Headers */,
 				1A1E093418861D3800D2DC49 /* WebProgressTrackerClient.h in Headers */,
 				512F589D12A8838800629530 /* WebProtectionSpace.h in Headers */,
+				51BEB62C1F3A5AD7005029B9 /* WebServiceWorkerProvider.h in Headers */,
 				37948404150C350600E52CE9 /* WebRenderLayer.h in Headers */,
 				3760881F150413E900FC82C7 /* WebRenderObject.h in Headers */,
 				510AFFBA16542048001BA05E /* WebResourceLoader.h in Headers */,
@@ -10364,6 +10371,7 @@
 				2DA944A11884E4F000ED86DB /* WebIOSEventFactory.mm in Sources */,
 				C0337DD3127A2A0E008FF4F4 /* WebKeyboardEvent.cpp in Sources */,
 				1A6280F31919982A006AD9F9 /* WebKit.m in Sources */,
+				51BEB62B1F3A5AD7005029B9 /* WebServiceWorkerProvider.cpp in Sources */,
 				BC9BA5041697C45300E44616 /* WebKit2Initialize.cpp in Sources */,
 				465250E61ECF52DC002025CB /* WebKit2InitializeCocoa.mm in Sources */,
 				51FB08FF1639DE1A00EC324A /* WebLoaderStrategy.cpp in Sources */,

Added: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp (0 => 220539)


--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.cpp	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebServiceWorkerProvider.h"
+
+#if ENABLE(SERVICE_WORKER)
+
+#include <WebCore/Exception.h>
+#include <WebCore/ExceptionCode.h>
+#include <WebCore/ServiceWorkerJob.h>
+#include <wtf/text/WTFString.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebServiceWorkerProvider& WebServiceWorkerProvider::singleton()
+{
+    static NeverDestroyed<WebServiceWorkerProvider> provider;
+    return provider;
+}
+
+WebServiceWorkerProvider::WebServiceWorkerProvider()
+{
+}
+
+void WebServiceWorkerProvider::scheduleJob(ServiceWorkerJob& job)
+{
+    job.failedWithException(Exception { UnknownError, ASCIILiteral("serviceWorker job scheduling is not yet implemented") });
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_WORKER)

Added: trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h (0 => 220539)


--- trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/Storage/WebServiceWorkerProvider.h	2017-08-10 19:28:26 UTC (rev 220539)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(SERVICE_WORKER)
+
+#include <WebCore/ServiceWorkerProvider.h>
+#include <wtf/NeverDestroyed.h>
+
+namespace WebKit {
+
+class WebServiceWorkerProvider : public WebCore::ServiceWorkerProvider {
+public:
+    static WebServiceWorkerProvider& singleton();
+
+private:
+    friend NeverDestroyed<WebServiceWorkerProvider>;
+    WebServiceWorkerProvider();
+
+    void scheduleJob(WebCore::ServiceWorkerJob&) final;
+
+}; // class WebServiceWorkerProvider
+
+} // namespace WebKit
+
+#endif // ENABLE(SERVICE_WORKER)

Modified: trunk/Source/WebKit/WebProcess/WebProcess.cpp (220538 => 220539)


--- trunk/Source/WebKit/WebProcess/WebProcess.cpp	2017-08-10 19:05:51 UTC (rev 220538)
+++ trunk/Source/WebKit/WebProcess/WebProcess.cpp	2017-08-10 19:28:26 UTC (rev 220539)
@@ -63,6 +63,7 @@
 #include "WebProcessPoolMessages.h"
 #include "WebProcessProxyMessages.h"
 #include "WebResourceLoadStatisticsStoreMessages.h"
+#include "WebServiceWorkerProvider.h"
 #include "WebSocketStream.h"
 #include "WebToStorageProcessConnection.h"
 #include "WebsiteData.h"
@@ -392,6 +393,10 @@
     GamepadProvider::singleton().setSharedProvider(WebGamepadProvider::singleton());
 #endif
 
+#if ENABLE(SERVICE_WORKER)
+    ServiceWorkerProvider::setSharedProvider(WebServiceWorkerProvider::singleton());
+#endif
+
 #if ENABLE(WEBASSEMBLY)
     JSC::Wasm::enableFastMemory();
 #endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to