Skip to content
Permalink
Browse files
SW "Hello world".
https://bugs.webkit.org/show_bug.cgi?id=178187

Reviewed by Andy Estes.

Source/WebCore:

No new tests (Covered by changes to existing tests).

With this patch, SW scripts are actually compiled and run inside a ServiceWorkerGlobalScope environment
in the SW context process.

* WebCore.xcodeproj/project.pbxproj:

* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::initScript):

* dom/EventTargetFactory.in:

* workers/WorkerGlobalScope.h:
(WebCore::WorkerGlobalScope::isServiceWorkerGlobalScope const):

* workers/service/ServiceWorkerContextData.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp.
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):

* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
(WebCore::ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope):
(WebCore::ServiceWorkerGlobalScope::registration):
(WebCore::ServiceWorkerGlobalScope::eventTargetInterface const):
* workers/service/ServiceWorkerGlobalScope.h:
(WebCore::ServiceWorkerGlobalScope::create):
(WebCore::ServiceWorkerGlobalScope::serverConnectionIdentifier const):

* workers/service/context/SWContextManager.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp.
(WebCore::SWContextManager::singleton):
(WebCore::SWContextManager::SWContextManager):
(WebCore::SWContextManager::startServiceWorkerContext):
* workers/service/context/SWContextManager.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.h.

* workers/service/context/ServiceWorkerThread.cpp: Added.
(WebCore::ServiceWorkerThreadProxy::sharedDummyProxy):
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
(WebCore::m_workerObjectProxy):
(WebCore::ServiceWorkerThread::~ServiceWorkerThread):
(WebCore::ServiceWorkerThread::createWorkerGlobalScope):
(WebCore::ServiceWorkerThread::runEventLoop):
* workers/service/context/ServiceWorkerThread.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.h.
(WebCore::ServiceWorkerThread::create):
(WebCore::ServiceWorkerThread::workerObjectProxy const):

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::createWorker):

Source/WebKit:

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

LayoutTests:

* http/tests/workers/service/basic-register-exceptions-expected.txt:
* http/tests/workers/service/basic-register-expected.txt:
* http/tests/workers/service/registration-task-queue-scheduling-1-expected.txt:


Canonical link: https://commits.webkit.org/194491@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223277 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
beidson committed Oct 13, 2017
1 parent 5156504 commit bab4973d1be6aece56b311086b95a4aa60a5b51d
Showing 20 changed files with 508 additions and 15 deletions.
@@ -1,3 +1,14 @@
2017-10-12 Brady Eidson <beidson@apple.com>

SW "Hello world".
https://bugs.webkit.org/show_bug.cgi?id=178187

Reviewed by Andy Estes.

* http/tests/workers/service/basic-register-exceptions-expected.txt:
* http/tests/workers/service/basic-register-expected.txt:
* http/tests/workers/service/registration-task-queue-scheduling-1-expected.txt:

2017-10-12 Alex Christensen <achristensen@webkit.org>

Use asynchronous ResourceHandleClient calls for WebKit1
@@ -4,7 +4,7 @@ CONSOLE MESSAGE: line 40: Registration failed with error: TypeError: serviceWork
CONSOLE MESSAGE: line 50: Registration failed with error: TypeError: serviceWorker.register() must be called with a script URL whose path does not contain '%2f' or '%5c'
CONSOLE MESSAGE: line 60: Registration failed with error: TypeError: Scope URL provided to serviceWorker.register() must be either HTTP or HTTPS
CONSOLE MESSAGE: line 70: Registration failed with error: TypeError: Scope URL provided to serviceWorker.register() cannot have a path that contains '%2f' or '%5c'
CONSOLE MESSAGE: line 10: Registration failed with error: UnknownError: Failed to start service worker script of length 0
CONSOLE MESSAGE: line 10: Registration failed with error: UnknownError: Worker script successfully started, but it has no way to communicate yet
CONSOLE MESSAGE: line 80: Registration failed with error: SecurityError: Script origin does not match the registering client's origin
CONSOLE MESSAGE: line 91: Registration failed with error: SecurityError: Scope origin does not match the registering client's origin

