blob: 716b1a69b8eec1da647201a432692b33897eb78e [file] [log] [blame]
ap@webkit.org90b52e82008-11-06 07:04:47 +00001/*
mark.lam@apple.com03916fe2017-02-28 01:20:54 +00002 * Copyright (C) 2008-2017 Apple Inc. All Rights Reserved.
michaeln@google.com6e104c02012-03-08 03:07:44 +00003 * Copyright (C) 2011, 2012 Google Inc. All Rights Reserved.
ap@webkit.org90b52e82008-11-06 07:04:47 +00004 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 *
mjs@apple.com92047332014-03-15 04:08:27 +000014 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
ap@webkit.org90b52e82008-11-06 07:04:47 +000015 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
mjs@apple.com92047332014-03-15 04:08:27 +000017 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
ap@webkit.org90b52e82008-11-06 07:04:47 +000018 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
joepeck@webkit.org88519292016-10-27 22:18:55 +000024 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ap@webkit.org90b52e82008-11-06 07:04:47 +000025 */
26
27#include "config.h"
ap@webkit.org90b52e82008-11-06 07:04:47 +000028#include "WorkerScriptController.h"
29
benjamin@webkit.org5ea59782012-09-14 01:50:17 +000030#include "JSDOMBinding.h"
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +000031#include "JSDedicatedWorkerGlobalScope.h"
cdumez@apple.comd6209802016-02-15 02:17:33 +000032#include "JSEventTarget.h"
utatane.tea@gmail.com11098d62018-08-06 04:37:10 +000033#include "JSExecState.h"
beidson@apple.com7ce560f2017-10-13 06:44:47 +000034#include "JSServiceWorkerGlobalScope.h"
darin@chromium.org6b412472008-11-24 23:07:38 +000035#include "ScriptSourceCode.h"
weinig@apple.com4ee55852010-03-07 00:38:12 +000036#include "WebCoreJSClientData.h"
commit-queue@webkit.org31e0b1a2016-02-15 21:23:23 +000037#include "WorkerConsoleClient.h"
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +000038#include "WorkerGlobalScope.h"
don.olmstead@sony.com71f34a02018-02-07 05:20:34 +000039#include <JavaScriptCore/Completion.h>
keith_miller@apple.com8af61cf2020-07-20 21:03:16 +000040#include <JavaScriptCore/DeferredWorkTimer.h>
don.olmstead@sony.com71f34a02018-02-07 05:20:34 +000041#include <JavaScriptCore/Exception.h>
42#include <JavaScriptCore/ExceptionHelpers.h>
43#include <JavaScriptCore/GCActivityCallback.h>
justin_michaud@apple.com16d7ba82018-11-08 05:29:59 +000044#include <JavaScriptCore/JSCInlines.h>
don.olmstead@sony.com71f34a02018-02-07 05:20:34 +000045#include <JavaScriptCore/JSLock.h>
don.olmstead@sony.com71f34a02018-02-07 05:20:34 +000046#include <JavaScriptCore/StrongInlines.h>
ap@webkit.org90b52e82008-11-06 07:04:47 +000047
48namespace WebCore {
keith_miller@apple.comce64b732017-10-17 07:10:58 +000049using namespace JSC;
ap@webkit.org90b52e82008-11-06 07:04:47 +000050
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +000051WorkerScriptController::WorkerScriptController(WorkerGlobalScope* workerGlobalScope)
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +000052 : m_vm(VM::create())
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +000053 , m_workerGlobalScope(workerGlobalScope)
54 , m_workerGlobalScopeWrapper(*m_vm)
ap@webkit.org90b52e82008-11-06 07:04:47 +000055{
fpizlo@apple.com8b6ca582016-11-02 22:01:04 +000056 m_vm->heap.acquireAccess(); // It's not clear that we have good discipline for heap access, so turn it on permanently.
fpizlo@apple.com5fa9d962017-01-18 04:22:45 +000057 JSVMClientData::initNormalWorld(m_vm.get());
ap@webkit.org90b52e82008-11-06 07:04:47 +000058}
59
60WorkerScriptController::~WorkerScriptController()
61{
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +000062 JSLockHolder lock(vm());
commit-queue@webkit.org31e0b1a2016-02-15 21:23:23 +000063 if (m_workerGlobalScopeWrapper) {
commit-queue@webkit.org471132e2017-11-29 21:39:56 +000064 m_workerGlobalScopeWrapper->clearDOMGuardedObjects();
commit-queue@webkit.org31e0b1a2016-02-15 21:23:23 +000065 m_workerGlobalScopeWrapper->setConsoleClient(nullptr);
66 m_consoleClient = nullptr;
67 }
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +000068 m_workerGlobalScopeWrapper.clear();
cdumez@apple.comd839ea12015-07-04 19:42:18 +000069 m_vm = nullptr;
ap@webkit.org90b52e82008-11-06 07:04:47 +000070}
71
72void WorkerScriptController::initScript()
73{
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +000074 ASSERT(!m_workerGlobalScopeWrapper);
ap@webkit.org90b52e82008-11-06 07:04:47 +000075
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +000076 JSLockHolder lock(m_vm.get());
ap@webkit.org90b52e82008-11-06 07:04:47 +000077
ggaren@apple.com9d883d32009-03-26 02:12:27 +000078 // Explicitly protect the global object's prototype so it isn't collected
79 // when we allocate the global object. (Once the global object is fully
80 // constructed, it can mark its own prototype.)
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +000081 if (m_workerGlobalScope->isDedicatedWorkerGlobalScope()) {
joepeck@webkit.org88519292016-10-27 22:18:55 +000082 Structure* dedicatedContextPrototypeStructure = JSDedicatedWorkerGlobalScopePrototype::createStructure(*m_vm, nullptr, jsNull());
ysuzuki@apple.com3daa3be2020-03-27 21:25:38 +000083 JSDedicatedWorkerGlobalScopePrototype* dedicatedContextPrototype = JSDedicatedWorkerGlobalScopePrototype::create(*m_vm, nullptr, dedicatedContextPrototypeStructure);
84 JSC::EnsureStillAliveScope protectedDedicatedContextPrototype(dedicatedContextPrototype);
85 Structure* structure = JSDedicatedWorkerGlobalScope::createStructure(*m_vm, nullptr, dedicatedContextPrototype);
cdumez@apple.com12d8c412016-06-08 17:31:12 +000086 auto* proxyStructure = JSProxy::createStructure(*m_vm, nullptr, jsNull(), PureForwardingProxyType);
87 auto* proxy = JSProxy::create(*m_vm, proxyStructure);
dimich@chromium.org0d83cae2009-07-24 19:23:38 +000088
cdumez@apple.com12d8c412016-06-08 17:31:12 +000089 m_workerGlobalScopeWrapper.set(*m_vm, JSDedicatedWorkerGlobalScope::create(*m_vm, structure, static_cast<DedicatedWorkerGlobalScope&>(*m_workerGlobalScope), proxy));
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +000090 dedicatedContextPrototypeStructure->setGlobalObject(*m_vm, m_workerGlobalScopeWrapper.get());
91 ASSERT(structure->globalObject() == m_workerGlobalScopeWrapper);
utatane.tea@gmail.comb860d692018-05-31 06:19:33 +000092 ASSERT(m_workerGlobalScopeWrapper->structure(*m_vm)->globalObject() == m_workerGlobalScopeWrapper);
93 dedicatedContextPrototype->structure(*m_vm)->setGlobalObject(*m_vm, m_workerGlobalScopeWrapper.get());
keith_miller@apple.com0e528c12019-06-25 21:19:21 +000094 auto* workerGlobalScopePrototype = JSWorkerGlobalScope::prototype(*m_vm, *m_workerGlobalScopeWrapper.get());
95 workerGlobalScopePrototype->didBecomePrototype();
96 dedicatedContextPrototype->structure(*m_vm)->setPrototypeWithoutTransition(*m_vm, workerGlobalScopePrototype);
cdumez@apple.com12d8c412016-06-08 17:31:12 +000097
98 proxy->setTarget(*m_vm, m_workerGlobalScopeWrapper.get());
utatane.tea@gmail.comb860d692018-05-31 06:19:33 +000099 proxy->structure(*m_vm)->setGlobalObject(*m_vm, m_workerGlobalScopeWrapper.get());
beidson@apple.com7ce560f2017-10-13 06:44:47 +0000100#if ENABLE(SERVICE_WORKER)
101 } else if (m_workerGlobalScope->isServiceWorkerGlobalScope()) {
102 Structure* contextPrototypeStructure = JSServiceWorkerGlobalScopePrototype::createStructure(*m_vm, nullptr, jsNull());
ysuzuki@apple.com3daa3be2020-03-27 21:25:38 +0000103 JSServiceWorkerGlobalScopePrototype* contextPrototype = JSServiceWorkerGlobalScopePrototype::create(*m_vm, nullptr, contextPrototypeStructure);
104 JSC::EnsureStillAliveScope protectedContextPrototype(contextPrototype);
105 Structure* structure = JSServiceWorkerGlobalScope::createStructure(*m_vm, nullptr, contextPrototype);
beidson@apple.com7ce560f2017-10-13 06:44:47 +0000106 auto* proxyStructure = JSProxy::createStructure(*m_vm, nullptr, jsNull(), PureForwardingProxyType);
107 auto* proxy = JSProxy::create(*m_vm, proxyStructure);
108
109 m_workerGlobalScopeWrapper.set(*m_vm, JSServiceWorkerGlobalScope::create(*m_vm, structure, static_cast<ServiceWorkerGlobalScope&>(*m_workerGlobalScope), proxy));
110 contextPrototypeStructure->setGlobalObject(*m_vm, m_workerGlobalScopeWrapper.get());
111 ASSERT(structure->globalObject() == m_workerGlobalScopeWrapper);
112 ASSERT(m_workerGlobalScopeWrapper->structure()->globalObject() == m_workerGlobalScopeWrapper);
utatane.tea@gmail.comb860d692018-05-31 06:19:33 +0000113 contextPrototype->structure(*m_vm)->setGlobalObject(*m_vm, m_workerGlobalScopeWrapper.get());
keith_miller@apple.com0e528c12019-06-25 21:19:21 +0000114 auto* workerGlobalScopePrototype = JSWorkerGlobalScope::prototype(*m_vm, *m_workerGlobalScopeWrapper.get());
115 workerGlobalScopePrototype->didBecomePrototype();
116 contextPrototype->structure(*m_vm)->setPrototypeWithoutTransition(*m_vm, workerGlobalScopePrototype);
beidson@apple.com7ce560f2017-10-13 06:44:47 +0000117
118 proxy->setTarget(*m_vm, m_workerGlobalScopeWrapper.get());
utatane.tea@gmail.comb860d692018-05-31 06:19:33 +0000119 proxy->structure(*m_vm)->setGlobalObject(*m_vm, m_workerGlobalScopeWrapper.get());
beidson@apple.com7ce560f2017-10-13 06:44:47 +0000120#endif
atwilson@chromium.org5790d732009-08-06 15:30:37 +0000121 }
beidson@apple.com7ce560f2017-10-13 06:44:47 +0000122
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +0000123 ASSERT(m_workerGlobalScopeWrapper->globalObject() == m_workerGlobalScopeWrapper);
sbarati@apple.comf36537e2017-10-20 07:50:08 +0000124 ASSERT(asObject(m_workerGlobalScopeWrapper->getPrototypeDirect(*m_vm))->globalObject() == m_workerGlobalScopeWrapper);
commit-queue@webkit.org31e0b1a2016-02-15 21:23:23 +0000125
ysuzuki@apple.com1d8e24d2019-08-19 06:59:40 +0000126 m_consoleClient = makeUnique<WorkerConsoleClient>(*m_workerGlobalScope);
commit-queue@webkit.org31e0b1a2016-02-15 21:23:23 +0000127 m_workerGlobalScopeWrapper->setConsoleClient(m_consoleClient.get());
ap@webkit.org90b52e82008-11-06 07:04:47 +0000128}
129
beidson@apple.com3dfb9af2017-11-01 21:23:52 +0000130void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, String* returnedExceptionMessage)
ap@webkit.org90b52e82008-11-06 07:04:47 +0000131{
dimich@chromium.orgae6b7772011-04-14 22:14:01 +0000132 if (isExecutionForbidden())
benjamin@webkit.org621743c2012-02-02 04:11:09 +0000133 return;
dimich@chromium.orgae6b7772011-04-14 22:14:01 +0000134
darin@apple.com85704942016-10-08 23:01:27 +0000135 NakedPtr<JSC::Exception> exception;
beidson@apple.com3dfb9af2017-11-01 21:23:52 +0000136 evaluate(sourceCode, exception, returnedExceptionMessage);
mark.lam@apple.com6ed08272015-06-05 18:52:12 +0000137 if (exception) {
ggaren@apple.com9a9a4b52013-04-18 19:32:17 +0000138 JSLockHolder lock(vm());
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +0000139 reportException(m_workerGlobalScopeWrapper.get(), exception);
oliver@apple.com991c37e2009-03-10 09:44:30 +0000140 }
oliver@apple.com991c37e2009-03-10 09:44:30 +0000141}
142
beidson@apple.com3dfb9af2017-11-01 21:23:52 +0000143void WorkerScriptController::evaluate(const ScriptSourceCode& sourceCode, NakedPtr<JSC::Exception>& returnedException, String* returnedExceptionMessage)
oliver@apple.com991c37e2009-03-10 09:44:30 +0000144{
dimich@chromium.orgae6b7772011-04-14 22:14:01 +0000145 if (isExecutionForbidden())
benjamin@webkit.org621743c2012-02-02 04:11:09 +0000146 return;
ap@webkit.org6b9d4122008-11-22 07:42:44 +0000147
ap@webkit.org3568f132008-11-13 07:27:12 +0000148 initScriptIfNeeded();
ap@webkit.org3568f132008-11-13 07:27:12 +0000149
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +0000150 auto& globalObject = *m_workerGlobalScopeWrapper.get();
151 VM& vm = globalObject.vm();
darin@apple.com0b38bee2018-02-08 06:06:29 +0000152 JSLockHolder lock { vm };
weinig@apple.comf41a7da2011-09-08 22:38:44 +0000153
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +0000154 JSExecState::profiledEvaluate(&globalObject, JSC::ProfilingReason::Other, sourceCode.jsSourceCode(), m_workerGlobalScopeWrapper->globalThis(), returnedException);
weinig@apple.com76c11462011-09-11 05:16:09 +0000155
keith_miller@apple.com45da7602017-01-27 01:47:52 +0000156 if ((returnedException && isTerminatedExecutionException(vm, returnedException)) || isTerminatingExecution()) {
dimich@chromium.orgae6b7772011-04-14 22:14:01 +0000157 forbidExecution();
benjamin@webkit.org621743c2012-02-02 04:11:09 +0000158 return;
dimich@chromium.orgae6b7772011-04-14 22:14:01 +0000159 }
160
mark.lam@apple.com6c5e0762015-06-16 20:51:04 +0000161 if (returnedException) {
darin@apple.com0b38bee2018-02-08 06:06:29 +0000162 if (m_workerGlobalScope->canIncludeErrorDetails(sourceCode.cachedScript(), sourceCode.url().string())) {
163 // FIXME: It's not great that this can run arbitrary code to string-ify the value of the exception.
164 // Do we need to do anything to handle that properly, if it, say, raises another exception?
165 if (returnedExceptionMessage)
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +0000166 *returnedExceptionMessage = returnedException->value().toWTFString(&globalObject);
darin@apple.com0b38bee2018-02-08 06:06:29 +0000167 } else {
168 // Overwrite the detailed error with a generic error.
utatane.tea@gmail.com84077632018-06-23 08:39:34 +0000169 String genericErrorMessage { "Script error."_s };
darin@apple.com0b38bee2018-02-08 06:06:29 +0000170 if (returnedExceptionMessage)
171 *returnedExceptionMessage = genericErrorMessage;
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +0000172 returnedException = JSC::Exception::create(vm, createError(&globalObject, genericErrorMessage));
darin@apple.com0b38bee2018-02-08 06:06:29 +0000173 }
levin@chromium.org8544e5d2011-02-04 00:48:28 +0000174 }
ap@webkit.org90b52e82008-11-06 07:04:47 +0000175}
176
mark.lam@apple.com6ed08272015-06-05 18:52:12 +0000177void WorkerScriptController::setException(JSC::Exception* exception)
oliver@apple.com991c37e2009-03-10 09:44:30 +0000178{
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +0000179 JSC::JSGlobalObject* lexicalGlobalObject = m_workerGlobalScopeWrapper.get();
180 VM& vm = lexicalGlobalObject->vm();
mark.lam@apple.com284f4562016-08-30 20:54:54 +0000181 auto scope = DECLARE_THROW_SCOPE(vm);
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +0000182 throwException(lexicalGlobalObject, scope, exception);
oliver@apple.com991c37e2009-03-10 09:44:30 +0000183}
184
dimich@chromium.orgae6b7772011-04-14 22:14:01 +0000185void WorkerScriptController::scheduleExecutionTermination()
ap@webkit.org6b9d4122008-11-22 07:42:44 +0000186{
mark.lam@apple.com25199882017-05-15 20:34:13 +0000187 if (m_isTerminatingExecution)
188 return;
189
mark.lam@apple.comf842cd82017-03-09 19:08:46 +0000190 {
191 // The mutex provides a memory barrier to ensure that once
192 // termination is scheduled, isTerminatingExecution() will
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +0000193 // accurately reflect that lexicalGlobalObject when called from another thread.
mark.lam@apple.comf842cd82017-03-09 19:08:46 +0000194 LockHolder locker(m_scheduledTerminationMutex);
195 m_isTerminatingExecution = true;
196 }
mark.lam@apple.com03916fe2017-02-28 01:20:54 +0000197 m_vm->notifyNeedTermination();
dimich@chromium.orgae6b7772011-04-14 22:14:01 +0000198}
199
mark.lam@apple.com127015c2015-08-27 02:49:52 +0000200bool WorkerScriptController::isTerminatingExecution() const
michaeln@google.com6e104c02012-03-08 03:07:44 +0000201{
202 // See comments in scheduleExecutionTermination regarding mutex usage.
fpizlo@apple.com73985982015-08-18 19:31:28 +0000203 LockHolder locker(m_scheduledTerminationMutex);
mark.lam@apple.com127015c2015-08-27 02:49:52 +0000204 return m_isTerminatingExecution;
michaeln@google.com6e104c02012-03-08 03:07:44 +0000205}
206
dimich@chromium.orgae6b7772011-04-14 22:14:01 +0000207void WorkerScriptController::forbidExecution()
208{
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +0000209 ASSERT(m_workerGlobalScope->isContextThread());
ap@webkit.orgf809c4d2008-12-03 15:25:08 +0000210 m_executionForbidden = true;
dimich@chromium.orgae6b7772011-04-14 22:14:01 +0000211}
212
213bool WorkerScriptController::isExecutionForbidden() const
214{
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +0000215 ASSERT(m_workerGlobalScope->isContextThread());
dimich@chromium.orgae6b7772011-04-14 22:14:01 +0000216 return m_executionForbidden;
ap@webkit.org6b9d4122008-11-22 07:42:44 +0000217}
218
commit-queue@webkit.org7415e102012-09-14 23:33:20 +0000219void WorkerScriptController::disableEval(const String& errorMessage)
weinig@apple.com76f3d932011-10-05 00:52:50 +0000220{
221 initScriptIfNeeded();
jfbastien@apple.com7b29cef2017-06-29 18:49:18 +0000222 JSLockHolder lock{vm()};
weinig@apple.com76f3d932011-10-05 00:52:50 +0000223
ch.dumez@sisa.samsung.com14792a62013-06-27 06:21:54 +0000224 m_workerGlobalScopeWrapper->setEvalEnabled(false, errorMessage);
weinig@apple.com76f3d932011-10-05 00:52:50 +0000225}
226
jfbastien@apple.com7b29cef2017-06-29 18:49:18 +0000227void WorkerScriptController::disableWebAssembly(const String& errorMessage)
228{
229 initScriptIfNeeded();
230 JSLockHolder lock{vm()};
231
232 m_workerGlobalScopeWrapper->setWebAssemblyEnabled(false, errorMessage);
233}
234
fpizlo@apple.com8b6ca582016-11-02 22:01:04 +0000235void WorkerScriptController::releaseHeapAccess()
236{
237 m_vm->heap.releaseAccess();
238}
239
240void WorkerScriptController::acquireHeapAccess()
241{
242 m_vm->heap.acquireAccess();
243}
244
sbarati@apple.com492e4432017-04-14 02:10:17 +0000245void WorkerScriptController::addTimerSetNotification(JSC::JSRunLoopTimer::TimerNotificationCallback callback)
246{
247 auto processTimer = [&] (JSRunLoopTimer* timer) {
248 if (!timer)
249 return;
250 timer->addTimerSetNotification(callback);
251 };
252
253 processTimer(m_vm->heap.fullActivityCallback());
254 processTimer(m_vm->heap.edenActivityCallback());
keith_miller@apple.com8af61cf2020-07-20 21:03:16 +0000255 processTimer(m_vm->deferredWorkTimer.ptr());
sbarati@apple.com492e4432017-04-14 02:10:17 +0000256}
257
258void WorkerScriptController::removeTimerSetNotification(JSC::JSRunLoopTimer::TimerNotificationCallback callback)
259{
260 auto processTimer = [&] (JSRunLoopTimer* timer) {
261 if (!timer)
262 return;
263 timer->removeTimerSetNotification(callback);
264 };
265
266 processTimer(m_vm->heap.fullActivityCallback());
267 processTimer(m_vm->heap.edenActivityCallback());
keith_miller@apple.com8af61cf2020-07-20 21:03:16 +0000268 processTimer(m_vm->deferredWorkTimer.ptr());
sbarati@apple.com492e4432017-04-14 02:10:17 +0000269}
270
commit-queue@webkit.orgb721bb372012-11-02 10:24:40 +0000271void WorkerScriptController::attachDebugger(JSC::Debugger* debugger)
272{
273 initScriptIfNeeded();
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +0000274 debugger->attach(m_workerGlobalScopeWrapper.get());
commit-queue@webkit.orgb721bb372012-11-02 10:24:40 +0000275}
276
277void WorkerScriptController::detachDebugger(JSC::Debugger* debugger)
278{
ysuzuki@apple.com52e98bb2019-10-22 09:24:48 +0000279 debugger->detach(m_workerGlobalScopeWrapper.get(), JSC::Debugger::TerminatingDebuggingSession);
commit-queue@webkit.orgb721bb372012-11-02 10:24:40 +0000280}
281
ap@webkit.org90b52e82008-11-06 07:04:47 +0000282} // namespace WebCore