@@ -1,3 +1,3 @@
CONSOLE MESSAGE: line 10: Registration failed with error: UnknownError: Failed to start service worker script of length 41
CONSOLE MESSAGE: line 21: Registration failed with error: UnknownError: Failed to start service worker script of length 0
CONSOLE MESSAGE: line 10: Registration failed with error: UnknownError: Worker script successfully started, but it has no way to communicate yet
CONSOLE MESSAGE: line 21: Registration failed with error: UnknownError: Worker script successfully started, but it has no way to communicate yet

@@ -1,2 +1,2 @@
ALERT: Unexpected error received from server: UnknownError: Failed to start service worker script of length 41
ALERT: Unexpected error received from server: UnknownError: Worker script successfully started, but it has no way to communicate yet

@@ -1,3 +1,60 @@
2017-10-12 Brady Eidson <beidson@apple.com>

SW "Hello world".
https://bugs.webkit.org/show_bug.cgi?id=178187

Reviewed by Andy Estes.

No new tests (Covered by changes to existing tests).

With this patch, SW scripts are actually compiled and run inside a ServiceWorkerGlobalScope environment
in the SW context process.

* WebCore.xcodeproj/project.pbxproj:

* bindings/js/WorkerScriptController.cpp:
(WebCore::WorkerScriptController::initScript):

* dom/EventTargetFactory.in:

* workers/WorkerGlobalScope.h:
(WebCore::WorkerGlobalScope::isServiceWorkerGlobalScope const):

* workers/service/ServiceWorkerContextData.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp.
(WebCore::ServiceWorkerContextData::isolatedCopy const):
* workers/service/ServiceWorkerContextData.h:
(WebCore::ServiceWorkerContextData::encode const):
(WebCore::ServiceWorkerContextData::decode):

* workers/service/ServiceWorkerGlobalScope.cpp:
(WebCore::ServiceWorkerGlobalScope::ServiceWorkerGlobalScope):
(WebCore::ServiceWorkerGlobalScope::~ServiceWorkerGlobalScope):
(WebCore::ServiceWorkerGlobalScope::registration):
(WebCore::ServiceWorkerGlobalScope::eventTargetInterface const):
* workers/service/ServiceWorkerGlobalScope.h:
(WebCore::ServiceWorkerGlobalScope::create):
(WebCore::ServiceWorkerGlobalScope::serverConnectionIdentifier const):

* workers/service/context/SWContextManager.cpp: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.cpp.
(WebCore::SWContextManager::singleton):
(WebCore::SWContextManager::SWContextManager):
(WebCore::SWContextManager::startServiceWorkerContext):
* workers/service/context/SWContextManager.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.h.

* workers/service/context/ServiceWorkerThread.cpp: Added.
(WebCore::ServiceWorkerThreadProxy::sharedDummyProxy):
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
(WebCore::m_workerObjectProxy):
(WebCore::ServiceWorkerThread::~ServiceWorkerThread):
(WebCore::ServiceWorkerThread::createWorkerGlobalScope):
(WebCore::ServiceWorkerThread::runEventLoop):
* workers/service/context/ServiceWorkerThread.h: Copied from Source/WebCore/workers/service/ServiceWorkerGlobalScope.h.
(WebCore::ServiceWorkerThread::create):
(WebCore::ServiceWorkerThread::workerObjectProxy const):

* workers/service/server/SWServer.cpp:
(WebCore::SWServer::createWorker):

2017-10-12 Alex Christensen <achristensen@webkit.org>

Use asynchronous ResourceHandleClient calls for WebKit1
@@ -2352,6 +2352,9 @@
517A63C61B74319200E7DCDC /* KeyedEncoderCF.h in Headers */ = {isa = PBXBuildFile; fileRef = 517A63C21B74317E00E7DCDC /* KeyedEncoderCF.h */; settings = {ATTRIBUTES = (Private, ); }; };
517B25A91CC82B2A0061C011 /* IDBConnectionProxy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517B25A71CC820320061C011 /* IDBConnectionProxy.cpp */; };
517B25AA1CC82B2A0061C011 /* IDBConnectionProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 517B25A81CC820320061C011 /* IDBConnectionProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
517C870A1F8EBB2500EB8076 /* SWContextManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517C87081F8EB9BF00EB8076 /* SWContextManager.cpp */; };
517C870B1F8EBB2500EB8076 /* SWContextManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 517C87091F8EB9C000EB8076 /* SWContextManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
517C87181F8FD4D900EB8076 /* ServiceWorkerContextData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517C87161F8FD4D300EB8076 /* ServiceWorkerContextData.cpp */; };
517DEEE51DE94ADC00B91644 /* ScrollingMomentumCalculatorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 517DEEE31DE94ADC00B91644 /* ScrollingMomentumCalculatorMac.mm */; };
517DEEE81DE94B0800B91644 /* ScrollingMomentumCalculatorMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 517DEEE71DE94B0800B91644 /* ScrollingMomentumCalculatorMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
517FBA1E151AB17C00B57959 /* DOMWindowExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517FBA17151AA71B00B57959 /* DOMWindowExtension.cpp */; };
@@ -2454,6 +2457,8 @@
51BA4ACA1BBC5BD900DF3D6D /* MemoryIDBBackingStore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51BA4AC81BBC5B9E00DF3D6D /* MemoryIDBBackingStore.cpp */; };
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, ); }; };
51BCCE2F1F8F1795006BA0ED /* ServiceWorkerThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 517C87111F8EE72F00EB8076 /* ServiceWorkerThread.cpp */; };
51BCCE301F8F179E006BA0ED /* ServiceWorkerThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 517C87101F8EE72E00EB8076 /* ServiceWorkerThread.h */; settings = {ATTRIBUTES = (Private, ); }; };
51BE37E00DAEE00E001085FC /* StorageArea.h in Headers */ = {isa = PBXBuildFile; fileRef = 51BE37DE0DAEE00E001085FC /* StorageArea.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 */; };
@@ -10287,6 +10292,11 @@
517A63C21B74317E00E7DCDC /* KeyedEncoderCF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeyedEncoderCF.h; sourceTree = "<group>"; };
517B25A71CC820320061C011 /* IDBConnectionProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBConnectionProxy.cpp; sourceTree = "<group>"; };
517B25A81CC820320061C011 /* IDBConnectionProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBConnectionProxy.h; sourceTree = "<group>"; };
517C87081F8EB9BF00EB8076 /* SWContextManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SWContextManager.cpp; path = workers/service/context/SWContextManager.cpp; sourceTree = SOURCE_ROOT; };
517C87091F8EB9C000EB8076 /* SWContextManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SWContextManager.h; path = workers/service/context/SWContextManager.h; sourceTree = SOURCE_ROOT; };
517C87101F8EE72E00EB8076 /* ServiceWorkerThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ServiceWorkerThread.h; path = workers/service/context/ServiceWorkerThread.h; sourceTree = SOURCE_ROOT; };
517C87111F8EE72F00EB8076 /* ServiceWorkerThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ServiceWorkerThread.cpp; path = workers/service/context/ServiceWorkerThread.cpp; sourceTree = SOURCE_ROOT; };
517C87161F8FD4D300EB8076 /* ServiceWorkerContextData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ServiceWorkerContextData.cpp; sourceTree = "<group>"; };
517DEEE31DE94ADC00B91644 /* ScrollingMomentumCalculatorMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingMomentumCalculatorMac.mm; sourceTree = "<group>"; };
517DEEE71DE94B0800B91644 /* ScrollingMomentumCalculatorMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingMomentumCalculatorMac.h; sourceTree = "<group>"; };
517FBA17151AA71B00B57959 /* DOMWindowExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowExtension.cpp; sourceTree = "<group>"; };
@@ -19132,6 +19142,17 @@
path = server;
sourceTree = "<group>";
};
517C87071F8E8FF200EB8076 /* context */ = {
isa = PBXGroup;
children = (
517C87081F8EB9BF00EB8076 /* SWContextManager.cpp */,
517C87091F8EB9C000EB8076 /* SWContextManager.h */,
517C87111F8EE72F00EB8076 /* ServiceWorkerThread.cpp */,
517C87101F8EE72E00EB8076 /* ServiceWorkerThread.h */,
);
path = context;
sourceTree = "<group>";
};
5182C24C1F3142090059BA7C /* ServiceWorkers */ = {
isa = PBXGroup;
children = (
@@ -19212,13 +19233,15 @@
51F175441F3EBBF200C74950 /* service */ = {
isa = PBXGroup;
children = (
517C87071F8E8FF200EB8076 /* context */,
517A52EC1F47532D00DCDC0A /* server */,
51F1755B1F3EBC0C00C74950 /* ServiceWorker.cpp */,
51F1755A1F3EBC0C00C74950 /* ServiceWorker.h */,
51F175591F3EBC0C00C74950 /* ServiceWorker.idl */,
51F175581F3EBC0C00C74950 /* ServiceWorkerContainer.cpp */,
51F175571F3EBC0C00C74950 /* ServiceWorkerContainer.h */,
51F175561F3EBC0C00C74950 /* ServiceWorkerContainer.idl */,
517C87161F8FD4D300EB8076 /* ServiceWorkerContextData.cpp */,
51CA7EE71F8832E0003D3131 /* ServiceWorkerContextData.h */,
517A535C1F5899F200DCDC0A /* ServiceWorkerFetchResult.h */,
51F175551F3EBC0C00C74950 /* ServiceWorkerGlobalScope.cpp */,
@@ -28627,6 +28650,7 @@
7C8139AA1ED6604B00CE26E8 /* JSDOMCastedThisErrorBehavior.h in Headers */,
413C2C341BC29A8F0075204C /* JSDOMConstructor.h in Headers */,
930841341CDDB15500B0958C /* JSDOMConvert.h in Headers */,
517C870B1F8EBB2500EB8076 /* SWContextManager.h in Headers */,
7C8E34AD1E4A33AF0054CE23 /* JSDOMConvertAny.h in Headers */,
7C8E34AE1E4A33AF0054CE23 /* JSDOMConvertBase.h in Headers */,
7C8E34AF1E4A33AF0054CE23 /* JSDOMConvertBoolean.h in Headers */,
@@ -30413,6 +30437,7 @@
B22279C50D00BF220071B782 /* SVGExternalResourcesRequired.h in Headers */,
B22279C80D00BF220071B782 /* SVGFEBlendElement.h in Headers */,
B22279CB0D00BF220071B782 /* SVGFEColorMatrixElement.h in Headers */,
51BCCE301F8F179E006BA0ED /* ServiceWorkerThread.h in Headers */,
B22279CE0D00BF220071B782 /* SVGFEComponentTransferElement.h in Headers */,
B22279D10D00BF220071B782 /* SVGFECompositeElement.h in Headers */,
1921327511C0E6BB00456238 /* SVGFEConvolveMatrixElement.h in Headers */,
@@ -31589,6 +31614,7 @@
41D129CF1F3D0EFE00D15E47 /* CacheStorageConnection.cpp in Sources */,
E43AF8E61AC5B7E800CA717E /* CacheValidation.cpp in Sources */,
49AE2D96134EE5F90072920A /* CalculationValue.cpp in Sources */,
517C87181F8FD4D900EB8076 /* ServiceWorkerContextData.cpp in Sources */,
952076041F2675FE007D2AAB /* CallTracer.cpp in Sources */,
415CDAF41E6B8F87004F11EE /* CanvasCaptureMediaStreamTrack.cpp in Sources */,
49484FC1102CF23C00187DD3 /* CanvasGradient.cpp in Sources */,
@@ -32231,6 +32257,7 @@
96ABA42314BCB80E00D56204 /* GraphicsContext3DOpenGLCommon.cpp in Sources */,
B2ED97710B1F55CE00257D0F /* GraphicsContextCG.cpp in Sources */,
B277B4040B22F37C0004BEC6 /* GraphicsContextCocoa.mm in Sources */,
51BCCE2F1F8F1795006BA0ED /* ServiceWorkerThread.cpp in Sources */,
0F580B0C0F12A2690051D689 /* GraphicsLayer.cpp in Sources */,
499B3ED6128CD31400E726C2 /* GraphicsLayerCA.cpp in Sources */,
0FA24D79162DF91900A3F4C0 /* GraphicsLayerUpdater.cpp in Sources */,
@@ -33544,6 +33571,7 @@
C96F5EC61B5872260091EA9D /* MediaSessionInterruptionProviderMac.mm in Sources */,
C90F65551B2253B1002163A1 /* MediaSessionManager.cpp in Sources */,
CD669D681D23364B004D1866 /* MediaSessionManagerCocoa.cpp in Sources */,
517C870A1F8EBB2500EB8076 /* SWContextManager.cpp in Sources */,
07638A9A1884487200E15A1B /* MediaSessionManagerIOS.mm in Sources */,
07EDC3EE1AACB75D00983EB5 /* MediaSessionManagerMac.mm in Sources */,
CD3A495E17A9D01B00274E42 /* MediaSource.cpp in Sources */,
@@ -30,6 +30,7 @@
#include "JSDOMBinding.h"
#include "JSDedicatedWorkerGlobalScope.h"
#include "JSEventTarget.h"
#include "JSServiceWorkerGlobalScope.h"
#include "ScriptSourceCode.h"
#include "WebCoreJSClientData.h"
#include "WorkerConsoleClient.h"
@@ -92,7 +93,26 @@ void WorkerScriptController::initScript()

proxy->setTarget(*m_vm, m_workerGlobalScopeWrapper.get());
proxy->structure()->setGlobalObject(*m_vm, m_workerGlobalScopeWrapper.get());
#if ENABLE(SERVICE_WORKER)
} else if (m_workerGlobalScope->isServiceWorkerGlobalScope()) {
Structure* contextPrototypeStructure = JSServiceWorkerGlobalScopePrototype::createStructure(*m_vm, nullptr, jsNull());
Strong<JSServiceWorkerGlobalScopePrototype> contextPrototype(*m_vm, JSServiceWorkerGlobalScopePrototype::create(*m_vm, nullptr, contextPrototypeStructure));
Structure* structure = JSServiceWorkerGlobalScope::createStructure(*m_vm, nullptr, contextPrototype.get());
auto* proxyStructure = JSProxy::createStructure(*m_vm, nullptr, jsNull(), PureForwardingProxyType);
auto* proxy = JSProxy::create(*m_vm, proxyStructure);

m_workerGlobalScopeWrapper.set(*m_vm, JSServiceWorkerGlobalScope::create(*m_vm, structure, static_cast<ServiceWorkerGlobalScope&>(*m_workerGlobalScope), proxy));
contextPrototypeStructure->setGlobalObject(*m_vm, m_workerGlobalScopeWrapper.get());
ASSERT(structure->globalObject() == m_workerGlobalScopeWrapper);
ASSERT(m_workerGlobalScopeWrapper->structure()->globalObject() == m_workerGlobalScopeWrapper);
contextPrototype->structure()->setGlobalObject(*m_vm, m_workerGlobalScopeWrapper.get());
contextPrototype->structure()->setPrototypeWithoutTransition(*m_vm, JSWorkerGlobalScope::prototype(*m_vm, *m_workerGlobalScopeWrapper.get()));

proxy->setTarget(*m_vm, m_workerGlobalScopeWrapper.get());
proxy->structure()->setGlobalObject(*m_vm, m_workerGlobalScopeWrapper.get());
#endif
}

ASSERT(m_workerGlobalScopeWrapper->globalObject() == m_workerGlobalScopeWrapper);
ASSERT(asObject(m_workerGlobalScopeWrapper->getPrototypeDirect())->globalObject() == m_workerGlobalScopeWrapper);

@@ -32,6 +32,7 @@ RTCDTMFSender conditional=WEB_RTC_DTMF
RTCPeerConnection conditional=WEB_RTC
ServiceWorker conditional=SERVICE_WORKER
ServiceWorkerContainer conditional=SERVICE_WORKER
ServiceWorkerGlobalScope conditional=SERVICE_WORKER
ServiceWorkerRegistration conditional=SERVICE_WORKER
SourceBuffer conditional=MEDIA_SOURCE
SourceBufferList conditional=MEDIA_SOURCE
@@ -59,6 +59,7 @@ class WorkerGlobalScope : public RefCounted<WorkerGlobalScope>, public Supplemen
virtual ~WorkerGlobalScope();

virtual bool isDedicatedWorkerGlobalScope() const { return false; }
virtual bool isServiceWorkerGlobalScope() const { return false; }

const URL& url() const final { return m_url; }
String origin() const;
@@ -0,0 +1,40 @@
/*
* 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 "ServiceWorkerContextData.h"

#if ENABLE(SERVICE_WORKER)

namespace WebCore {

ServiceWorkerContextData ServiceWorkerContextData::isolatedCopy() const
{
return { registrationKey.isolatedCopy(), workerID.isolatedCopy(), script.isolatedCopy(), scriptURL.isolatedCopy() };
}

} // namespace WebCore

#endif // ENABLE(SERVICE_WORKER)

0 comments on commit bab4973

Please sign in to comment.