haikuwebkit/Source/WebCore/inspector/WorkerDebugger.cpp

96 lines
3.1 KiB
C++
Raw Permalink Normal View History

Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
/*
* Copyright (c) 2011 Google Inc. All rights reserved.
* Copyright (c) 2013-2016 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:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
* OWNER OR 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"
Web Inspector: rename `ScriptDebugServer` subclasses/methods https://bugs.webkit.org/show_bug.cgi?id=215363 <rdar://problem/67310441> Reviewed by Brian Burg. r266074 merged `Inspector::ScriptDebugServer` into `JSC::Debugger`. All subclasses and functions should be renamed to match this change. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectDebugger.h: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h. * inspector/JSGlobalObjectDebugger.cpp: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp. * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.cpp: * inspector/remote/RemoteInspectionTarget.cpp: * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm: Source/WebCore: * Headers.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorController.h: * inspector/InspectorController.cpp: * inspector/PageDebugger.h: Renamed from Source/WebCore/inspector/PageScriptDebugServer.h. * inspector/PageDebugger.cpp: Renamed from Source/WebCore/inspector/PageScriptDebugServer.cpp. * inspector/mac/PageDebuggerMac.mm: Renamed from Source/WebCore/inspector/mac/PageScriptDebugServerMac.mm. * inspector/WorkerDebugger.h: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.h. * inspector/WorkerDebugger.cpp: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.cpp. * inspector/WorkerInspectorController.h: * inspector/WorkerInspectorController.cpp: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/page/PageDebuggerAgent.cpp: Canonical link: https://commits.webkit.org/228554@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 18:40:30 +00:00
#include "WorkerDebugger.h"
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
JSDOMBinding is too big. Split it up! https://bugs.webkit.org/show_bug.cgi?id=167601 Reviewed by Darin Adler. Source/WebCore: Splits JSDOMBinding.h/cpp up a bit by splitting out: - JSDOMBindingCaller.h - JSDOMBindingSecurity.h/cpp - JSDOMExceptionHandling.h/cpp - JSDOMWrapperCache.h/cpp Also: - Moves all constructor objects to JSDOMConstructor.h/cpp, - Moves special DOMWindow accessors to JSDOMWindowBase. - Deletes unused CallbackFunction.h/cpp * CMakeLists.txt: * Modules/webdatabase/Database.cpp: * WebCore.xcodeproj/project.pbxproj: * bindings/js/CallbackFunction.cpp: Removed. * bindings/js/CallbackFunction.h: Removed. * bindings/js/DOMConstructorWithDocument.h: Removed. * bindings/js/JSCryptoCustom.cpp: * bindings/js/JSCustomXPathNSResolver.cpp: * bindings/js/JSDOMBinding.cpp: * bindings/js/JSDOMBinding.h: * bindings/js/JSDOMBindingCaller.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h. * bindings/js/JSDOMBindingSecurity.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp. * bindings/js/JSDOMBindingSecurity.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h. * bindings/js/JSDOMConstructor.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp. * bindings/js/JSDOMConstructor.h: * bindings/js/JSDOMConvert.h: * bindings/js/JSDOMExceptionHandling.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp. * bindings/js/JSDOMExceptionHandling.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h. * bindings/js/JSDOMWindowBase.cpp: (WebCore::callerDOMWindow): Moved from JSDOMBinding.h (WebCore::activeDOMWindow): Moved from JSDOMBinding.h (WebCore::firstDOMWindow): Moved from JSDOMBinding.h * bindings/js/JSDOMWindowBase.h: * bindings/js/JSDOMWindowCustom.cpp: * bindings/js/JSDOMWindowProperties.cpp: * bindings/js/JSDOMWrapperCache.cpp: Copied from Source/WebCore/bindings/js/JSDOMBinding.cpp. * bindings/js/JSDOMWrapperCache.h: Copied from Source/WebCore/bindings/js/JSDOMBinding.h. * bindings/js/JSEventTargetCustom.h: * bindings/js/JSHTMLElementCustom.cpp: * bindings/js/JSLocationCustom.cpp: * bindings/js/JSMutationObserverCustom.cpp: * bindings/js/JSSQLStatementErrorCallbackCustom.cpp: * bindings/js/JSStorageCustom.cpp: * bindings/js/JSWorkerCustom.cpp: * bindings/js/JSXPathNSResolverCustom.cpp: * bindings/js/ScheduledAction.cpp: * bindings/js/ScriptController.cpp: * bindings/js/ScriptController.h: * bindings/js/ScriptGlobalObject.cpp: (WebCore::ScriptGlobalObject::set): * bindings/js/StructuredClone.cpp: * bindings/scripts/CodeGeneratorJS.pm: (GenerateImplementation): (GenerateCallWith): (GenerateParametersCheck): (GenerateCallbackImplementationContent): (NativeToJSValue): * bridge/objc/WebScriptObject.mm: * html/HTMLFrameElementBase.cpp: * html/HTMLVideoElement.cpp: * inspector/InspectorController.cpp: * inspector/InspectorDOMAgent.cpp: * inspector/PageScriptDebugServer.cpp: * inspector/WorkerScriptDebugServer.cpp: Source/WebKit2: * Shared/WebCoreArgumentCoders.cpp: Replace include of JSDOMBinding with JSDOMExceptionHandling. Canonical link: https://commits.webkit.org/184643@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211403 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-01-31 03:37:34 +00:00
#include "JSDOMExceptionHandling.h"
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
#include "Timer.h"
Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope https://bugs.webkit.org/show_bug.cgi?id=218108 Reviewed by Darin Adler and Devin Rousso. Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope, in preparation for Worklets support. This will allow us to reuse this code when we add Web Inspector support for Worklets. No new tests, no behavior change yet. * Modules/webaudio/AudioWorkletThread.cpp: (WebCore::AudioWorkletThread::workerDebuggerProxy const): * Modules/webaudio/AudioWorkletThread.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::instrumentingAgentsForWebGPUDevice): (WebCore::InspectorInstrumentation::consoleAgentEnabled): (WebCore::InspectorInstrumentation::timelineAgentTracking): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didClearWindowObjectInWorld): (WebCore::InspectorInstrumentation::isDebuggerPaused): (WebCore::InspectorInstrumentation::identifierForNode): (WebCore::InspectorInstrumentation::addEventListenersToNode): (WebCore::InspectorInstrumentation::willInsertDOMNode): (WebCore::InspectorInstrumentation::didInsertDOMNode): (WebCore::InspectorInstrumentation::willRemoveDOMNode): (WebCore::InspectorInstrumentation::didRemoveDOMNode): (WebCore::InspectorInstrumentation::willModifyDOMAttr): (WebCore::InspectorInstrumentation::didModifyDOMAttr): (WebCore::InspectorInstrumentation::didRemoveDOMAttr): (WebCore::InspectorInstrumentation::willInvalidateStyleAttr): (WebCore::InspectorInstrumentation::didInvalidateStyleAttr): (WebCore::InspectorInstrumentation::documentDetached): (WebCore::InspectorInstrumentation::frameWindowDiscarded): (WebCore::InspectorInstrumentation::mediaQueryResultChanged): (WebCore::InspectorInstrumentation::activeStyleSheetsUpdated): (WebCore::InspectorInstrumentation::didPushShadowRoot): (WebCore::InspectorInstrumentation::willPopShadowRoot): (WebCore::InspectorInstrumentation::didChangeCustomElementState): (WebCore::InspectorInstrumentation::pseudoElementCreated): (WebCore::InspectorInstrumentation::pseudoElementDestroyed): (WebCore::InspectorInstrumentation::didCreateNamedFlow): (WebCore::InspectorInstrumentation::willRemoveNamedFlow): (WebCore::InspectorInstrumentation::didChangeRegionOverset): (WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::mouseDidMoveOverElement): (WebCore::InspectorInstrumentation::handleTouchEvent): (WebCore::InspectorInstrumentation::handleMousePress): (WebCore::InspectorInstrumentation::forcePseudoState): (WebCore::InspectorInstrumentation::characterDataModified): (WebCore::InspectorInstrumentation::willSendXMLHttpRequest): (WebCore::InspectorInstrumentation::willFetch): (WebCore::InspectorInstrumentation::didInstallTimer): (WebCore::InspectorInstrumentation::didRemoveTimer): (WebCore::InspectorInstrumentation::didAddEventListener): (WebCore::InspectorInstrumentation::willRemoveEventListener): (WebCore::InspectorInstrumentation::isEventListenerDisabled): (WebCore::InspectorInstrumentation::willPostMessage): (WebCore::InspectorInstrumentation::didPostMessage): (WebCore::InspectorInstrumentation::didFailPostMessage): (WebCore::InspectorInstrumentation::willDispatchPostMessage): (WebCore::InspectorInstrumentation::didDispatchPostMessage): (WebCore::InspectorInstrumentation::willCallFunction): (WebCore::InspectorInstrumentation::didCallFunction): (WebCore::InspectorInstrumentation::willDispatchEvent): (WebCore::InspectorInstrumentation::didDispatchEvent): (WebCore::InspectorInstrumentation::willHandleEvent): (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::willDispatchEventOnWindow): (WebCore::InspectorInstrumentation::didDispatchEventOnWindow): (WebCore::InspectorInstrumentation::eventDidResetAfterDispatch): (WebCore::InspectorInstrumentation::willEvaluateScript): (WebCore::InspectorInstrumentation::didEvaluateScript): (WebCore::InspectorInstrumentation::willFireTimer): (WebCore::InspectorInstrumentation::didFireTimer): (WebCore::InspectorInstrumentation::didInvalidateLayout): (WebCore::InspectorInstrumentation::willLayout): (WebCore::InspectorInstrumentation::didLayout): (WebCore::InspectorInstrumentation::didScroll): (WebCore::InspectorInstrumentation::willComposite): (WebCore::InspectorInstrumentation::didComposite): (WebCore::InspectorInstrumentation::willPaint): (WebCore::InspectorInstrumentation::didPaint): (WebCore::InspectorInstrumentation::willRecalculateStyle): (WebCore::InspectorInstrumentation::didRecalculateStyle): (WebCore::InspectorInstrumentation::didScheduleStyleRecalculation): (WebCore::InspectorInstrumentation::applyUserAgentOverride): (WebCore::InspectorInstrumentation::applyEmulatedMedia): (WebCore::InspectorInstrumentation::willSendRequest): (WebCore::InspectorInstrumentation::willSendRequestOfType): (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache): (WebCore::InspectorInstrumentation::didReceiveResourceResponse): (WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponse): (WebCore::InspectorInstrumentation::didReceiveData): (WebCore::InspectorInstrumentation::didFinishLoading): (WebCore::InspectorInstrumentation::didFailLoading): (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied): (WebCore::InspectorInstrumentation::continueWithPolicyDownload): (WebCore::InspectorInstrumentation::continueWithPolicyIgnore): (WebCore::InspectorInstrumentation::willLoadXHRSynchronously): (WebCore::InspectorInstrumentation::didLoadXHRSynchronously): (WebCore::InspectorInstrumentation::scriptImported): (WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSP): (WebCore::InspectorInstrumentation::didReceiveScriptResponse): (WebCore::InspectorInstrumentation::domContentLoadedEventFired): (WebCore::InspectorInstrumentation::loadEventFired): (WebCore::InspectorInstrumentation::frameDetachedFromParent): (WebCore::InspectorInstrumentation::didCommitLoad): (WebCore::InspectorInstrumentation::frameDocumentUpdated): (WebCore::InspectorInstrumentation::loaderDetachedFromFrame): (WebCore::InspectorInstrumentation::frameStartedLoading): (WebCore::InspectorInstrumentation::frameStoppedLoading): (WebCore::InspectorInstrumentation::frameScheduledNavigation): (WebCore::InspectorInstrumentation::frameClearedScheduledNavigation): (WebCore::InspectorInstrumentation::defaultAppearanceDidChange): (WebCore::InspectorInstrumentation::willIntercept): (WebCore::InspectorInstrumentation::shouldInterceptRequest): (WebCore::InspectorInstrumentation::shouldInterceptResponse): (WebCore::InspectorInstrumentation::interceptRequest): (WebCore::InspectorInstrumentation::interceptResponse): (WebCore::InspectorInstrumentation::didOpenDatabase): (WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent): (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStart): (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::didCreateWebSocket): (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest): (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorInstrumentation::didCloseWebSocket): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrame): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrameError): (WebCore::InspectorInstrumentation::didSendWebSocketFrame): (WebCore::InspectorInstrumentation::didHandleMemoryPressure): (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes): (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext): (WebCore::InspectorInstrumentation::didChangeCanvasMemory): (WebCore::InspectorInstrumentation::recordCanvasAction): (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame): (WebCore::InspectorInstrumentation::didEnableExtension): (WebCore::InspectorInstrumentation::didCreateWebGLProgram): (WebCore::InspectorInstrumentation::willDestroyWebGLProgram): (WebCore::InspectorInstrumentation::isWebGLProgramDisabled): (WebCore::InspectorInstrumentation::isWebGLProgramHighlighted): (WebCore::InspectorInstrumentation::willConfigureSwapChain): (WebCore::InspectorInstrumentation::willDestroyWebGPUPipeline): (WebCore::InspectorInstrumentation::willApplyKeyframeEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationName): (WebCore::InspectorInstrumentation::didSetWebAnimationEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTiming): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTarget): (WebCore::InspectorInstrumentation::didCreateWebAnimation): (WebCore::InspectorInstrumentation::willDestroyWebAnimation): (WebCore::InspectorInstrumentation::networkStateChanged): (WebCore::InspectorInstrumentation::updateApplicationCacheStatus): (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore::InspectorInstrumentation::consoleCount): (WebCore::InspectorInstrumentation::consoleCountReset): (WebCore::InspectorInstrumentation::takeHeapSnapshot): (WebCore::InspectorInstrumentation::startConsoleTiming): (WebCore::InspectorInstrumentation::logConsoleTiming): (WebCore::InspectorInstrumentation::stopConsoleTiming): (WebCore::InspectorInstrumentation::consoleTimeStamp): (WebCore::InspectorInstrumentation::startProfiling): (WebCore::InspectorInstrumentation::stopProfiling): (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas): (WebCore::InspectorInstrumentation::consoleStopRecordingCanvas): (WebCore::InspectorInstrumentation::didRequestAnimationFrame): (WebCore::InspectorInstrumentation::didCancelAnimationFrame): (WebCore::InspectorInstrumentation::willFireAnimationFrame): (WebCore::InspectorInstrumentation::didFireAnimationFrame): (WebCore::InspectorInstrumentation::willFireObserverCallback): (WebCore::InspectorInstrumentation::didFireObserverCallback): (WebCore::InspectorInstrumentation::layerTreeDidChange): (WebCore::InspectorInstrumentation::renderLayerDestroyed): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForFrame): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForDocument): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. * inspector/InspectorWebAgentBase.h: (WebCore::WorkerAgentContext::WorkerAgentContext): * inspector/WorkerDebugger.cpp: (WebCore::WorkerDebugger::WorkerDebugger): (WebCore::WorkerDebugger::attachDebugger): (WebCore::WorkerDebugger::detachDebugger): (WebCore::WorkerDebugger::runEventLoopWhilePaused): * inspector/WorkerDebugger.h: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::workerAgentContext): (WebCore::WorkerInspectorController::createLazyAgents): (WebCore::WorkerInspectorController::vm): * inspector/WorkerInspectorController.h: * inspector/WorkerToPageFrontendChannel.h: * inspector/agents/worker/ServiceWorkerAgent.cpp: (WebCore::ServiceWorkerAgent::ServiceWorkerAgent): * inspector/agents/worker/WorkerAuditAgent.cpp: (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/agents/worker/WorkerAuditAgent.h: * inspector/agents/worker/WorkerConsoleAgent.cpp: (WebCore::WorkerConsoleAgent::WorkerConsoleAgent): * inspector/agents/worker/WorkerDebuggerAgent.cpp: (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent): (WebCore::WorkerDebuggerAgent::breakpointActionLog): (WebCore::WorkerDebuggerAgent::injectedScriptForEval): * inspector/agents/worker/WorkerDebuggerAgent.h: * inspector/agents/worker/WorkerNetworkAgent.cpp: (WebCore::WorkerNetworkAgent::WorkerNetworkAgent): (WebCore::WorkerNetworkAgent::setResourceCachingDisabledInternal): (WebCore::WorkerNetworkAgent::scriptExecutionContext): * inspector/agents/worker/WorkerNetworkAgent.h: * inspector/agents/worker/WorkerRuntimeAgent.cpp: (WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent): (WebCore::WorkerRuntimeAgent::injectedScriptForEval): * inspector/agents/worker/WorkerRuntimeAgent.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::prepareForDestruction): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController const): Deleted. * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): (WebCore::WorkerOrWorkletGlobalScope::prepareForDestruction): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::inspectorController const): * workers/WorkerOrWorkletThread.h: * workers/WorkerThread.h: (WebCore::WorkerThread::workerDebuggerProxy const): Deleted. Canonical link: https://commits.webkit.org/230818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-23 01:00:04 +00:00
#include "WorkerOrWorkletGlobalScope.h"
#include "WorkerOrWorkletScriptController.h"
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
#include "WorkerRunLoop.h"
#include "WorkerThread.h"
Remove WebCore/ForwardingHeaders directory https://bugs.webkit.org/show_bug.cgi?id=182347 Reviewed by Keith Miller. Source/ThirdParty: * gtest/CMakeLists.txt: * gtest/include/gtest/internal/gtest-port.h: Source/WebCore: No new tests. No change in behavior. * CMakeLists.txt: * ForwardingHeaders/bindings/ScriptFunctionCall.h: Removed. * ForwardingHeaders/bindings/ScriptObject.h: Removed. * ForwardingHeaders/bindings/ScriptValue.h: Removed. * ForwardingHeaders/builtins/BuiltinNames.h: Removed. * ForwardingHeaders/builtins/BuiltinUtils.h: Removed. * ForwardingHeaders/builtins/JSCBuiltins.h: Removed. * ForwardingHeaders/bytecode/CodeBlock.h: Removed. * ForwardingHeaders/bytecode/SpeculatedType.h: Removed. * ForwardingHeaders/bytecode/UnlinkedFunctionExecutable.h: Removed. * ForwardingHeaders/debugger/Debugger.h: Removed. * ForwardingHeaders/domjit/DOMJITAbstractHeap.h: Removed. * ForwardingHeaders/domjit/DOMJITEffect.h: Removed. * ForwardingHeaders/domjit/DOMJITGetterSetter.h: Removed. * ForwardingHeaders/domjit/DOMJITHeapRange.h: Removed. * ForwardingHeaders/domjit/DOMJITSignature.h: Removed. * ForwardingHeaders/heap/BlockDirectoryInlines.h: Removed. * ForwardingHeaders/heap/DeleteAllCodeEffort.h: Removed. * ForwardingHeaders/heap/FastMallocAlignedMemoryAllocator.h: Removed. * ForwardingHeaders/heap/GCActivityCallback.h: Removed. * ForwardingHeaders/heap/GCFinalizationCallback.h: Removed. * ForwardingHeaders/heap/HandleTypes.h: Removed. * ForwardingHeaders/heap/Heap.h: Removed. * ForwardingHeaders/heap/HeapInlines.h: Removed. * ForwardingHeaders/heap/HeapObserver.h: Removed. * ForwardingHeaders/heap/IncrementalSweeper.h: Removed. * ForwardingHeaders/heap/LockDuringMarking.h: Removed. * ForwardingHeaders/heap/MachineStackMarker.h: Removed. * ForwardingHeaders/heap/MarkedBlockInlines.h: Removed. * ForwardingHeaders/heap/MarkingConstraint.h: Removed. * ForwardingHeaders/heap/RunningScope.h: Removed. * ForwardingHeaders/heap/SimpleMarkingConstraint.h: Removed. * ForwardingHeaders/heap/SlotVisitor.h: Removed. * ForwardingHeaders/heap/SlotVisitorInlines.h: Removed. * ForwardingHeaders/heap/Strong.h: Removed. * ForwardingHeaders/heap/StrongInlines.h: Removed. * ForwardingHeaders/heap/SubspaceInlines.h: Removed. * ForwardingHeaders/heap/ThreadLocalCache.h: Removed. * ForwardingHeaders/heap/Weak.h: Removed. * ForwardingHeaders/heap/WeakInlines.h: Removed. * ForwardingHeaders/inspector/ConsoleMessage.h: Removed. * ForwardingHeaders/inspector/ContentSearchUtilities.h: Removed. * ForwardingHeaders/inspector/IdentifiersFactory.h: Removed. * ForwardingHeaders/inspector/InjectedScript.h: Removed. * ForwardingHeaders/inspector/InjectedScriptBase.h: Removed. * ForwardingHeaders/inspector/InjectedScriptHost.h: Removed. * ForwardingHeaders/inspector/InjectedScriptManager.h: Removed. * ForwardingHeaders/inspector/InjectedScriptModule.h: Removed. * ForwardingHeaders/inspector/InspectorAgentBase.h: Removed. * ForwardingHeaders/inspector/InspectorAgentRegistry.h: Removed. * ForwardingHeaders/inspector/InspectorBackendDispatcher.h: Removed. * ForwardingHeaders/inspector/InspectorBackendDispatchers.h: Removed. * ForwardingHeaders/inspector/InspectorEnvironment.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendChannel.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendDispatchers.h: Removed. * ForwardingHeaders/inspector/InspectorFrontendRouter.h: Removed. * ForwardingHeaders/inspector/InspectorProtocolObjects.h: Removed. * ForwardingHeaders/inspector/InspectorProtocolTypes.h: Removed. * ForwardingHeaders/inspector/PerGlobalObjectWrapperWorld.h: Removed. * ForwardingHeaders/inspector/ScriptArguments.h: Removed. * ForwardingHeaders/inspector/ScriptBreakpoint.h: Removed. * ForwardingHeaders/inspector/ScriptCallFrame.h: Removed. * ForwardingHeaders/inspector/ScriptCallStack.h: Removed. * ForwardingHeaders/inspector/ScriptCallStackFactory.h: Removed. * ForwardingHeaders/inspector/ScriptDebugListener.h: Removed. * ForwardingHeaders/inspector/ScriptDebugServer.h: Removed. * ForwardingHeaders/inspector/agents/InspectorAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorConsoleAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorDebuggerAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorHeapAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorRuntimeAgent.h: Removed. * ForwardingHeaders/inspector/agents/InspectorScriptProfilerAgent.h: Removed. * ForwardingHeaders/interpreter/CallFrame.h: Removed. * ForwardingHeaders/interpreter/FrameTracers.h: Removed. * ForwardingHeaders/interpreter/ShadowChicken.h: Removed. * ForwardingHeaders/interpreter/StackVisitor.h: Removed. * ForwardingHeaders/jit/JITCode.h: Removed. * ForwardingHeaders/jit/JITMathICForwards.h: Removed. * ForwardingHeaders/jit/Snippet.h: Removed. * ForwardingHeaders/jit/SnippetParams.h: Removed. * ForwardingHeaders/jit/SpillRegistersMode.h: Removed. * ForwardingHeaders/masm/X86Assembler.h: Removed. * ForwardingHeaders/parser/ParserError.h: Removed. * ForwardingHeaders/parser/SourceCode.h: Removed. * ForwardingHeaders/parser/SourceProvider.h: Removed. * ForwardingHeaders/parser/SourceProviderCache.h: Removed. * ForwardingHeaders/profiler/ProfilerDatabase.h: Removed. * ForwardingHeaders/runtime/ArgList.h: Removed. * ForwardingHeaders/runtime/ArrayBuffer.h: Removed. * ForwardingHeaders/runtime/ArrayBufferView.h: Removed. * ForwardingHeaders/runtime/ArrayPrototype.h: Removed. * ForwardingHeaders/runtime/AuxiliaryBarrierInlines.h: Removed. * ForwardingHeaders/runtime/BooleanObject.h: Removed. * ForwardingHeaders/runtime/CallData.h: Removed. * ForwardingHeaders/runtime/CatchScope.h: Removed. * ForwardingHeaders/runtime/CommonIdentifiers.h: Removed. * ForwardingHeaders/runtime/Completion.h: Removed. * ForwardingHeaders/runtime/ConfigFile.h: Removed. * ForwardingHeaders/runtime/ConsoleClient.h: Removed. * ForwardingHeaders/runtime/ConsoleTypes.h: Removed. * ForwardingHeaders/runtime/ConstructAbility.h: Removed. * ForwardingHeaders/runtime/ConstructData.h: Removed. * ForwardingHeaders/runtime/DataView.h: Removed. * ForwardingHeaders/runtime/DateInstance.h: Removed. * ForwardingHeaders/runtime/Error.h: Removed. * ForwardingHeaders/runtime/ErrorHandlingScope.h: Removed. * ForwardingHeaders/runtime/ErrorInstance.h: Removed. * ForwardingHeaders/runtime/ErrorPrototype.h: Removed. * ForwardingHeaders/runtime/Exception.h: Removed. * ForwardingHeaders/runtime/ExceptionHelpers.h: Removed. * ForwardingHeaders/runtime/Float32Array.h: Removed. * ForwardingHeaders/runtime/Float64Array.h: Removed. * ForwardingHeaders/runtime/FunctionConstructor.h: Removed. * ForwardingHeaders/runtime/FunctionExecutable.h: Removed. * ForwardingHeaders/runtime/FunctionPrototype.h: Removed. * ForwardingHeaders/runtime/HashMapImpl.h: Removed. * ForwardingHeaders/runtime/Identifier.h: Removed. * ForwardingHeaders/runtime/IdentifierInlines.h: Removed. * ForwardingHeaders/runtime/InitializeThreading.h: Removed. * ForwardingHeaders/runtime/Int16Array.h: Removed. * ForwardingHeaders/runtime/Int32Array.h: Removed. * ForwardingHeaders/runtime/Int8Array.h: Removed. * ForwardingHeaders/runtime/InternalFunction.h: Removed. * ForwardingHeaders/runtime/Intrinsic.h: Removed. * ForwardingHeaders/runtime/IterationKind.h: Removed. * ForwardingHeaders/runtime/IteratorOperations.h: Removed. * ForwardingHeaders/runtime/IteratorPrototype.h: Removed. * ForwardingHeaders/runtime/JSAPIValueWrapper.h: Removed. * ForwardingHeaders/runtime/JSArray.h: Removed. * ForwardingHeaders/runtime/JSArrayBuffer.h: Removed. * ForwardingHeaders/runtime/JSArrayBufferView.h: Removed. * ForwardingHeaders/runtime/JSCInlines.h: Removed. * ForwardingHeaders/runtime/JSCJSValue.h: Removed. * ForwardingHeaders/runtime/JSCJSValueInlines.h: Removed. * ForwardingHeaders/runtime/JSCallee.h: Removed. * ForwardingHeaders/runtime/JSCell.h: Removed. * ForwardingHeaders/runtime/JSCellInlines.h: Removed. * ForwardingHeaders/runtime/JSDataView.h: Removed. * ForwardingHeaders/runtime/JSDestructibleObject.h: Removed. * ForwardingHeaders/runtime/JSDestructibleObjectHeapCellType.h: Removed. * ForwardingHeaders/runtime/JSExportMacros.h: Removed. * ForwardingHeaders/runtime/JSFunction.h: Removed. * ForwardingHeaders/runtime/JSGlobalObject.h: Removed. * ForwardingHeaders/runtime/JSGlobalObjectInlines.h: Removed. * ForwardingHeaders/runtime/JSInternalPromise.h: Removed. * ForwardingHeaders/runtime/JSInternalPromiseDeferred.h: Removed. * ForwardingHeaders/runtime/JSLock.h: Removed. * ForwardingHeaders/runtime/JSMap.h: Removed. * ForwardingHeaders/runtime/JSMapIterator.h: Removed. * ForwardingHeaders/runtime/JSModuleLoader.h: Removed. * ForwardingHeaders/runtime/JSModuleRecord.h: Removed. * ForwardingHeaders/runtime/JSNativeStdFunction.h: Removed. * ForwardingHeaders/runtime/JSONObject.h: Removed. * ForwardingHeaders/runtime/JSObject.h: Removed. * ForwardingHeaders/runtime/JSObjectInlines.h: Removed. * ForwardingHeaders/runtime/JSPromise.h: Removed. * ForwardingHeaders/runtime/JSPromiseConstructor.h: Removed. * ForwardingHeaders/runtime/JSPromiseDeferred.h: Removed. * ForwardingHeaders/runtime/JSProxy.h: Removed. * ForwardingHeaders/runtime/JSRunLoopTimer.h: Removed. * ForwardingHeaders/runtime/JSScriptFetchParameters.h: Removed. * ForwardingHeaders/runtime/JSScriptFetcher.h: Removed. * ForwardingHeaders/runtime/JSSegmentedVariableObjectHeapCellType.h: Removed. * ForwardingHeaders/runtime/JSSet.h: Removed. * ForwardingHeaders/runtime/JSSetIterator.h: Removed. * ForwardingHeaders/runtime/JSSourceCode.h: Removed. * ForwardingHeaders/runtime/JSString.h: Removed. * ForwardingHeaders/runtime/JSTypedArrays.h: Removed. * ForwardingHeaders/runtime/JSWithScope.h: Removed. * ForwardingHeaders/runtime/Lookup.h: Removed. * ForwardingHeaders/runtime/MapBase.h: Removed. * ForwardingHeaders/runtime/MapData.h: Removed. * ForwardingHeaders/runtime/MapDataInlines.h: Removed. * ForwardingHeaders/runtime/MatchResult.h: Removed. * ForwardingHeaders/runtime/Microtask.h: Removed. * ForwardingHeaders/runtime/ObjectConstructor.h: Removed. * ForwardingHeaders/runtime/ObjectPrototype.h: Removed. * ForwardingHeaders/runtime/Operations.h: Removed. * ForwardingHeaders/runtime/PrivateName.h: Removed. * ForwardingHeaders/runtime/PromiseDeferredTimer.h: Removed. * ForwardingHeaders/runtime/PropertyNameArray.h: Removed. * ForwardingHeaders/runtime/Protect.h: Removed. * ForwardingHeaders/runtime/RegExp.h: Removed. * ForwardingHeaders/runtime/RegExpObject.h: Removed. * ForwardingHeaders/runtime/RuntimeFlags.h: Removed. * ForwardingHeaders/runtime/SamplingProfiler.h: Removed. * ForwardingHeaders/runtime/ScriptFetchParameters.h: Removed. * ForwardingHeaders/runtime/ScriptFetcher.h: Removed. * ForwardingHeaders/runtime/StringObject.h: Removed. * ForwardingHeaders/runtime/StringPrototype.h: Removed. * ForwardingHeaders/runtime/Structure.h: Removed. * ForwardingHeaders/runtime/StructureChain.h: Removed. * ForwardingHeaders/runtime/StructureInlines.h: Removed. * ForwardingHeaders/runtime/Symbol.h: Removed. * ForwardingHeaders/runtime/SymbolTable.h: Removed. * ForwardingHeaders/runtime/ThrowScope.h: Removed. * ForwardingHeaders/runtime/TypedArrayController.h: Removed. * ForwardingHeaders/runtime/TypedArrayInlines.h: Removed. * ForwardingHeaders/runtime/TypedArrays.h: Removed. * ForwardingHeaders/runtime/Uint16Array.h: Removed. * ForwardingHeaders/runtime/Uint32Array.h: Removed. * ForwardingHeaders/runtime/Uint8Array.h: Removed. * ForwardingHeaders/runtime/Uint8ClampedArray.h: Removed. * ForwardingHeaders/runtime/VM.h: Removed. * ForwardingHeaders/runtime/VMEntryScope.h: Removed. * ForwardingHeaders/runtime/Watchdog.h: Removed. * ForwardingHeaders/runtime/WeakGCMap.h: Removed. * ForwardingHeaders/runtime/WeakGCMapInlines.h: Removed. * ForwardingHeaders/runtime/WriteBarrier.h: Removed. * ForwardingHeaders/wasm/WasmModule.h: Removed. * ForwardingHeaders/wasm/js/JSWebAssemblyModule.h: Removed. * ForwardingHeaders/yarr/RegularExpression.h: Removed. * ForwardingHeaders/yarr/Yarr.h: Removed. * ForwardingHeaders/yarr/YarrInterpreter.h: Removed. * ForwardingHeaders/yarr/YarrJIT.h: Removed. * ForwardingHeaders/yarr/YarrPattern.h: Removed. * Modules/applepay/cocoa/PaymentMerchantSessionCocoa.mm: * Modules/encryptedmedia/MediaKeyMessageEvent.h: * Modules/encryptedmedia/MediaKeyMessageEventInit.h: * Modules/encryptedmedia/MediaKeyStatusMap.h: * Modules/encryptedmedia/legacy/LegacyCDM.h: * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeyMessageEvent.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeyNeededEvent.cpp: * Modules/encryptedmedia/legacy/WebKitMediaKeySession.h: * Modules/encryptedmedia/legacy/WebKitMediaKeys.h: * Modules/fetch/FetchBody.cpp: * Modules/fetch/FetchRequestInit.h: * Modules/fetch/FetchResponse.h: * Modules/indexeddb/IDBCursor.cpp: * Modules/indexeddb/IDBCursor.h: * Modules/indexeddb/IDBCursorWithValue.cpp: * Modules/indexeddb/IDBDatabase.cpp: * Modules/indexeddb/IDBIndex.cpp: * Modules/indexeddb/IDBKey.cpp: * Modules/indexeddb/IDBKeyRange.cpp: * Modules/indexeddb/IDBObjectStore.cpp: * Modules/indexeddb/IDBRequest.cpp: * Modules/indexeddb/IDBRequest.h: * Modules/indexeddb/client/TransactionOperation.cpp: * Modules/indexeddb/server/MemoryObjectStore.cpp: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: * Modules/mediacontrols/MediaControlsHost.cpp: * Modules/mediasource/SourceBuffer.cpp: * Modules/mediastream/RTCDataChannel.cpp: * Modules/plugins/QuickTimePluginReplacement.mm: * Modules/webaudio/AsyncAudioDecoder.cpp: * Modules/webaudio/AudioBuffer.cpp: * Modules/webaudio/AudioBuffer.h: * Modules/webaudio/AudioContext.cpp: * Modules/webaudio/AudioContext.h: * Modules/webaudio/AudioParam.h: * Modules/webaudio/AudioParamTimeline.h: * Modules/webaudio/PeriodicWave.h: * Modules/webaudio/RealtimeAnalyser.cpp: * Modules/webaudio/RealtimeAnalyser.h: * Modules/webaudio/ScriptProcessorNode.cpp: * Modules/webaudio/WaveShaperProcessor.h: * Modules/webauthn/AuthenticatorResponse.h: * Modules/webauthn/PublicKeyCredential.h: * Modules/websockets/WebSocket.cpp: * Modules/websockets/WebSocketChannel.cpp: * Modules/websockets/WorkerThreadableWebSocketChannel.cpp: * Modules/webvr/VREyeParameters.h: * Modules/webvr/VRFrameData.h: * Modules/webvr/VRPose.h: * Modules/webvr/VRStageParameters.h: * PlatformWin.cmake: * bindings/IDLTypes.h: * bindings/js/BufferSource.h: * bindings/js/CachedScriptFetcher.h: * bindings/js/CachedScriptSourceProvider.h: * bindings/js/CallTracerTypes.h: * bindings/js/CommonVM.cpp: * bindings/js/DOMGCOutputConstraint.cpp: * bindings/js/DOMGCOutputConstraint.h: * bindings/js/GCController.cpp: * bindings/js/GCController.h: * bindings/js/IDBBindingUtilities.cpp: * bindings/js/JSCallbackData.cpp: * bindings/js/JSCallbackData.h: * bindings/js/JSCustomElementInterface.cpp: * bindings/js/JSCustomElementInterface.h: * bindings/js/JSCustomEventCustom.cpp: * bindings/js/JSCustomXPathNSResolver.cpp: * bindings/js/JSCustomXPathNSResolver.h: * bindings/js/JSDOMBinding.h: * bindings/js/JSDOMBuiltinConstructorBase.cpp: * bindings/js/JSDOMConstructorBase.cpp: * bindings/js/JSDOMConvertBase.h: * bindings/js/JSDOMConvertBufferSource.h: * bindings/js/JSDOMConvertDate.cpp: * bindings/js/JSDOMConvertInterface.h: * bindings/js/JSDOMConvertJSON.h: * bindings/js/JSDOMConvertNumbers.cpp: * bindings/js/JSDOMConvertNumbers.h: * bindings/js/JSDOMConvertObject.h: * bindings/js/JSDOMConvertRecord.h: * bindings/js/JSDOMConvertSequences.h: * bindings/js/JSDOMConvertStrings.cpp: * bindings/js/JSDOMConvertUnion.h: * bindings/js/JSDOMExceptionHandling.cpp: * bindings/js/JSDOMExceptionHandling.h: * bindings/js/JSDOMGlobalObject.cpp: * bindings/js/JSDOMGlobalObject.h: * bindings/js/JSDOMGlobalObjectTask.cpp: * bindings/js/JSDOMGuardedObject.h: * bindings/js/JSDOMIterator.cpp: * bindings/js/JSDOMIterator.h: * bindings/js/JSDOMMapLike.cpp: * bindings/js/JSDOMMapLike.h: * bindings/js/JSDOMPromise.cpp: * bindings/js/JSDOMPromise.h: * bindings/js/JSDOMPromiseDeferred.cpp: * bindings/js/JSDOMPromiseDeferred.h: * bindings/js/JSDOMWindowBase.cpp: * bindings/js/JSDOMWindowCustom.cpp: * bindings/js/JSDOMWindowProxy.cpp: * bindings/js/JSDOMWindowProxy.h: * bindings/js/JSDOMWrapper.cpp: * bindings/js/JSDOMWrapper.h: * bindings/js/JSDOMWrapperCache.cpp: * bindings/js/JSDOMWrapperCache.h: * bindings/js/JSDynamicDowncast.h: * bindings/js/JSErrorHandler.cpp: * bindings/js/JSEventCustom.cpp: * bindings/js/JSEventListener.cpp: * bindings/js/JSEventListener.h: * bindings/js/JSHTMLElementCustom.cpp: * bindings/js/JSHistoryCustom.cpp: * bindings/js/JSIDBCursorWithValueCustom.cpp: * bindings/js/JSIDBIndexCustom.cpp: * bindings/js/JSImageDataCustom.cpp: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLocationCustom.cpp: * bindings/js/JSMainThreadExecState.h: * bindings/js/JSMainThreadExecStateInstrumentation.h: * bindings/js/JSMessageChannelCustom.cpp: * bindings/js/JSMessageEventCustom.cpp: * bindings/js/JSNodeIteratorCustom.cpp: * bindings/js/JSPopStateEventCustom.cpp: * bindings/js/JSReadableStreamPrivateConstructors.cpp: * bindings/js/JSTreeWalkerCustom.cpp: * bindings/js/JSWebGL2RenderingContextCustom.cpp: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/ReadableStreamDefaultController.cpp: * bindings/js/ReadableStreamDefaultController.h: * bindings/js/ScheduledAction.cpp: * bindings/js/ScheduledAction.h: * bindings/js/ScriptCachedFrameData.cpp: * bindings/js/ScriptCachedFrameData.h: * bindings/js/ScriptController.cpp: * bindings/js/ScriptController.h: * bindings/js/ScriptControllerMac.mm: * bindings/js/ScriptModuleLoader.cpp: * bindings/js/ScriptModuleLoader.h: * bindings/js/ScriptSourceCode.h: * bindings/js/ScriptState.cpp: * bindings/js/ScriptWrappable.h: * bindings/js/ScriptWrappableInlines.h: * bindings/js/SerializedScriptValue.cpp: * bindings/js/SerializedScriptValue.h: * bindings/js/StructuredClone.cpp: * bindings/js/WebCoreBuiltinNames.h: * bindings/js/WebCoreJSClientData.cpp: * bindings/js/WebCoreTypedArrayController.cpp: * bindings/js/WebCoreTypedArrayController.h: * bindings/js/WorkerScriptController.cpp: * bindings/js/WorkerScriptController.h: * bridge/NP_jsobject.cpp: * bridge/c/CRuntimeObject.cpp: * bridge/c/c_class.cpp: * bridge/c/c_instance.cpp: * bridge/c/c_runtime.cpp: * bridge/c/c_utility.cpp: * bridge/c/c_utility.h: * bridge/jsc/BridgeJSC.cpp: * bridge/jsc/BridgeJSC.h: * bridge/npruntime.cpp: * bridge/objc/ObjCRuntimeObject.mm: * bridge/objc/WebScriptObject.mm: * bridge/objc/WebScriptObjectPrivate.h: * bridge/objc/objc_instance.mm: * bridge/objc/objc_runtime.h: * bridge/objc/objc_runtime.mm: * bridge/objc/objc_utility.h: * bridge/objc/objc_utility.mm: * bridge/runtime_array.cpp: * bridge/runtime_array.h: * bridge/runtime_method.cpp: * bridge/runtime_method.h: * bridge/runtime_object.cpp: * bridge/runtime_object.h: * bridge/runtime_root.cpp: * bridge/runtime_root.h: * crypto/SubtleCrypto.cpp: * crypto/SubtleCrypto.h: * crypto/gcrypt/CryptoKeyRSAGCrypt.cpp: * crypto/keys/CryptoRsaKeyAlgorithm.h: * crypto/mac/CryptoKeyRSAMac.cpp: * crypto/parameters/CryptoAlgorithmEcdsaParams.h: * crypto/parameters/CryptoAlgorithmHkdfParams.h: * crypto/parameters/CryptoAlgorithmHmacKeyParams.h: * crypto/parameters/CryptoAlgorithmPbkdf2Params.h: * crypto/parameters/CryptoAlgorithmRsaHashedImportParams.h: * crypto/parameters/CryptoAlgorithmRsaHashedKeyGenParams.h: * crypto/parameters/CryptoAlgorithmRsaKeyGenParams.h: * css/CSSFontFaceSource.h: * css/DOMMatrixReadOnly.cpp: * css/DOMMatrixReadOnly.h: * css/FontFace.cpp: * dom/CustomElementReactionQueue.cpp: * dom/CustomElementRegistry.cpp: * dom/CustomEvent.cpp: * dom/CustomEvent.h: * dom/Document.cpp: * dom/Document.h: * dom/ErrorEvent.cpp: * dom/ErrorEvent.h: * dom/LoadableScript.h: * dom/MessageEvent.cpp: * dom/MessageEvent.h: * dom/ModuleFetchParameters.h: * dom/PopStateEvent.cpp: * dom/PopStateEvent.h: * dom/PromiseRejectionEvent.cpp: * dom/PromiseRejectionEvent.h: * dom/RejectedPromiseTracker.cpp: * dom/RejectedPromiseTracker.h: * dom/ScriptExecutionContext.cpp: * dom/ScriptExecutionContext.h: * dom/TextEncoder.cpp: * dom/TextEncoder.h: * domjit/DOMJITHelpers.h: * domjit/DOMJITIDLTypeFilter.h: * domjit/JSDocumentDOMJIT.cpp: * domjit/JSNodeDOMJIT.cpp: * fileapi/BlobBuilder.cpp: * fileapi/FileReader.cpp: * fileapi/FileReaderLoader.cpp: * fileapi/FileReaderSync.cpp: * html/BaseTextInputType.cpp: * html/EmailInputType.cpp: * html/HTMLAllCollection.cpp: * html/HTMLCanvasElement.cpp: * html/HTMLImageLoader.cpp: * html/HTMLMediaElement.cpp: * html/HTMLPlugInImageElement.cpp: * html/ImageData.cpp: * html/ImageData.h: * html/MediaEncryptedEventInit.h: * html/WebKitMediaKeyError.h: * html/canvas/WebGLAny.h: * html/canvas/WebGLRenderingContext.cpp: * html/canvas/WebGLRenderingContextBase.cpp: * html/canvas/WebGLRenderingContextBase.h: * html/canvas/WebGPUBuffer.cpp: * html/canvas/WebGPURenderingContext.cpp: * html/canvas/WebGPURenderingContext.h: * html/track/DataCue.cpp: * html/track/DataCue.h: * inspector/CommandLineAPIHost.cpp: * inspector/CommandLineAPIHost.h: * inspector/CommandLineAPIModule.cpp: * inspector/CommandLineAPIModule.h: * inspector/InspectorCanvas.cpp: * inspector/InspectorCanvas.h: * inspector/InspectorClient.cpp: * inspector/InspectorController.cpp: * inspector/InspectorController.h: * inspector/InspectorDatabaseResource.h: * inspector/InspectorFrontendClientLocal.cpp: * inspector/InspectorFrontendHost.cpp: * inspector/InspectorInstrumentation.cpp: * inspector/InspectorInstrumentation.h: * inspector/InspectorOverlay.cpp: * inspector/InspectorOverlay.h: * inspector/InspectorShaderProgram.cpp: * inspector/InspectorShaderProgram.h: * inspector/InspectorStyleSheet.cpp: * inspector/InspectorStyleSheet.h: * inspector/InspectorWebAgentBase.h: * inspector/InstrumentingAgents.h: * inspector/PageScriptDebugServer.cpp: * inspector/PageScriptDebugServer.h: * inspector/TimelineRecordFactory.cpp: * inspector/WebInjectedScriptHost.h: * inspector/WebInjectedScriptManager.h: * inspector/WorkerInspectorController.cpp: * inspector/WorkerInspectorController.h: * inspector/WorkerScriptDebugServer.cpp: * inspector/WorkerScriptDebugServer.h: * inspector/WorkerToPageFrontendChannel.h: * inspector/agents/InspectorApplicationCacheAgent.h: * inspector/agents/InspectorCSSAgent.cpp: * inspector/agents/InspectorCSSAgent.h: * inspector/agents/InspectorCanvasAgent.cpp: * inspector/agents/InspectorCanvasAgent.h: * inspector/agents/InspectorDOMAgent.cpp: * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMStorageAgent.cpp: * inspector/agents/InspectorDOMStorageAgent.h: * inspector/agents/InspectorDatabaseAgent.cpp: * inspector/agents/InspectorDatabaseAgent.h: * inspector/agents/InspectorIndexedDBAgent.cpp: * inspector/agents/InspectorIndexedDBAgent.h: * inspector/agents/InspectorLayerTreeAgent.cpp: * inspector/agents/InspectorLayerTreeAgent.h: * inspector/agents/InspectorMemoryAgent.cpp: * inspector/agents/InspectorMemoryAgent.h: * inspector/agents/InspectorNetworkAgent.cpp: * inspector/agents/InspectorNetworkAgent.h: * inspector/agents/InspectorPageAgent.cpp: * inspector/agents/InspectorPageAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorWorkerAgent.h: * inspector/agents/WebConsoleAgent.cpp: * inspector/agents/WebConsoleAgent.h: * inspector/agents/WebDebuggerAgent.h: * inspector/agents/WebHeapAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: * inspector/agents/page/PageRuntimeAgent.cpp: * inspector/agents/page/PageRuntimeAgent.h: * inspector/agents/worker/ServiceWorkerAgent.h: * inspector/agents/worker/WorkerDebuggerAgent.cpp: * inspector/agents/worker/WorkerRuntimeAgent.cpp: * inspector/agents/worker/WorkerRuntimeAgent.h: * loader/EmptyClients.cpp: * page/CaptionUserPreferences.cpp: * page/Chrome.cpp: * page/ChromeClient.h: * page/Crypto.cpp: * page/DOMWindow.cpp: * page/DOMWindow.h: * page/Frame.cpp: * page/OriginThreadLocalCache.h: * page/PageConsoleClient.cpp: * page/PageConsoleClient.h: * page/PageDebuggable.cpp: * page/PageGroup.cpp: * page/SettingsBase.h: * page/UserContentController.cpp: * page/cocoa/ResourceUsageThreadCocoa.mm: * page/csp/ContentSecurityPolicy.cpp: * page/ios/FrameIOS.mm: * page/linux/ResourceUsageOverlayLinux.cpp: * page/linux/ResourceUsageThreadLinux.cpp: * platform/MediaSample.h: * platform/SerializedPlatformRepresentation.h: * platform/SharedBuffer.h: * platform/audio/mac/CARingBuffer.h: * platform/cocoa/SharedBufferCocoa.mm: * platform/graphics/ImageBuffer.h: * platform/graphics/LegacyCDMSession.h: * platform/graphics/MediaPlayer.h: * platform/graphics/avfoundation/CDMFairPlayStreaming.cpp: * platform/graphics/avfoundation/CDMPrivateMediaSourceAVFObjC.mm: * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp: * platform/graphics/avfoundation/MediaSampleAVFObjC.h: * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/CDMSessionAVContentKeySession.mm: * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/CDMSessionAVStreamSession.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: * platform/graphics/cairo/ImageBufferCairo.cpp: * platform/graphics/cg/ImageBufferDataCG.cpp: * platform/graphics/cg/ImageBufferDataCG.h: * platform/graphics/cocoa/GPUDeviceMetal.mm: * platform/graphics/filters/FEBlend.cpp: * platform/graphics/filters/FEColorMatrix.cpp: * platform/graphics/filters/FEComponentTransfer.cpp: * platform/graphics/filters/FEComposite.cpp: * platform/graphics/filters/FEConvolveMatrix.cpp: * platform/graphics/filters/FEDisplacementMap.cpp: * platform/graphics/filters/FEDropShadow.cpp: * platform/graphics/filters/FEGaussianBlur.cpp: * platform/graphics/filters/FELighting.h: * platform/graphics/filters/FEMorphology.cpp: * platform/graphics/filters/FETurbulence.cpp: * platform/graphics/filters/FilterEffect.cpp: * platform/graphics/filters/FilterEffect.h: * platform/graphics/gpu/GPUBuffer.h: * platform/graphics/gpu/GPUDevice.h: * platform/graphics/iso/ISOBox.cpp: * platform/graphics/iso/ISOOriginalFormatBox.cpp: * platform/graphics/iso/ISOProtectionSchemeInfoBox.cpp: * platform/graphics/iso/ISOSchemeInformationBox.cpp: * platform/graphics/iso/ISOSchemeTypeBox.cpp: * platform/graphics/iso/ISOTrackEncryptionBox.cpp: * platform/graphics/iso/ISOVTTCue.cpp: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: * platform/graphics/win/ImageBufferDataDirect2D.cpp: * platform/graphics/win/ImageBufferDataDirect2D.h: * platform/ios/wak/WebCoreThread.mm: * platform/mac/SerializedPlatformRepresentationMac.mm: * platform/mac/StringUtilities.mm: * platform/mock/mediasource/MockBox.cpp: * platform/mock/mediasource/MockSourceBufferPrivate.cpp: * svg/graphics/SVGImage.cpp: * testing/GCObservation.cpp: * testing/GCObservation.h: * testing/Internals.cpp: * testing/Internals.h: * testing/LegacyMockCDM.cpp: * testing/MockCDMFactory.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/Worker.cpp: * workers/Worker.h: * workers/WorkerConsoleClient.cpp: * workers/WorkerConsoleClient.h: * workers/WorkerGlobalScope.cpp: * workers/WorkerGlobalScope.h: * workers/WorkerGlobalScopeProxy.h: * workers/WorkerInspectorProxy.cpp: * workers/WorkerMessagingProxy.cpp: * workers/WorkerThread.h: * workers/service/ExtendableEvent.cpp: * workers/service/ServiceWorker.cpp: * workers/service/ServiceWorker.h: * workers/service/ServiceWorkerClient.h: * workers/service/context/ServiceWorkerInspectorProxy.cpp: * workers/service/context/ServiceWorkerThread.cpp: * xml/XMLHttpRequest.cpp: Source/WebKit: * Platform/mac/StringUtilities.mm: * Shared/Cocoa/WebKit2InitializeCocoa.mm: * Shared/WebKit2Initialize.cpp: * Shared/linux/WebMemorySamplerLinux.cpp: * Shared/mac/WebMemorySampler.mac.mm: * UIProcess/WebProcessPool.cpp: * WebProcess/InjectedBundle/API/APIInjectedBundlePageUIClient.h: * WebProcess/InjectedBundle/API/glib/WebKitConsoleMessagePrivate.h: * WebProcess/Plugins/Netscape/NPRuntimeObjectMap.h: * WebProcess/Plugins/Netscape/NetscapePlugin.cpp: * WebProcess/Plugins/PluginProcessConnection.cpp: * WebProcess/Plugins/PluginView.cpp: * WebProcess/WebPage/WebInspector.h: * WebProcess/WebPage/WebPage.cpp: * WebProcess/cocoa/WebProcessCocoa.mm: Source/WebKitLegacy/ios: * Misc/WebUIKitSupport.mm: Source/WebKitLegacy/mac: * Carbon/CarbonWindowAdapter.mm: * DOM/WebDOMOperations.mm: * History/WebBackForwardList.mm: * History/WebHistoryItem.mm: * Misc/WebCache.mm: * Misc/WebElementDictionary.mm: * Misc/WebIconDatabase.mm: * Misc/WebStringTruncator.mm: * Plugins/Hosted/NetscapePluginInstanceProxy.mm: * Plugins/Hosted/ProxyInstance.mm: * Plugins/Hosted/ProxyRuntimeObject.mm: * Plugins/Hosted/WebHostedNetscapePluginView.mm: * Plugins/WebBaseNetscapePluginView.mm: * Plugins/WebBasePluginPackage.mm: * Plugins/WebNetscapePluginStream.mm: * Plugins/WebNetscapePluginView.mm: * Plugins/WebPluginController.mm: * WebCoreSupport/WebEditorClient.mm: * WebCoreSupport/WebFrameLoaderClient.mm: * WebCoreSupport/WebInspectorClient.h: * WebCoreSupport/WebInspectorClient.mm: * WebView/WebDataSource.mm: * WebView/WebFrame.mm: * WebView/WebHTMLRepresentation.mm: * WebView/WebHTMLView.mm: * WebView/WebPreferences.mm: * WebView/WebScriptDebugDelegate.mm: * WebView/WebScriptDebugger.h: * WebView/WebTextIterator.mm: * WebView/WebView.mm: * WebView/WebViewData.mm: Source/WebKitLegacy/win: * Plugins/PluginView.cpp: * Plugins/PluginViewWin.cpp: * WebCoreSupport/WebInspectorClient.cpp: * WebCoreSupport/WebInspectorClient.h: * WebFrame.cpp: * WebJavaScriptCollector.cpp: * WebView.cpp: Tools: * WebKitTestRunner/TestController.cpp: Canonical link: https://commits.webkit.org/198358@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228218 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2018-02-07 05:20:34 +00:00
#include <JavaScriptCore/VM.h>
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
namespace WebCore {
Change WebCore sources to work with unified source builds https://bugs.webkit.org/show_bug.cgi?id=178229 Rubber stamped by Tim Horton. Source/JavaScriptCore: * Configurations/FeatureDefines.xcconfig: Source/WebCore: This patch does the following: 1) Move all “using namespace <name>;” into the WebCore namespace (They used to go in the global namespace) and change to "using WebCore::<name>;” in .mm files. 2) Move a bunch of the soft linking library/framework macros out of the .mm files since those caused name collision problems. 3) Fix minor other naming collisions. The problem with 1 in a unified source world is generic names often collide with system header names. For example, WebCore has a Rect class and that collided with a system header type elsewhere. This patch shouldn't change behavior so no new tests. * Configurations/FeatureDefines.xcconfig: * Modules/cache/CacheStorageConnection.cpp: * Modules/cache/DOMCache.cpp: * Modules/cache/DOMCacheStorage.cpp: * Modules/cache/WorkerCacheStorageConnection.cpp: * Modules/encryptedmedia/InitDataRegistry.cpp: * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.cpp: * Modules/indexeddb/IDBCursor.cpp: * Modules/indexeddb/IDBFactory.cpp: * Modules/indexeddb/IDBIndex.cpp: * Modules/indexeddb/IDBKeyRange.cpp: * Modules/indexeddb/IDBObjectStore.cpp: * Modules/indexeddb/IDBRequest.cpp: * Modules/indexeddb/IDBTransaction.cpp: * Modules/indexeddb/server/MemoryObjectStore.cpp: * Modules/indexeddb/server/SQLiteIDBBackingStore.cpp: * Modules/indexeddb/server/UniqueIDBDatabase.cpp: * Modules/mediasource/MediaSource.cpp: (WebCore::MediaSource::setReadyState): (WebCore::toString): Deleted. * Modules/mediastream/libwebrtc/LibWebRTCMediaEndpoint.cpp: * Modules/plugins/QuickTimePluginReplacement.mm: (WebCore::jsValueWithAVMetadataItemInContext): * Modules/webdriver/NavigatorWebDriver.cpp: * PlatformAppleWin.cmake: * PlatformMac.cmake: * WebCore.xcodeproj/project.pbxproj: * accessibility/ios/AccessibilityObjectIOS.mm: (-[WAKView accessibilityIsIgnored]): Deleted. * accessibility/ios/WebAccessibilityObjectWrapperIOS.h: * accessibility/ios/WebAccessibilityObjectWrapperIOS.mm: (-[WAKView accessibilityIsIgnored]): * accessibility/win/AXObjectCacheWin.cpp: * bindings/js/CommonVM.cpp: * bindings/js/DOMWrapperWorld.cpp: * bindings/js/GCController.cpp: * bindings/js/IDBBindingUtilities.cpp: * bindings/js/JSAudioTrackCustom.cpp: * bindings/js/JSAudioTrackListCustom.cpp: * bindings/js/JSBlobCustom.cpp: * bindings/js/JSCSSRuleCustom.cpp: * bindings/js/JSCSSRuleListCustom.cpp: * bindings/js/JSCSSStyleDeclarationCustom.cpp: * bindings/js/JSCallbackData.cpp: * bindings/js/JSCanvasRenderingContext2DCustom.cpp: * bindings/js/JSCustomElementInterface.cpp: * bindings/js/JSCustomElementRegistryCustom.cpp: * bindings/js/JSCustomEventCustom.cpp: * bindings/js/JSDOMBindingSecurity.cpp: * bindings/js/JSDOMBuiltinConstructorBase.cpp: * bindings/js/JSDOMConstructorBase.cpp: * bindings/js/JSDOMConstructorWithDocument.cpp: * bindings/js/JSDOMConvertDate.cpp: * bindings/js/JSDOMConvertNumbers.cpp: * bindings/js/JSDOMConvertStrings.cpp: * bindings/js/JSDOMConvertWebGL.cpp: * bindings/js/JSDOMExceptionHandling.cpp: * bindings/js/JSDOMGlobalObject.cpp: * bindings/js/JSDOMGlobalObjectTask.cpp: * bindings/js/JSDOMGuardedObject.cpp: * bindings/js/JSDOMPromiseDeferred.cpp: * bindings/js/JSDOMQuadCustom.cpp: * bindings/js/JSDOMWindowBase.cpp: * bindings/js/JSDOMWindowCustom.cpp: * bindings/js/JSDOMWindowProxy.cpp: * bindings/js/JSDOMWrapper.cpp: * bindings/js/JSDOMWrapperCache.cpp: * bindings/js/JSDeprecatedCSSOMValueCustom.cpp: * bindings/js/JSDocumentCustom.cpp: * bindings/js/JSDocumentFragmentCustom.cpp: * bindings/js/JSElementCustom.cpp: * bindings/js/JSErrorHandler.cpp: * bindings/js/JSEventCustom.cpp: * bindings/js/JSEventListener.cpp: * bindings/js/JSEventTargetCustom.cpp: * bindings/js/JSFileSystemEntryCustom.cpp: * bindings/js/JSHTMLCollectionCustom.cpp: * bindings/js/JSHTMLDocumentCustom.cpp: * bindings/js/JSHTMLTemplateElementCustom.cpp: * bindings/js/JSHistoryCustom.cpp: * bindings/js/JSIDBCursorCustom.cpp: * bindings/js/JSIDBCursorWithValueCustom.cpp: * bindings/js/JSIDBIndexCustom.cpp: * bindings/js/JSIDBObjectStoreCustom.cpp: * bindings/js/JSIDBTransactionCustom.cpp: * bindings/js/JSImageDataCustom.cpp: * bindings/js/JSLazyEventListener.cpp: * bindings/js/JSLocationCustom.cpp: * bindings/js/JSMediaStreamCapabilitiesCustom.cpp: * bindings/js/JSMessageEventCustom.cpp: * bindings/js/JSMessagePortCustom.cpp: * bindings/js/JSMutationObserverCustom.cpp: * bindings/js/JSNodeCustom.cpp: * bindings/js/JSNodeListCustom.cpp: * bindings/js/JSPerformanceEntryCustom.cpp: * bindings/js/JSPluginElementFunctions.cpp: * bindings/js/JSPopStateEventCustom.cpp: * bindings/js/JSReadableStreamPrivateConstructors.cpp: * bindings/js/JSReadableStreamSourceCustom.cpp: * bindings/js/JSSVGPathSegCustom.cpp: * bindings/js/JSTextTrackCueCustom.cpp: * bindings/js/JSTextTrackCustom.cpp: * bindings/js/JSTextTrackListCustom.cpp: * bindings/js/JSTrackCustom.cpp: * bindings/js/JSVideoTrackCustom.cpp: * bindings/js/JSVideoTrackListCustom.cpp: * bindings/js/JSWebGL2RenderingContextCustom.cpp: * bindings/js/JSWebGLRenderingContextCustom.cpp: * bindings/js/JSWebGPURenderPassAttachmentDescriptorCustom.cpp: * bindings/js/JSWebGPURenderingContextCustom.cpp: * bindings/js/JSWorkerGlobalScopeBase.cpp: * bindings/js/JSWorkerGlobalScopeCustom.cpp: * bindings/js/JSXMLHttpRequestCustom.cpp: * bindings/js/JSXPathNSResolverCustom.cpp: * bindings/js/ReadableStream.cpp: (WebCore::ReadableStream::pipeTo): (WebCore::ReadableStream::tee): (WebCore::checkReadableStream): (WebCore::callFunction): Deleted. * bindings/js/ScheduledAction.cpp: * bindings/js/ScriptCachedFrameData.cpp: * bindings/js/ScriptController.cpp: * bindings/js/SerializedScriptValue.cpp: * bindings/js/StructuredClone.cpp: * bindings/js/WebCoreJSClientData.cpp: * bindings/js/WorkerScriptController.cpp: * bindings/scripts/CodeGeneratorJS.pm: (GenerateEnumerationImplementation): (GenerateImplementation): (GenerateDictionaryImplementation): (GenerateCallbackFunctionImplementation): (GenerateCallbackInterfaceImplementation): * bindings/scripts/test/JS/JSInterfaceName.cpp: * bindings/scripts/test/JS/JSMapLike.cpp: * bindings/scripts/test/JS/JSReadOnlyMapLike.cpp: * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: * bindings/scripts/test/JS/JSTestCEReactions.cpp: * bindings/scripts/test/JS/JSTestCEReactionsStringifier.cpp: * bindings/scripts/test/JS/JSTestCallTracer.cpp: * bindings/scripts/test/JS/JSTestCallbackFunction.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionRethrow.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionWithThisObject.cpp: * bindings/scripts/test/JS/JSTestCallbackFunctionWithTypedefs.cpp: * bindings/scripts/test/JS/JSTestCallbackInterface.cpp: * bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp: * bindings/scripts/test/JS/JSTestDOMJIT.cpp: * bindings/scripts/test/JS/JSTestEnabledBySetting.cpp: * bindings/scripts/test/JS/JSTestEventConstructor.cpp: * bindings/scripts/test/JS/JSTestEventTarget.cpp: * bindings/scripts/test/JS/JSTestException.cpp: * bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp: * bindings/scripts/test/JS/JSTestGlobalObject.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestInterface.cpp: * bindings/scripts/test/JS/JSTestInterfaceLeadingUnderscore.cpp: * bindings/scripts/test/JS/JSTestIterable.cpp: * bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp: * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedAndIndexedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedDeleterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedGetterCallWith.cpp: * bindings/scripts/test/JS/JSTestNamedGetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedGetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterNoIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterThrowingException.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIdentifier.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithIndexedGetterAndSetter.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgableProperties.cpp: * bindings/scripts/test/JS/JSTestNamedSetterWithUnforgablePropertiesAndOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestNode.cpp: * bindings/scripts/test/JS/JSTestObj.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp: * bindings/scripts/test/JS/JSTestOverloadedConstructorsWithSequence.cpp: * bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp: * bindings/scripts/test/JS/JSTestPluginInterface.cpp: * bindings/scripts/test/JS/JSTestPromiseRejectionEvent.cpp: * bindings/scripts/test/JS/JSTestSerialization.cpp: * bindings/scripts/test/JS/JSTestSerializationIndirectInheritance.cpp: * bindings/scripts/test/JS/JSTestSerializationInherit.cpp: * bindings/scripts/test/JS/JSTestSerializationInheritFinal.cpp: * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: * bindings/scripts/test/JS/JSTestStandaloneDictionary.cpp: * bindings/scripts/test/JS/JSTestStandaloneEnumeration.cpp: * bindings/scripts/test/JS/JSTestStringifier.cpp: * bindings/scripts/test/JS/JSTestStringifierAnonymousOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierNamedOperation.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationImplementedAs.cpp: * bindings/scripts/test/JS/JSTestStringifierOperationNamedToString.cpp: * bindings/scripts/test/JS/JSTestStringifierReadOnlyAttribute.cpp: * bindings/scripts/test/JS/JSTestStringifierReadWriteAttribute.cpp: * bindings/scripts/test/JS/JSTestTypedefs.cpp: * bindings/scripts/test/JS/JSTestVoidCallbackFunction.cpp: * bridge/IdentifierRep.cpp: * bridge/NP_jsobject.cpp: (ObjectMap::get): Deleted. (ObjectMap::add): Deleted. (ObjectMap::remove): Deleted. (objectMap): Deleted. (ObjectMap::RootObjectInvalidationCallback::operator()): Deleted. (getListFromVariantArgs): Deleted. (jsAllocate): Deleted. (jsDeallocate): Deleted. (_NPN_CreateNoScriptObject): Deleted. (_NPN_InvokeDefault): Deleted. (_NPN_Invoke): Deleted. (_NPN_Evaluate): Deleted. (_NPN_GetProperty): Deleted. (_NPN_SetProperty): Deleted. (_NPN_RemoveProperty): Deleted. (_NPN_HasProperty): Deleted. (_NPN_HasMethod): Deleted. (_NPN_SetException): Deleted. (_NPN_Enumerate): Deleted. (_NPN_Construct): Deleted. * bridge/NP_jsobject.h: * contentextensions/ContentExtensionParser.cpp: * crypto/SubtleCrypto.cpp: * crypto/algorithms/CryptoAlgorithmAES_CBC.cpp: (WebCore::CryptoAlgorithmAES_CBC::encrypt): (WebCore::CryptoAlgorithmAES_CBC::decrypt): (WebCore::CryptoAlgorithmAES_CBC::importKey): (WebCore::CryptoAlgorithmAES_CBC::exportKey): * crypto/algorithms/CryptoAlgorithmAES_CFB.cpp: (WebCore::CryptoAlgorithmAES_CFB::encrypt): (WebCore::CryptoAlgorithmAES_CFB::decrypt): (WebCore::CryptoAlgorithmAES_CFB::importKey): (WebCore::CryptoAlgorithmAES_CFB::exportKey): * crypto/algorithms/CryptoAlgorithmAES_CTR.cpp: (WebCore::parametersAreValid): (WebCore::CryptoAlgorithmAES_CTR::importKey): (WebCore::CryptoAlgorithmAES_CTR::exportKey): * crypto/algorithms/CryptoAlgorithmAES_GCM.cpp: (WebCore::tagLengthIsValid): (WebCore::CryptoAlgorithmAES_GCM::encrypt): (WebCore::CryptoAlgorithmAES_GCM::decrypt): (WebCore::CryptoAlgorithmAES_GCM::importKey): (WebCore::CryptoAlgorithmAES_GCM::exportKey): * crypto/algorithms/CryptoAlgorithmAES_KW.cpp: (WebCore::CryptoAlgorithmAES_KW::importKey): (WebCore::CryptoAlgorithmAES_KW::exportKey): * crypto/algorithms/CryptoAlgorithmHMAC.cpp: (WebCore::CryptoAlgorithmHMAC::importKey): (WebCore::CryptoAlgorithmHMAC::exportKey): * crypto/algorithms/CryptoAlgorithmRSASSA_PKCS1_v1_5.cpp: (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::importKey): (WebCore::CryptoAlgorithmRSASSA_PKCS1_v1_5::exportKey): * crypto/algorithms/CryptoAlgorithmRSA_OAEP.cpp: (WebCore::CryptoAlgorithmRSA_OAEP::importKey): (WebCore::CryptoAlgorithmRSA_OAEP::exportKey): * crypto/algorithms/CryptoAlgorithmRSA_PSS.cpp: (WebCore::CryptoAlgorithmRSA_PSS::importKey): (WebCore::CryptoAlgorithmRSA_PSS::exportKey): * crypto/mac/CryptoAlgorithmPBKDF2Mac.cpp: (WebCore::CryptoAlgorithmPBKDF2::platformDeriveBits): (WebCore::commonCryptoHMACAlgorithm): Deleted. * css/CSSBasicShapes.cpp: * css/CSSPrimitiveValue.cpp: * css/parser/CSSParser.cpp: * css/parser/CSSPropertyParser.cpp: * css/parser/CSSPropertyParserHelpers.cpp: (WebCore::CSSPropertyParserHelpers::positionFromThreeOrFourValues): (WebCore::CSSPropertyParserHelpers::consumePosition): (WebCore::CSSPropertyParserHelpers::createPrimitiveValuePair): Deleted. * dom/DOMQuad.cpp: * dom/Document.cpp: * dom/ErrorEvent.cpp: * dom/EventListenerMap.cpp: * dom/EventTarget.cpp: * dom/PromiseRejectionEvent.cpp: * dom/RejectedPromiseTracker.cpp: * dom/ScriptExecutionContext.cpp: * domjit/JSDocumentDOMJIT.cpp: * domjit/JSDocumentFragmentDOMJIT.cpp: * domjit/JSElementDOMJIT.cpp: * domjit/JSEventDOMJIT.cpp: * domjit/JSNodeDOMJIT.cpp: * editing/TextIterator.cpp: * editing/cocoa/HTMLConverter.mm: * history/CachedPage.cpp: * html/HTMLCanvasElement.cpp: * html/HTMLFontElement.cpp: * html/HTMLMediaElement.cpp: * html/HTMLSelectElement.cpp: * html/TypeAhead.cpp: * html/parser/HTMLSrcsetParser.cpp: (WebCore::tokenizeDescriptors): * html/parser/HTMLTokenizer.cpp: * html/parser/ParsingUtilities.h: (WebCore::isNotASCIISpace): * html/parser/XSSAuditorDelegate.cpp: * html/track/DataCue.cpp: * inspector/CommandLineAPIHost.cpp: * inspector/CommandLineAPIModule.cpp: * inspector/InspectorApplicationCacheAgent.cpp: * inspector/InspectorCSSAgent.cpp: * inspector/InspectorCanvas.cpp: * inspector/InspectorCanvasAgent.cpp: * inspector/InspectorClient.cpp: * inspector/InspectorController.cpp: * inspector/InspectorDOMAgent.cpp: * inspector/InspectorDOMDebuggerAgent.cpp: * inspector/InspectorDOMStorageAgent.cpp: * inspector/InspectorDatabaseAgent.cpp: * inspector/InspectorDatabaseResource.cpp: * inspector/InspectorFrontendClientLocal.cpp: * inspector/InspectorFrontendHost.cpp: * inspector/InspectorIndexedDBAgent.cpp: * inspector/InspectorInstrumentation.cpp: * inspector/InspectorLayerTreeAgent.cpp: * inspector/InspectorMemoryAgent.cpp: * inspector/InspectorNetworkAgent.cpp: * inspector/InspectorOverlay.cpp: * inspector/InspectorPageAgent.cpp: * inspector/InspectorShaderProgram.cpp: * inspector/InspectorStyleSheet.cpp: * inspector/InspectorTimelineAgent.cpp: * inspector/InspectorWorkerAgent.cpp: * inspector/InstrumentingAgents.cpp: * inspector/NetworkResourcesData.cpp: * inspector/PageConsoleAgent.cpp: * inspector/PageDebuggerAgent.cpp: * inspector/PageHeapAgent.cpp: * inspector/PageRuntimeAgent.cpp: * inspector/PageScriptDebugServer.cpp: * inspector/TimelineRecordFactory.cpp: * inspector/WebConsoleAgent.cpp: * inspector/WebDebuggerAgent.cpp: * inspector/WebHeapAgent.cpp: * inspector/WebInjectedScriptHost.cpp: * inspector/WebInjectedScriptManager.cpp: * inspector/WorkerConsoleAgent.cpp: * inspector/WorkerDebuggerAgent.cpp: * inspector/WorkerInspectorController.cpp: * inspector/WorkerRuntimeAgent.cpp: * inspector/WorkerScriptDebugServer.cpp: * loader/FTPDirectoryParser.cpp: * loader/TextResourceDecoder.cpp: * loader/cache/CachedResource.cpp: * loader/cache/CachedResourceLoader.cpp: * page/ContextMenuController.cpp: * page/DOMWindow.cpp: * page/Navigator.cpp: * page/PageConsoleClient.cpp: * page/PageDebuggable.cpp: * page/cocoa/ResourceUsageOverlayCocoa.mm: * page/csp/ContentSecurityPolicy.cpp: * page/csp/ContentSecurityPolicyDirectiveList.cpp: (WebCore::isNotASCIISpace): Deleted. * page/csp/ContentSecurityPolicyMediaListDirective.cpp: (WebCore::isNotASCIISpace): Deleted. * page/scrolling/ios/ScrollingTreeIOS.cpp: * page/scrolling/ios/ScrollingTreeIOS.h: * page/scrolling/mac/ScrollingTreeFixedNode.mm: (WebCore::ScrollingTreeFixedNode::updateLayersAfterAncestorChange): (WebCore::operator*): Deleted. * page/scrolling/mac/ScrollingTreeStickyNode.mm: (WebCore::ScrollingTreeStickyNode::updateLayersAfterAncestorChange): (WebCore::operator*): Deleted. * platform/Length.cpp: * platform/URL.cpp: (WebCore::isSchemeFirstChar): (WebCore::isSchemeChar): (WebCore::isBadChar): (WebCore::isTabNewline): * platform/audio/WebAudioBufferList.cpp: (WebCore::WebAudioBufferList::WebAudioBufferList): * platform/audio/mac/AudioSampleDataSource.mm: (WebCore::AudioSampleDataSource::pushSamples): * platform/cf/CoreMediaSoftLink.cpp: Removed. * platform/cf/CoreMediaSoftLink.h: Removed. * platform/encryptedmedia/clearkey/CDMClearKey.cpp: * platform/graphics/FloatPolygon.cpp: (WebCore::areCollinearPoints): (WebCore::FloatPolygon::FloatPolygon): (WebCore::VertexPair::intersection const): (WebCore::determinant): Deleted. * platform/graphics/FontCache.cpp: * platform/graphics/FontCascade.cpp: * platform/graphics/GraphicsContext3DPrivate.cpp: * platform/graphics/WidthIterator.cpp: * platform/graphics/avfoundation/AudioSourceProviderAVFObjC.mm: (WebCore::AudioSourceProviderAVFObjC::process): * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp: (WebCore::InbandTextTrackPrivateAVF::processCueAttributes): (WebCore::InbandTextTrackPrivateAVF::processNativeSamples): (WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer): * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp: * platform/graphics/avfoundation/objc/AVAssetTrackUtilities.mm: (WebCore::assetTrackMeetsHardwareDecodeRequirements): * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm: * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: (WebCore::ImageDecoderAVFObjC::readSampleMetadata): (WebCore::ImageDecoderAVFObjC::storeSampleBuffer): (WebCore::ImageDecoderAVFObjC::frameIsCompleteAtIndex const): * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: (WebCore::MediaPlayerPrivateAVFoundationObjC::createImageGenerator): * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm: * platform/graphics/avfoundation/objc/MediaSampleAVFObjC.mm: * platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm: * platform/graphics/ca/win/PlatformCALayerWinInternal.cpp: * platform/graphics/ca/win/WebTiledBackingLayerWin.cpp: * platform/graphics/cairo/GraphicsContextCairo.cpp: * platform/graphics/cairo/ImageBufferCairo.cpp: * platform/graphics/cg/ImageBufferCG.cpp: (WebCore::ImageBuffer::ImageBuffer): (WebCore::releaseImageData): Deleted. * platform/graphics/cg/ImageBufferDataCG.h: * platform/graphics/cocoa/WebCoreDecompressionSession.mm: * platform/graphics/gstreamer/ImageGStreamerCairo.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamer.cpp: * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp: * platform/graphics/ios/DisplayRefreshMonitorIOS.mm: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: * platform/graphics/opentype/OpenTypeMathData.cpp: * platform/graphics/opentype/OpenTypeVerticalData.cpp: * platform/graphics/transforms/MatrixTransformOperation.cpp: (WebCore::MatrixTransformOperation::blend): (WebCore::createOperation): Deleted. * platform/graphics/win/FontPlatformDataCairoWin.cpp: * platform/graphics/win/FontWin.cpp: * platform/graphics/win/GraphicsContextCGWin.cpp: * platform/graphics/win/GraphicsContextCairoWin.cpp: * platform/graphics/win/GraphicsContextDirect2D.cpp: * platform/graphics/win/GraphicsContextWin.cpp: * platform/graphics/win/UniscribeController.cpp: * platform/image-decoders/ScalableImageDecoder.cpp: (): Deleted. * platform/ios/LegacyTileLayer.mm: (-[LegacyTileHostLayer renderInContext:]): * platform/ios/PlaybackSessionInterfaceAVKit.mm: * platform/ios/ScrollAnimatorIOS.mm: * platform/ios/VideoFullscreenInterfaceAVKit.mm: * platform/ios/WebAVPlayerController.mm: (-[WebAVPlayerController skipBackwardThirtySeconds:]): (-[WebAVPlayerController gotoEndOfSeekableRanges:]): (-[WebAVPlayerController canSeekToBeginning]): (-[WebAVPlayerController canSeekToEnd]): (-[WebAVPlayerController observeValueForKeyPath:ofObject:change:context:]): (-[WebAVPlayerController updateMinMaxTiming]): * platform/ios/WebEvent.mm: * platform/ios/WebItemProviderPasteboard.mm: * platform/ios/wak/WKContentObservation.cpp: * platform/mac/KeyEventMac.mm: * platform/mac/PlaybackSessionInterfaceMac.mm: (WebCore::timeRangesToArray): * platform/mac/ScrollAnimatorMac.mm: (macScrollbarTheme): Deleted. (scrollerImpForScrollbar): Deleted. * platform/mac/ScrollbarThemeMac.mm: (WebCore::scrollbarMap): * platform/mac/VideoFullscreenInterfaceMac.mm: * platform/mac/WebCoreFullScreenPlaceholderView.mm: * platform/mac/WebCoreNSURLExtras.mm: (WebCore::dataForURLComponentType): * platform/mac/WebPlaybackControlsManager.mm: * platform/mac/WebVideoFullscreenController.mm: (SOFT_LINK_CLASS): Deleted. * platform/mac/WebVideoFullscreenHUDWindowController.mm: * platform/mac/WebWindowAnimation.mm: (WebWindowAnimationDurationFromDuration): Deleted. (scaledRect): Deleted. (squaredDistance): Deleted. * platform/mediastream/RealtimeOutgoingVideoSource.cpp: * platform/mediastream/mac/AVCaptureDeviceManager.mm: * platform/mediastream/mac/AVMediaCaptureSource.mm: * platform/mediastream/mac/AVVideoCaptureSource.mm: (WebCore::AVVideoCaptureSource::applyFrameRate): (WebCore::AVVideoCaptureSource::processNewFrame): * platform/mediastream/mac/AudioTrackPrivateMediaStreamCocoa.cpp: * platform/mediastream/mac/CoreAudioCaptureDevice.cpp: * platform/mediastream/mac/CoreAudioCaptureDeviceManager.cpp: * platform/mediastream/mac/CoreAudioCaptureSource.cpp: * platform/mediastream/mac/MockRealtimeAudioSourceMac.mm: * platform/mediastream/mac/MockRealtimeVideoSourceMac.mm: (WebCore::MockRealtimeVideoSourceMac::CMSampleBufferFromPixelBuffer): * platform/mediastream/mac/RealtimeIncomingAudioSourceCocoa.cpp: * platform/mediastream/mac/RealtimeIncomingVideoSourceCocoa.cpp: * platform/mediastream/mac/RealtimeOutgoingVideoSourceCocoa.cpp: * platform/mediastream/mac/WebAudioSourceProviderAVFObjC.mm: * platform/network/HTTPParsers.cpp: * platform/text/LocaleICU.cpp: * platform/text/TextCodecLatin1.cpp: * platform/text/TextCodecUTF8.cpp: * platform/text/TextEncodingRegistry.cpp: * platform/text/win/LocaleWin.cpp: * platform/win/BString.cpp: * platform/win/KeyEventWin.cpp: * platform/win/ScrollbarThemeWin.cpp: * rendering/BidiRun.cpp: * rendering/FloatingObjects.cpp: * rendering/RenderBlock.cpp: * rendering/RenderListMarker.cpp: * rendering/RenderQuote.cpp: * rendering/RenderText.cpp: * rendering/RenderThemeWin.cpp: * testing/Internals.cpp: * testing/js/WebCoreTestSupport.cpp: * workers/WorkerConsoleClient.cpp: * workers/WorkerGlobalScope.cpp: * workers/WorkerInspectorProxy.cpp: * xml/SoftLinkLibxslt.cpp: Added. * xml/SoftLinkLibxslt.h: Added. * xml/XPathGrammar.cpp: * xml/XPathParser.cpp: * xml/XSLStyleSheetLibxslt.cpp: * xml/XSLTExtensions.cpp: * xml/XSLTProcessorLibxslt.cpp: * xml/XSLTUnicodeSort.cpp: (xsltTransformErrorTrampoline): (WebCore::xsltUnicodeSortFunction): * xml/parser/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::updateLeafTextNode): (WebCore::toString): Deleted. Source/WebCore/PAL: Move soft linking code from WebCore to PAL. * Configurations/FeatureDefines.xcconfig: * pal/cf/CoreMediaSoftLink.cpp: * pal/cf/CoreMediaSoftLink.h: * pal/spi/cocoa/NSAttributedStringSPI.h: Source/WebKit: * Configurations/FeatureDefines.xcconfig: Source/WebKitLegacy/mac: * Configurations/FeatureDefines.xcconfig: Source/WTF: * wtf/Platform.h: * wtf/cocoa/SoftLinking.h: Tools: * TestWebKitAPI/Configurations/FeatureDefines.xcconfig: Canonical link: https://commits.webkit.org/194602@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223476 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2017-10-17 07:10:58 +00:00
using namespace Inspector;
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope https://bugs.webkit.org/show_bug.cgi?id=218108 Reviewed by Darin Adler and Devin Rousso. Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope, in preparation for Worklets support. This will allow us to reuse this code when we add Web Inspector support for Worklets. No new tests, no behavior change yet. * Modules/webaudio/AudioWorkletThread.cpp: (WebCore::AudioWorkletThread::workerDebuggerProxy const): * Modules/webaudio/AudioWorkletThread.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::instrumentingAgentsForWebGPUDevice): (WebCore::InspectorInstrumentation::consoleAgentEnabled): (WebCore::InspectorInstrumentation::timelineAgentTracking): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didClearWindowObjectInWorld): (WebCore::InspectorInstrumentation::isDebuggerPaused): (WebCore::InspectorInstrumentation::identifierForNode): (WebCore::InspectorInstrumentation::addEventListenersToNode): (WebCore::InspectorInstrumentation::willInsertDOMNode): (WebCore::InspectorInstrumentation::didInsertDOMNode): (WebCore::InspectorInstrumentation::willRemoveDOMNode): (WebCore::InspectorInstrumentation::didRemoveDOMNode): (WebCore::InspectorInstrumentation::willModifyDOMAttr): (WebCore::InspectorInstrumentation::didModifyDOMAttr): (WebCore::InspectorInstrumentation::didRemoveDOMAttr): (WebCore::InspectorInstrumentation::willInvalidateStyleAttr): (WebCore::InspectorInstrumentation::didInvalidateStyleAttr): (WebCore::InspectorInstrumentation::documentDetached): (WebCore::InspectorInstrumentation::frameWindowDiscarded): (WebCore::InspectorInstrumentation::mediaQueryResultChanged): (WebCore::InspectorInstrumentation::activeStyleSheetsUpdated): (WebCore::InspectorInstrumentation::didPushShadowRoot): (WebCore::InspectorInstrumentation::willPopShadowRoot): (WebCore::InspectorInstrumentation::didChangeCustomElementState): (WebCore::InspectorInstrumentation::pseudoElementCreated): (WebCore::InspectorInstrumentation::pseudoElementDestroyed): (WebCore::InspectorInstrumentation::didCreateNamedFlow): (WebCore::InspectorInstrumentation::willRemoveNamedFlow): (WebCore::InspectorInstrumentation::didChangeRegionOverset): (WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::mouseDidMoveOverElement): (WebCore::InspectorInstrumentation::handleTouchEvent): (WebCore::InspectorInstrumentation::handleMousePress): (WebCore::InspectorInstrumentation::forcePseudoState): (WebCore::InspectorInstrumentation::characterDataModified): (WebCore::InspectorInstrumentation::willSendXMLHttpRequest): (WebCore::InspectorInstrumentation::willFetch): (WebCore::InspectorInstrumentation::didInstallTimer): (WebCore::InspectorInstrumentation::didRemoveTimer): (WebCore::InspectorInstrumentation::didAddEventListener): (WebCore::InspectorInstrumentation::willRemoveEventListener): (WebCore::InspectorInstrumentation::isEventListenerDisabled): (WebCore::InspectorInstrumentation::willPostMessage): (WebCore::InspectorInstrumentation::didPostMessage): (WebCore::InspectorInstrumentation::didFailPostMessage): (WebCore::InspectorInstrumentation::willDispatchPostMessage): (WebCore::InspectorInstrumentation::didDispatchPostMessage): (WebCore::InspectorInstrumentation::willCallFunction): (WebCore::InspectorInstrumentation::didCallFunction): (WebCore::InspectorInstrumentation::willDispatchEvent): (WebCore::InspectorInstrumentation::didDispatchEvent): (WebCore::InspectorInstrumentation::willHandleEvent): (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::willDispatchEventOnWindow): (WebCore::InspectorInstrumentation::didDispatchEventOnWindow): (WebCore::InspectorInstrumentation::eventDidResetAfterDispatch): (WebCore::InspectorInstrumentation::willEvaluateScript): (WebCore::InspectorInstrumentation::didEvaluateScript): (WebCore::InspectorInstrumentation::willFireTimer): (WebCore::InspectorInstrumentation::didFireTimer): (WebCore::InspectorInstrumentation::didInvalidateLayout): (WebCore::InspectorInstrumentation::willLayout): (WebCore::InspectorInstrumentation::didLayout): (WebCore::InspectorInstrumentation::didScroll): (WebCore::InspectorInstrumentation::willComposite): (WebCore::InspectorInstrumentation::didComposite): (WebCore::InspectorInstrumentation::willPaint): (WebCore::InspectorInstrumentation::didPaint): (WebCore::InspectorInstrumentation::willRecalculateStyle): (WebCore::InspectorInstrumentation::didRecalculateStyle): (WebCore::InspectorInstrumentation::didScheduleStyleRecalculation): (WebCore::InspectorInstrumentation::applyUserAgentOverride): (WebCore::InspectorInstrumentation::applyEmulatedMedia): (WebCore::InspectorInstrumentation::willSendRequest): (WebCore::InspectorInstrumentation::willSendRequestOfType): (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache): (WebCore::InspectorInstrumentation::didReceiveResourceResponse): (WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponse): (WebCore::InspectorInstrumentation::didReceiveData): (WebCore::InspectorInstrumentation::didFinishLoading): (WebCore::InspectorInstrumentation::didFailLoading): (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied): (WebCore::InspectorInstrumentation::continueWithPolicyDownload): (WebCore::InspectorInstrumentation::continueWithPolicyIgnore): (WebCore::InspectorInstrumentation::willLoadXHRSynchronously): (WebCore::InspectorInstrumentation::didLoadXHRSynchronously): (WebCore::InspectorInstrumentation::scriptImported): (WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSP): (WebCore::InspectorInstrumentation::didReceiveScriptResponse): (WebCore::InspectorInstrumentation::domContentLoadedEventFired): (WebCore::InspectorInstrumentation::loadEventFired): (WebCore::InspectorInstrumentation::frameDetachedFromParent): (WebCore::InspectorInstrumentation::didCommitLoad): (WebCore::InspectorInstrumentation::frameDocumentUpdated): (WebCore::InspectorInstrumentation::loaderDetachedFromFrame): (WebCore::InspectorInstrumentation::frameStartedLoading): (WebCore::InspectorInstrumentation::frameStoppedLoading): (WebCore::InspectorInstrumentation::frameScheduledNavigation): (WebCore::InspectorInstrumentation::frameClearedScheduledNavigation): (WebCore::InspectorInstrumentation::defaultAppearanceDidChange): (WebCore::InspectorInstrumentation::willIntercept): (WebCore::InspectorInstrumentation::shouldInterceptRequest): (WebCore::InspectorInstrumentation::shouldInterceptResponse): (WebCore::InspectorInstrumentation::interceptRequest): (WebCore::InspectorInstrumentation::interceptResponse): (WebCore::InspectorInstrumentation::didOpenDatabase): (WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent): (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStart): (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::didCreateWebSocket): (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest): (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorInstrumentation::didCloseWebSocket): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrame): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrameError): (WebCore::InspectorInstrumentation::didSendWebSocketFrame): (WebCore::InspectorInstrumentation::didHandleMemoryPressure): (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes): (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext): (WebCore::InspectorInstrumentation::didChangeCanvasMemory): (WebCore::InspectorInstrumentation::recordCanvasAction): (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame): (WebCore::InspectorInstrumentation::didEnableExtension): (WebCore::InspectorInstrumentation::didCreateWebGLProgram): (WebCore::InspectorInstrumentation::willDestroyWebGLProgram): (WebCore::InspectorInstrumentation::isWebGLProgramDisabled): (WebCore::InspectorInstrumentation::isWebGLProgramHighlighted): (WebCore::InspectorInstrumentation::willConfigureSwapChain): (WebCore::InspectorInstrumentation::willDestroyWebGPUPipeline): (WebCore::InspectorInstrumentation::willApplyKeyframeEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationName): (WebCore::InspectorInstrumentation::didSetWebAnimationEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTiming): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTarget): (WebCore::InspectorInstrumentation::didCreateWebAnimation): (WebCore::InspectorInstrumentation::willDestroyWebAnimation): (WebCore::InspectorInstrumentation::networkStateChanged): (WebCore::InspectorInstrumentation::updateApplicationCacheStatus): (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore::InspectorInstrumentation::consoleCount): (WebCore::InspectorInstrumentation::consoleCountReset): (WebCore::InspectorInstrumentation::takeHeapSnapshot): (WebCore::InspectorInstrumentation::startConsoleTiming): (WebCore::InspectorInstrumentation::logConsoleTiming): (WebCore::InspectorInstrumentation::stopConsoleTiming): (WebCore::InspectorInstrumentation::consoleTimeStamp): (WebCore::InspectorInstrumentation::startProfiling): (WebCore::InspectorInstrumentation::stopProfiling): (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas): (WebCore::InspectorInstrumentation::consoleStopRecordingCanvas): (WebCore::InspectorInstrumentation::didRequestAnimationFrame): (WebCore::InspectorInstrumentation::didCancelAnimationFrame): (WebCore::InspectorInstrumentation::willFireAnimationFrame): (WebCore::InspectorInstrumentation::didFireAnimationFrame): (WebCore::InspectorInstrumentation::willFireObserverCallback): (WebCore::InspectorInstrumentation::didFireObserverCallback): (WebCore::InspectorInstrumentation::layerTreeDidChange): (WebCore::InspectorInstrumentation::renderLayerDestroyed): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForFrame): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForDocument): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. * inspector/InspectorWebAgentBase.h: (WebCore::WorkerAgentContext::WorkerAgentContext): * inspector/WorkerDebugger.cpp: (WebCore::WorkerDebugger::WorkerDebugger): (WebCore::WorkerDebugger::attachDebugger): (WebCore::WorkerDebugger::detachDebugger): (WebCore::WorkerDebugger::runEventLoopWhilePaused): * inspector/WorkerDebugger.h: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::workerAgentContext): (WebCore::WorkerInspectorController::createLazyAgents): (WebCore::WorkerInspectorController::vm): * inspector/WorkerInspectorController.h: * inspector/WorkerToPageFrontendChannel.h: * inspector/agents/worker/ServiceWorkerAgent.cpp: (WebCore::ServiceWorkerAgent::ServiceWorkerAgent): * inspector/agents/worker/WorkerAuditAgent.cpp: (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/agents/worker/WorkerAuditAgent.h: * inspector/agents/worker/WorkerConsoleAgent.cpp: (WebCore::WorkerConsoleAgent::WorkerConsoleAgent): * inspector/agents/worker/WorkerDebuggerAgent.cpp: (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent): (WebCore::WorkerDebuggerAgent::breakpointActionLog): (WebCore::WorkerDebuggerAgent::injectedScriptForEval): * inspector/agents/worker/WorkerDebuggerAgent.h: * inspector/agents/worker/WorkerNetworkAgent.cpp: (WebCore::WorkerNetworkAgent::WorkerNetworkAgent): (WebCore::WorkerNetworkAgent::setResourceCachingDisabledInternal): (WebCore::WorkerNetworkAgent::scriptExecutionContext): * inspector/agents/worker/WorkerNetworkAgent.h: * inspector/agents/worker/WorkerRuntimeAgent.cpp: (WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent): (WebCore::WorkerRuntimeAgent::injectedScriptForEval): * inspector/agents/worker/WorkerRuntimeAgent.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::prepareForDestruction): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController const): Deleted. * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): (WebCore::WorkerOrWorkletGlobalScope::prepareForDestruction): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::inspectorController const): * workers/WorkerOrWorkletThread.h: * workers/WorkerThread.h: (WebCore::WorkerThread::workerDebuggerProxy const): Deleted. Canonical link: https://commits.webkit.org/230818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-23 01:00:04 +00:00
WorkerDebugger::WorkerDebugger(WorkerOrWorkletGlobalScope& context)
Web Inspector: allow event breakpoints to be configured https://bugs.webkit.org/show_bug.cgi?id=215362 <rdar://problem/66932921> Reviewed by Brian Burg. Source/JavaScriptCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * inspector/protocol/DOM.json: Add an `options` paramater to `DOM.setBreakpointForEventListener` to allow configuration. * inspector/protocol/DOMDebugger.json: Add an `options` paramater to `DOMDebugger.setEventBreakpoint` to allow configuration. * debugger/Breakpoint.h: (JSC::Breakpoint::id const): Added. (JSC::Breakpoint::sourceID const): Added. (JSC::Breakpoint::lineNumber const): Added. (JSC::Breakpoint::columnNumber const): Added. (JSC::Breakpoint::condition const): Added. (JSC::Breakpoint::actions const): Added. (JSC::Breakpoint::isAutoContinue const): Added. (JSC::Breakpoint::resetHitCount): Added. (JSC::Breakpoint::isLinked const): Added. (JSC::Breakpoint::isResolved const): Added. (JSC::BreakpointsList::~BreakpointsList): Deleted. * debugger/Breakpoint.cpp: Added. (JSC::Breakpoint::Action::Action): Added. (JSC::Breakpoint::create): Added. (JSC::Breakpoint::Breakpoint): Added. (JSC::Breakpoint::link): Added. (JSC::Breakpoint::resolve): Added. (JSC::Breakpoint::shouldPause): Added. Unify `JSC::Breakpoint` and `Inspector::ScriptBreakpoint`. * debugger/DebuggerPrimitives.h: * debugger/Debugger.h: * debugger/Debugger.cpp: (JSC::Debugger::Debugger): (JSC::Debugger::addObserver): Added. (JSC::Debugger::removeObserver): Added. (JSC::Debugger::canDispatchFunctionToObservers const): Added. (JSC::Debugger::dispatchFunctionToObservers): Added. (JSC::Debugger::sourceParsed): Added. (JSC::Debugger::toggleBreakpoint): (JSC::Debugger::applyBreakpoints): (JSC::Debugger::resolveBreakpoint): (JSC::Debugger::setBreakpoint): (JSC::Debugger::removeBreakpoint): (JSC::Debugger::didHitBreakpoint): Added. (JSC::Debugger::clearBreakpoints): (JSC::Debugger::evaluateBreakpointCondition): Added. (JSC::Debugger::evaluateBreakpointActions): Added. (JSC::Debugger::schedulePauseAtNextOpportunity): Added. (JSC::Debugger::cancelPauseAtNextOpportunity): Added. (JSC::Debugger::schedulePauseForSpecialBreakpoint): Added. (JSC::Debugger::cancelPauseForSpecialBreakpoint): Added. (JSC::Debugger::continueProgram): (JSC::Debugger::stepNextExpression): (JSC::Debugger::stepIntoStatement): (JSC::Debugger::stepOverStatement): (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::pauseIfNeeded): (JSC::Debugger::handlePause): Added. (JSC::Debugger::exceptionOrCaughtValue): Added. (JSC::Debugger::atExpression): (JSC::Debugger::clearNextPauseState): (JSC::Debugger::willRunMicrotask): Added. (JSC::Debugger::didRunMicrotask): Added. (JSC::Debugger::hasBreakpoint): Deleted. (JSC::Debugger::setPauseOnNextStatement): Deleted. Unify `JSC::Debugger` and `Inspector::ScriptDebugServer` to simplify breakpoint logic. Introduce the concept of a "special breakpoint", which is essentially a `JSC::Breakpoint` that is expected to pause at the next opportunity but isn't tied to a particular location. As an example, whenever an event breakpoint is hit, instead of just pausing at the next opportunity, the newly managed `JSC::Breakpoint` is used as a "special breakpoint", allowing for it's configuration (ie.g. condition, ignore count, actions, auto-continue) to be used. * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::objectGroupForBreakpointAction): (Inspector::breakpointActionTypeForString): Added. (Inspector::parseBreakpointOptions): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::fromPayload): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::ProtocolBreakpoint): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::createDebuggerBreakpoint const): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::matchesScriptURL const): Added. (Inspector::InspectorDebuggerAgent::debuggerBreakpointFromPayload): Added. (Inspector::InspectorDebuggerAgent::enable): (Inspector::InspectorDebuggerAgent::disable): (Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason): (Inspector::InspectorDebuggerAgent::handleConsoleAssert): (Inspector::InspectorDebuggerAgent::didScheduleAsyncCall): (Inspector::buildDebuggerLocation): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::didSetBreakpoint): (Inspector::InspectorDebuggerAgent::resolveBreakpoint): (Inspector::InspectorDebuggerAgent::removeBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::schedulePauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::cancelPauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::schedulePauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::cancelPauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::pause): (Inspector::InspectorDebuggerAgent::resume): (Inspector::InspectorDebuggerAgent::didBecomeIdle): (Inspector::InspectorDebuggerAgent::sourceMapURLForScript): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::willRunMicrotask): (Inspector::InspectorDebuggerAgent::didRunMicrotask): (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionSound): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::clearInspectorBreakpointState): (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): (Inspector::matches): Deleted. (Inspector::buildObjectForBreakpointCookie): Deleted. (Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol): Deleted. (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): Deleted. (Inspector::InspectorDebuggerAgent::cancelPauseOnNextStatement): Deleted. Create a private `ProtocolBreakpoint` class that holds the data sent by the frontend. This is necessary because breakpoints in the frontend have a potentially one-to-many relationship with breakpoints in the backend, as the same script can be loaded many times on a page. Each of those scripts is independent, however, and can execute differently, meaning that the same breakpoint for each script also needs a different state (e.g. ignore count). As such, the `ProtocolBreakpoint` is effectively a template that is actualized whenever a new script is parsed that matches the URL of the `ProtocolBreakpoint` to create a `JSC::Breakpoint` that is used by the `JSC::Debugger`. `ProtocolBreakpoint` also parses breakpoint configurations. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectScriptDebugServer.h: * inspector/JSGlobalObjectScriptDebugServer.cpp: (Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer): (Inspector::JSGlobalObjectScriptDebugServer::attachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::detachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused): * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: (Inspector::InspectorAuditAgent::run): * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::setPauseOnExceptionsState): (Inspector::InspectorRuntimeAgent::evaluate): (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::getPreview): (Inspector::InspectorRuntimeAgent::getProperties): (Inspector::InspectorRuntimeAgent::getDisplayableProperties): * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.h: Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * runtime/JSMicrotask.cpp: (JSC::JSMicrotask::run): Drive-by: r248894 mistakenly omitted the call to notify the debugger that the microtask ran. * inspector/ScriptBreakpoint.h: Removed. * inspector/ScriptDebugListener.h: Removed. * inspector/ScriptDebugServer.h: Removed. * inspector/ScriptDebugServer.cpp: Removed. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: Source/WebCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing Tests: inspector/dom/breakpoint-for-event-listener.html inspector/dom-debugger/event-animation-frame-breakpoints.html inspector/dom-debugger/event-interval-breakpoints.html inspector/dom-debugger/event-listener-breakpoints.html inspector/dom-debugger/event-timeout-breakpoints.html * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::getEventListenersForNode): (WebCore::InspectorDOMAgent::setBreakpointForEventListener): (WebCore::InspectorDOMAgent::removeBreakpointForEventListener): (WebCore::InspectorDOMAgent::buildObjectForEventListener): (WebCore::InspectorDOMAgent::breakpointForEventListener): (WebCore::InspectorDOMAgent::hasBreakpointForEventListener): Deleted. * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::disable): (WebCore::InspectorDOMDebuggerAgent::mainFrameNavigated): (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::willHandleEvent): (WebCore::InspectorDOMDebuggerAgent::didHandleEvent): (WebCore::InspectorDOMDebuggerAgent::willFireTimer): (WebCore::InspectorDOMDebuggerAgent::didFireTimer): * inspector/agents/page/PageDOMDebuggerAgent.h: * inspector/agents/page/PageDOMDebuggerAgent.cpp: (WebCore::PageDOMDebuggerAgent::disable): (WebCore::PageDOMDebuggerAgent::mainFrameNavigated): (WebCore::PageDOMDebuggerAgent::willFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::didFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::setAnimationFrameBreakpoint): * inspector/agents/worker/WorkerDOMDebuggerAgent.h: * inspector/agents/worker/WorkerDOMDebuggerAgent.cpp: (WebCore::WorkerDOMDebuggerAgent::setAnimationFrameBreakpoint): Keep a `JSC::Breakpoint` for each event breakpoint instead of a simple `bool`, allowing for configuration when the breakpoint is first set. When any of these breakpoints are hit, pass it to the `JSC::Debugger` as a "special breakpoint", which behaves the same as "pause ASAP" but also supports a condition, an ignore count, actions, and auto-continue. Reset the hit count for any of these "special breakpoints" that persist across Web Inspector sessions when the main frame navigates. * inspector/PageScriptDebugServer.h: * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::PageScriptDebugServer): (WebCore::PageScriptDebugServer::attachDebugger): (WebCore::PageScriptDebugServer::detachDebugger): (WebCore::PageScriptDebugServer::didPause): (WebCore::PageScriptDebugServer::didContinue): (WebCore::PageScriptDebugServer::runEventLoopWhilePaused): (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal): (WebCore::PageScriptDebugServer::isContentScript const): (WebCore::PageScriptDebugServer::reportException const): * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException const): * inspector/agents/page/PageDebuggerAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: (WebCore::PageDebuggerAgent::sourceMapURLForScript): Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * inspector/TimelineRecordFactory.h: * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createProbeSampleData): * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::breakpointActionProbe): Replace `Inspector::ScriptBreakpoint` with `JSC::Breakpoint`. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::didFireTimer): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didHandleEventImpl): (WebCore::InspectorInstrumentation::didFireTimerImpl): (WebCore::InspectorInstrumentation::didCommitLoadImpl): (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl): * dom/EventTarget.cpp: (WebCore::EventTarget::innerInvokeEventListeners): * page/DOMTimer.cpp: (WebCore::DOMTimer::fired): When notifying Web Inspector that activity did occur, include all information previously included when notifying Web Inspector that that activity was about to occur so that Web Inspector can know whether a pause for the "special breakpoint" for that activity is still scheduled and if so cancel it. Source/WebInspectorUI: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * UserInterface/Models/Breakpoint.js: (WI.Breakpoint): (WI.Breakpoint.prototype.toJSON): (WI.Breakpoint.prototype.get special): Added. (WI.Breakpoint.prototype.get removable): Added. (WI.Breakpoint.prototype.get editable): Added. (WI.Breakpoint.prototype.set condition): (WI.Breakpoint.prototype.get ignoreCount): (WI.Breakpoint.prototype.set ignoreCount): (WI.Breakpoint.prototype.get autoContinue): (WI.Breakpoint.prototype.set autoContinue): (WI.Breakpoint.prototype.get actions): (WI.Breakpoint.prototype.get probeActions): (WI.Breakpoint.prototype.cycleToNextMode): (WI.Breakpoint.prototype.createAction): (WI.Breakpoint.prototype.recreateAction): (WI.Breakpoint.prototype.removeAction): (WI.Breakpoint.prototype.clearActions): (WI.Breakpoint.prototype.remove): Added. (WI.Breakpoint.prototype.optionsToProtocol): Added. (WI.Breakpoint.prototype.breakpointActionDidChange): (WI.Breakpoint.fromJSON): Deleted. (WI.Breakpoint.prototype.get sourceCodeLocation): Deleted. (WI.Breakpoint.prototype.get contentIdentifier): Deleted. (WI.Breakpoint.prototype.get scriptIdentifier): Deleted. (WI.Breakpoint.prototype.get target): Deleted. (WI.Breakpoint.prototype.get identifier): Deleted. (WI.Breakpoint.prototype.set identifier): Deleted. (WI.Breakpoint.prototype.get resolved): Deleted. (WI.Breakpoint.prototype.set resolved): Deleted. (WI.Breakpoint.prototype.saveIdentityToCookie): Deleted. (WI.Breakpoint.prototype._isSpecial): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationLocationChanged): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationDisplayLocationChanged): Deleted. * UserInterface/Models/DOMBreakpoint.js: (WI.DOMBreakpoint): (WI.DOMBreakpoint.fromJSON): Added. (WI.DOMBreakpoint.prototype.remove): Added. (WI.DOMBreakpoint.prototype.toJSON): (WI.DOMBreakpoint.deserialize): Deleted. (WI.DOMBreakpoint.prototype.get disabled): Deleted. (WI.DOMBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/EventBreakpoint.js: (WI.EventBreakpoint): (WI.EventBreakpoint.fromJSON): Added. (WI.EventBreakpoint.prototype.get special): Added. (WI.EventBreakpoint.prototype.get editable): Added. (WI.EventBreakpoint.prototype.remove): Added. (WI.EventBreakpoint.prototype.saveIdentityToCookie): (WI.EventBreakpoint.prototype.toJSON): (WI.EventBreakpoint.deserialize): Deleted. (WI.EventBreakpoint.prototype.get disabled): Deleted. (WI.EventBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/JavaScriptBreakpoint.js: Copied from UserInterface/Models/Breakpoint.js. (WI.JavaScriptBreakpoint): (WI.JavaScriptBreakpoint.fromJSON): (WI.JavaScriptBreakpoint.prototype.toJSON): (WI.JavaScriptBreakpoint.prototype.get sourceCodeLocation): (WI.JavaScriptBreakpoint.prototype.get contentIdentifier): (WI.JavaScriptBreakpoint.prototype.get scriptIdentifier): (WI.JavaScriptBreakpoint.prototype.get target): (WI.JavaScriptBreakpoint.prototype.get special): Added. (WI.JavaScriptBreakpoint.prototype.get removable): Added. (WI.JavaScriptBreakpoint.prototype.get editable): Added. (WI.JavaScriptBreakpoint.prototype.get identifier): (WI.JavaScriptBreakpoint.prototype.set identifier): (WI.JavaScriptBreakpoint.prototype.get resolved): (WI.JavaScriptBreakpoint.prototype.set resolved): (WI.JavaScriptBreakpoint.prototype.remove): Added. (WI.JavaScriptBreakpoint.prototype.saveIdentityToCookie): (WI.JavaScriptBreakpoint.prototype._isSpecial): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationLocationChanged): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationDisplayLocationChanged): * UserInterface/Models/URLBreakpoint.js: (WI.URLBreakpoint): (WI.URLBreakpoint.fromJSON): Added. (WI.URLBreakpoint.prototype.get special): Added. (WI.URLBreakpoint.prototype.remove): Added. (WI.URLBreakpoint.prototype.toJSON): (WI.URLBreakpoint.deserialize): Deleted. (WI.URLBreakpoint.prototype.get disabled): Deleted. (WI.URLBreakpoint.prototype.set disabled): Deleted. Rename `WI.Breakpoint` to `WI.JavaScriptBreakpoint` and use `WI.Breakpoint` as a new common base class for all breakpoint types, allowing more logic to be shared (e.g. disabled state). Additionally, breakpoints are now able to - determine whether or not they're - special - removable - editable (i.e. configurable) - remove themselves without the caller needing to know what manager to consult with. * UserInterface/Controllers/DOMManager.js: (WI.DOMManager): (WI.DOMManager.supportsEventListenerBreakpointConfiguration): Added. (WI.DOMManager.prototype.setBreakpointForEventListener): (WI.DOMManager.prototype.removeBreakpointForEventListener): (WI.DOMManager.prototype._setEventBreakpoint): Added. (WI.DOMManager.prototype._removeEventBreakpoint): Added. (WI.DOMManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for specific listener breakpoints. * UserInterface/Controllers/DOMDebuggerManager.js: (WI.DOMDebuggerManager): (WI.DOMDebuggerManager.prototype.initializeTarget): (WI.DOMDebuggerManager.prototype.addDOMBreakpoint): (WI.DOMDebuggerManager.prototype.removeDOMBreakpoint): (WI.DOMDebuggerManager.prototype.addEventBreakpoint): (WI.DOMDebuggerManager.prototype.removeEventBreakpoint): (WI.DOMDebuggerManager.prototype.addURLBreakpoint): (WI.DOMDebuggerManager.prototype.removeURLBreakpoint): (WI.DOMDebuggerManager.prototype._commandArgumentsForEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._setEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._removeEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointDisabledStateChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMDebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DOMDebuggerManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for special event breakpoints. Store special event breakpoints inside `WI.objectStores.eventBreakpoints`. * UserInterface/Controllers/DebuggerManager.js: (WI.DebuggerManager): (WI.DebuggerManager.prototype.addBreakpoint): (WI.DebuggerManager.prototype.removeBreakpoint): (WI.DebuggerManager.prototype.addProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.removeProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.updateProbesForBreakpoint): Added. (WI.DebuggerManager.prototype._setBreakpoint): (WI.DebuggerManager.prototype._breakpointEditablePropertyDidChange): (WI.DebuggerManager.prototype._handleBreakpointActionsDidChange): (WI.DebuggerManager.prototype.isBreakpointRemovable): Deleted. (WI.DebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DebuggerManager.prototype.isBreakpointEditable): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointActionType): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointOptions): Deleted. (WI.DebuggerManager.prototype._addProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._removeProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._updateProbesForBreakpoint): Deleted. Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Controllers/BreakpointPopoverController.js: (WI.BreakpointPopoverController.prototype.appendContextMenuItems): (WI.BreakpointPopoverController.prototype._createPopoverContent): Allow any breakpoint instead of only `WI.JavaScriptBreakpoint`. Drive-by: the existing `ignoreCount` value wasn't being used to populate the `<input>`. * UserInterface/Views/BreakpointTreeElement.js: (WI.BreakpointTreeElement.prototype.ondelete): (WI.BreakpointTreeElement.prototype.get listenerSet): Added. (WI.BreakpointTreeElement.prototype.updateStatus): Added. (WI.BreakpointTreeElement.prototype.updateTitles): Added. (WI.BreakpointTreeElement.prototype.get breakpoint): Deleted. (WI.BreakpointTreeElement.prototype.get filterableData): Deleted. (WI.BreakpointTreeElement.prototype._updateTitles): Deleted. (WI.BreakpointTreeElement.prototype._updateStatus): Deleted. (WI.BreakpointTreeElement.prototype._breakpointLocationDidChange): Deleted. * UserInterface/Views/BreakpointTreeElement.css: (.item.breakpoint .status > .status-image): (.item.breakpoint.paused .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.paused .icon): Added. (.item.breakpoint .status > .status-image.resolved): Deleted. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.selected .status > .status-image.resolved): Deleted. (.item.breakpoint .subtitle.formatted-location): Deleted. (.breakpoint-debugger-statement-icon .icon): Deleted. (.breakpoint-exception-icon .icon): Deleted. (.breakpoint-assertion-icon .icon): Deleted. (.breakpoint-microtask-icon .icon): Deleted. (.breakpoint-paused-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon > span): Deleted. (.data-updated.breakpoint-generic-line-icon .icon > span): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-debugger-statement-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-exception-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-assertion-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-microtask-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-paused-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-generic-line-icon .icon): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.js: (WI.DOMBreakpointTreeElement): (WI.DOMBreakpointTreeElement.prototype.onattach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondetach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondelete): Deleted. (WI.DOMBreakpointTreeElement.prototype.onenter): Deleted. (WI.DOMBreakpointTreeElement.prototype.onspace): Deleted. (WI.DOMBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.DOMBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.DOMBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.css: (.item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (.breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/EventBreakpointTreeElement.js: (WI.EventBreakpointTreeElement): (WI.EventBreakpointTreeElement.prototype.onattach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondetach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondelete): Deleted. (WI.EventBreakpointTreeElement.prototype.onenter): Deleted. (WI.EventBreakpointTreeElement.prototype.onspace): Deleted. (WI.EventBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.EventBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.EventBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/EventBreakpointTreeElement.css: (.item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (.item.breakpoint.event.interval:not(.paused) .icon): Added. (.item.breakpoint.event.listener:not(.paused) .icon): Added. (.item.breakpoint.event.timeout:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.interval:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.listener:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.timeout:not(.paused) .icon): Added. (.breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/JavaScriptBreakpointTreeElement.js: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js. (WI.JavaScriptBreakpointTreeElement): (WI.JavaScriptBreakpointTreeElement.prototype.get filterableData): (WI.JavaScriptBreakpointTreeElement.prototype.updateStatus): Added. (WI.JavaScriptBreakpointTreeElement.prototype.updateTitles): Added. (WI.JavaScriptBreakpointTreeElement.prototype._breakpointLocationDidChange): * UserInterface/Views/JavaScriptBreakpointTreeElement.css: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css. (.item.breakpoint.javascript .status > .status-image): Added. (.item.breakpoint.javascript .status > .status-image.resolved): Added. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.javascript.selected .status > .status-image.resolved): Added. (.item.breakpoint.javascript .subtitle.formatted-location): Added. (.item.breakpoint.javascript.line .icon): Added. (.item.breakpoint.javascript.line .icon > span): Added. (.data-updated.item.breakpoint.javascript.line .icon > span): Added. (.item.breakpoint.javascript.debugger-statement .icon): Added. (.item.breakpoint.javascript.exception .icon): Added. (.item.breakpoint.javascript.assertion .icon): Added. (.item.breakpoint.javascript.microtask .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.line .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.debugger-statement .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.exception .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.assertion .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.microtask .icon): Added. * UserInterface/Views/URLBreakpointTreeElement.js: (WI.URLBreakpointTreeElement): (WI.URLBreakpointTreeElement.prototype.onattach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondetach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondelete): Deleted. (WI.URLBreakpointTreeElement.prototype.onenter): Deleted. (WI.URLBreakpointTreeElement.prototype.onspace): Deleted. (WI.URLBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.URLBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.URLBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/URLBreakpointTreeElement.css: (.item.breakpoint.url .subtitle): Added. (.item.breakpoint.url:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.url:not(.paused) .icon): Added. (.breakpoint.url .subtitle): Deleted. (.breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. Rename `WI.BreakpointTreeElement` to `WI.JavaScriptBreakpointTreeElement` and use `WI.BreakpointTreeElement` as a new common base class for all breakpoint tree elements, allowing more logic and styles to be shared (e.g. disabled state). * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel): (WI.SourcesNavigationSidebarPanel.prototype.closed): (WI.SourcesNavigationSidebarPanel.prototype._insertDebuggerTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._compareJavaScriptBreakpointTreeElements): Added. (WI.SourcesNavigationSidebarPanel.prototype._addBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._removeAllBreakpoints): (WI.SourcesNavigationSidebarPanel.prototype._breakpointsBeneathTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._addIssue): (WI.SourcesNavigationSidebarPanel.prototype._updatePauseReasonSection): (WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange): (WI.SourcesNavigationSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu.addToggleForSpecialEventBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu): (WI.SourcesNavigationSidebarPanel.prototype._handleDebuggerObjectDisplayLocationDidChange): (WI.SourcesNavigationSidebarPanel.prototype._compareBreakpointTreeElements): Deleted. * UserInterface/Models/ProbeSet.js: (WI.ProbeSet): (WI.ProbeSet.prototype.createProbe): (WI.ProbeSet.prototype.willRemove): * UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.prototype._processRecord): * UserInterface/Views/ProbeSetDetailsSection.js: (WI.ProbeSetDetailsSection): * UserInterface/Views/ProbeDetailsSidebarPanel.js: (WI.ProbeDetailsSidebarPanel.prototype.inspect): * UserInterface/Views/SourceCodeTextEditor.js: (WI.SourceCodeTextEditor): (WI.SourceCodeTextEditor.prototype.close): (WI.SourceCodeTextEditor.prototype.textEditorBreakpointAdded): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype.get supplementalRepresentedObjects): (WI.TextResourceContentView.prototype._probeSetsChanged): Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Views/ContentView.js: (WI.ContentView.createFromRepresentedObject): (WI.ContentView.resolvedRepresentedObjectForRepresentedObject): (WI.ContentView.isViewable): * UserInterface/Views/ContextMenuUtilities.js: (WI.appendContextMenuItemsForSourceCode): Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. * UserInterface/Views/DOMTreeContentView.js: (WI.DOMTreeContentView): Replace `WI.DOMBreakpoint` with `WI.Breakpoint`. * UserInterface/Views/EventListenerSectionGroup.js: (WI.EventListenerSectionGroup): * UserInterface/Views/EventListenerSectionGroup.css: (.event-listener-section > .content input[type="checkbox"] + .go-to-arrow): Added. (.event-listener-section > .content input[type="checkbox"]:not(:checked) + .go-to-arrow): Added. Add a go-to arrow next to the Breakpoint checkbox that reveals the `WI.EventBreakpoint` in the Sources Tab. * UserInterface/Views/BreakpointActionView.js: (WI.BreakpointActionView.prototype._appendActionButtonClicked): Drive-by: minor code cleanup. * UserInterface/Views/CallFrameTreeElement.js: (WI.CallFrameTreeElement.prototype.populateContextMenu): Drive-by: include source code location context menu items. * UserInterface/Base/Setting.js: * UserInterface/Main.html: * UserInterface/Test.html: LayoutTests: * inspector/dom-debugger/resources/event-breakpoint-utilities.js: (TestPage.registerInitializer.InspectorTest.EventBreakpoint.addBreakpointOptionsTestCases): Added. (TestPage.registerInitializer.InspectorTest.EventBreakpoint.async teardown): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.createBreakpoint): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.removeBreakpoint): * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/breakpoint-for-event-listener-expected.txt: * inspector/dom-debugger/event-animation-frame-breakpoints.html: * inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt: * inspector/dom-debugger/event-interval-breakpoints.html: * inspector/dom-debugger/event-interval-breakpoints-expected.txt: * inspector/dom-debugger/event-listener-breakpoints.html: * inspector/dom-debugger/event-listener-breakpoints-expected.txt: * inspector/dom-debugger/event-timeout-breakpoints.html: * inspector/dom-debugger/event-timeout-breakpoints-expected.txt: Add tests for new event breakpoint configuration options. * http/tests/inspector/debugger/debugger-test.js: (TestPage.registerInitializer.InspectorTest.startTracingBreakpoints): * http/tests/inspector/resources/probe-test.js: (TestPage.registerInitializer.ProtocolTest.Probe.installTracingListeners): * inspector/debugger/breakpoint-action-eval.html: * inspector/debugger/breakpoint-action-log.html: * inspector/debugger/breakpoint-columns.html: * inspector/debugger/breakpoint-scope.html: * inspector/debugger/debugger-stack-overflow.html: * inspector/debugger/pause-reason.html: * inspector/debugger/probe-manager-add-remove-actions.html: * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/debugger/tail-deleted-frames-this-value.html: * inspector/debugger/tail-recursion.html: * inspector/worker/debugger-pause.html: * inspector/worker/debugger-shared-breakpoint.html: Update existing breakpoint tests to use new model objects. Canonical link: https://commits.webkit.org/228551@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 17:34:12 +00:00
: Debugger(context.script()->vm())
Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope https://bugs.webkit.org/show_bug.cgi?id=218108 Reviewed by Darin Adler and Devin Rousso. Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope, in preparation for Worklets support. This will allow us to reuse this code when we add Web Inspector support for Worklets. No new tests, no behavior change yet. * Modules/webaudio/AudioWorkletThread.cpp: (WebCore::AudioWorkletThread::workerDebuggerProxy const): * Modules/webaudio/AudioWorkletThread.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::instrumentingAgentsForWebGPUDevice): (WebCore::InspectorInstrumentation::consoleAgentEnabled): (WebCore::InspectorInstrumentation::timelineAgentTracking): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didClearWindowObjectInWorld): (WebCore::InspectorInstrumentation::isDebuggerPaused): (WebCore::InspectorInstrumentation::identifierForNode): (WebCore::InspectorInstrumentation::addEventListenersToNode): (WebCore::InspectorInstrumentation::willInsertDOMNode): (WebCore::InspectorInstrumentation::didInsertDOMNode): (WebCore::InspectorInstrumentation::willRemoveDOMNode): (WebCore::InspectorInstrumentation::didRemoveDOMNode): (WebCore::InspectorInstrumentation::willModifyDOMAttr): (WebCore::InspectorInstrumentation::didModifyDOMAttr): (WebCore::InspectorInstrumentation::didRemoveDOMAttr): (WebCore::InspectorInstrumentation::willInvalidateStyleAttr): (WebCore::InspectorInstrumentation::didInvalidateStyleAttr): (WebCore::InspectorInstrumentation::documentDetached): (WebCore::InspectorInstrumentation::frameWindowDiscarded): (WebCore::InspectorInstrumentation::mediaQueryResultChanged): (WebCore::InspectorInstrumentation::activeStyleSheetsUpdated): (WebCore::InspectorInstrumentation::didPushShadowRoot): (WebCore::InspectorInstrumentation::willPopShadowRoot): (WebCore::InspectorInstrumentation::didChangeCustomElementState): (WebCore::InspectorInstrumentation::pseudoElementCreated): (WebCore::InspectorInstrumentation::pseudoElementDestroyed): (WebCore::InspectorInstrumentation::didCreateNamedFlow): (WebCore::InspectorInstrumentation::willRemoveNamedFlow): (WebCore::InspectorInstrumentation::didChangeRegionOverset): (WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::mouseDidMoveOverElement): (WebCore::InspectorInstrumentation::handleTouchEvent): (WebCore::InspectorInstrumentation::handleMousePress): (WebCore::InspectorInstrumentation::forcePseudoState): (WebCore::InspectorInstrumentation::characterDataModified): (WebCore::InspectorInstrumentation::willSendXMLHttpRequest): (WebCore::InspectorInstrumentation::willFetch): (WebCore::InspectorInstrumentation::didInstallTimer): (WebCore::InspectorInstrumentation::didRemoveTimer): (WebCore::InspectorInstrumentation::didAddEventListener): (WebCore::InspectorInstrumentation::willRemoveEventListener): (WebCore::InspectorInstrumentation::isEventListenerDisabled): (WebCore::InspectorInstrumentation::willPostMessage): (WebCore::InspectorInstrumentation::didPostMessage): (WebCore::InspectorInstrumentation::didFailPostMessage): (WebCore::InspectorInstrumentation::willDispatchPostMessage): (WebCore::InspectorInstrumentation::didDispatchPostMessage): (WebCore::InspectorInstrumentation::willCallFunction): (WebCore::InspectorInstrumentation::didCallFunction): (WebCore::InspectorInstrumentation::willDispatchEvent): (WebCore::InspectorInstrumentation::didDispatchEvent): (WebCore::InspectorInstrumentation::willHandleEvent): (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::willDispatchEventOnWindow): (WebCore::InspectorInstrumentation::didDispatchEventOnWindow): (WebCore::InspectorInstrumentation::eventDidResetAfterDispatch): (WebCore::InspectorInstrumentation::willEvaluateScript): (WebCore::InspectorInstrumentation::didEvaluateScript): (WebCore::InspectorInstrumentation::willFireTimer): (WebCore::InspectorInstrumentation::didFireTimer): (WebCore::InspectorInstrumentation::didInvalidateLayout): (WebCore::InspectorInstrumentation::willLayout): (WebCore::InspectorInstrumentation::didLayout): (WebCore::InspectorInstrumentation::didScroll): (WebCore::InspectorInstrumentation::willComposite): (WebCore::InspectorInstrumentation::didComposite): (WebCore::InspectorInstrumentation::willPaint): (WebCore::InspectorInstrumentation::didPaint): (WebCore::InspectorInstrumentation::willRecalculateStyle): (WebCore::InspectorInstrumentation::didRecalculateStyle): (WebCore::InspectorInstrumentation::didScheduleStyleRecalculation): (WebCore::InspectorInstrumentation::applyUserAgentOverride): (WebCore::InspectorInstrumentation::applyEmulatedMedia): (WebCore::InspectorInstrumentation::willSendRequest): (WebCore::InspectorInstrumentation::willSendRequestOfType): (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache): (WebCore::InspectorInstrumentation::didReceiveResourceResponse): (WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponse): (WebCore::InspectorInstrumentation::didReceiveData): (WebCore::InspectorInstrumentation::didFinishLoading): (WebCore::InspectorInstrumentation::didFailLoading): (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied): (WebCore::InspectorInstrumentation::continueWithPolicyDownload): (WebCore::InspectorInstrumentation::continueWithPolicyIgnore): (WebCore::InspectorInstrumentation::willLoadXHRSynchronously): (WebCore::InspectorInstrumentation::didLoadXHRSynchronously): (WebCore::InspectorInstrumentation::scriptImported): (WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSP): (WebCore::InspectorInstrumentation::didReceiveScriptResponse): (WebCore::InspectorInstrumentation::domContentLoadedEventFired): (WebCore::InspectorInstrumentation::loadEventFired): (WebCore::InspectorInstrumentation::frameDetachedFromParent): (WebCore::InspectorInstrumentation::didCommitLoad): (WebCore::InspectorInstrumentation::frameDocumentUpdated): (WebCore::InspectorInstrumentation::loaderDetachedFromFrame): (WebCore::InspectorInstrumentation::frameStartedLoading): (WebCore::InspectorInstrumentation::frameStoppedLoading): (WebCore::InspectorInstrumentation::frameScheduledNavigation): (WebCore::InspectorInstrumentation::frameClearedScheduledNavigation): (WebCore::InspectorInstrumentation::defaultAppearanceDidChange): (WebCore::InspectorInstrumentation::willIntercept): (WebCore::InspectorInstrumentation::shouldInterceptRequest): (WebCore::InspectorInstrumentation::shouldInterceptResponse): (WebCore::InspectorInstrumentation::interceptRequest): (WebCore::InspectorInstrumentation::interceptResponse): (WebCore::InspectorInstrumentation::didOpenDatabase): (WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent): (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStart): (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::didCreateWebSocket): (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest): (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorInstrumentation::didCloseWebSocket): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrame): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrameError): (WebCore::InspectorInstrumentation::didSendWebSocketFrame): (WebCore::InspectorInstrumentation::didHandleMemoryPressure): (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes): (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext): (WebCore::InspectorInstrumentation::didChangeCanvasMemory): (WebCore::InspectorInstrumentation::recordCanvasAction): (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame): (WebCore::InspectorInstrumentation::didEnableExtension): (WebCore::InspectorInstrumentation::didCreateWebGLProgram): (WebCore::InspectorInstrumentation::willDestroyWebGLProgram): (WebCore::InspectorInstrumentation::isWebGLProgramDisabled): (WebCore::InspectorInstrumentation::isWebGLProgramHighlighted): (WebCore::InspectorInstrumentation::willConfigureSwapChain): (WebCore::InspectorInstrumentation::willDestroyWebGPUPipeline): (WebCore::InspectorInstrumentation::willApplyKeyframeEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationName): (WebCore::InspectorInstrumentation::didSetWebAnimationEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTiming): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTarget): (WebCore::InspectorInstrumentation::didCreateWebAnimation): (WebCore::InspectorInstrumentation::willDestroyWebAnimation): (WebCore::InspectorInstrumentation::networkStateChanged): (WebCore::InspectorInstrumentation::updateApplicationCacheStatus): (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore::InspectorInstrumentation::consoleCount): (WebCore::InspectorInstrumentation::consoleCountReset): (WebCore::InspectorInstrumentation::takeHeapSnapshot): (WebCore::InspectorInstrumentation::startConsoleTiming): (WebCore::InspectorInstrumentation::logConsoleTiming): (WebCore::InspectorInstrumentation::stopConsoleTiming): (WebCore::InspectorInstrumentation::consoleTimeStamp): (WebCore::InspectorInstrumentation::startProfiling): (WebCore::InspectorInstrumentation::stopProfiling): (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas): (WebCore::InspectorInstrumentation::consoleStopRecordingCanvas): (WebCore::InspectorInstrumentation::didRequestAnimationFrame): (WebCore::InspectorInstrumentation::didCancelAnimationFrame): (WebCore::InspectorInstrumentation::willFireAnimationFrame): (WebCore::InspectorInstrumentation::didFireAnimationFrame): (WebCore::InspectorInstrumentation::willFireObserverCallback): (WebCore::InspectorInstrumentation::didFireObserverCallback): (WebCore::InspectorInstrumentation::layerTreeDidChange): (WebCore::InspectorInstrumentation::renderLayerDestroyed): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForFrame): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForDocument): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. * inspector/InspectorWebAgentBase.h: (WebCore::WorkerAgentContext::WorkerAgentContext): * inspector/WorkerDebugger.cpp: (WebCore::WorkerDebugger::WorkerDebugger): (WebCore::WorkerDebugger::attachDebugger): (WebCore::WorkerDebugger::detachDebugger): (WebCore::WorkerDebugger::runEventLoopWhilePaused): * inspector/WorkerDebugger.h: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::workerAgentContext): (WebCore::WorkerInspectorController::createLazyAgents): (WebCore::WorkerInspectorController::vm): * inspector/WorkerInspectorController.h: * inspector/WorkerToPageFrontendChannel.h: * inspector/agents/worker/ServiceWorkerAgent.cpp: (WebCore::ServiceWorkerAgent::ServiceWorkerAgent): * inspector/agents/worker/WorkerAuditAgent.cpp: (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/agents/worker/WorkerAuditAgent.h: * inspector/agents/worker/WorkerConsoleAgent.cpp: (WebCore::WorkerConsoleAgent::WorkerConsoleAgent): * inspector/agents/worker/WorkerDebuggerAgent.cpp: (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent): (WebCore::WorkerDebuggerAgent::breakpointActionLog): (WebCore::WorkerDebuggerAgent::injectedScriptForEval): * inspector/agents/worker/WorkerDebuggerAgent.h: * inspector/agents/worker/WorkerNetworkAgent.cpp: (WebCore::WorkerNetworkAgent::WorkerNetworkAgent): (WebCore::WorkerNetworkAgent::setResourceCachingDisabledInternal): (WebCore::WorkerNetworkAgent::scriptExecutionContext): * inspector/agents/worker/WorkerNetworkAgent.h: * inspector/agents/worker/WorkerRuntimeAgent.cpp: (WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent): (WebCore::WorkerRuntimeAgent::injectedScriptForEval): * inspector/agents/worker/WorkerRuntimeAgent.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::prepareForDestruction): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController const): Deleted. * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): (WebCore::WorkerOrWorkletGlobalScope::prepareForDestruction): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::inspectorController const): * workers/WorkerOrWorkletThread.h: * workers/WorkerThread.h: (WebCore::WorkerThread::workerDebuggerProxy const): Deleted. Canonical link: https://commits.webkit.org/230818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-23 01:00:04 +00:00
, m_globalScope(context)
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
{
}
Web Inspector: rename `ScriptDebugServer` subclasses/methods https://bugs.webkit.org/show_bug.cgi?id=215363 <rdar://problem/67310441> Reviewed by Brian Burg. r266074 merged `Inspector::ScriptDebugServer` into `JSC::Debugger`. All subclasses and functions should be renamed to match this change. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectDebugger.h: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h. * inspector/JSGlobalObjectDebugger.cpp: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp. * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.cpp: * inspector/remote/RemoteInspectionTarget.cpp: * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm: Source/WebCore: * Headers.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorController.h: * inspector/InspectorController.cpp: * inspector/PageDebugger.h: Renamed from Source/WebCore/inspector/PageScriptDebugServer.h. * inspector/PageDebugger.cpp: Renamed from Source/WebCore/inspector/PageScriptDebugServer.cpp. * inspector/mac/PageDebuggerMac.mm: Renamed from Source/WebCore/inspector/mac/PageScriptDebugServerMac.mm. * inspector/WorkerDebugger.h: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.h. * inspector/WorkerDebugger.cpp: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.cpp. * inspector/WorkerInspectorController.h: * inspector/WorkerInspectorController.cpp: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/page/PageDebuggerAgent.cpp: Canonical link: https://commits.webkit.org/228554@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 18:40:30 +00:00
void WorkerDebugger::attachDebugger()
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
{
Web Inspector: allow event breakpoints to be configured https://bugs.webkit.org/show_bug.cgi?id=215362 <rdar://problem/66932921> Reviewed by Brian Burg. Source/JavaScriptCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * inspector/protocol/DOM.json: Add an `options` paramater to `DOM.setBreakpointForEventListener` to allow configuration. * inspector/protocol/DOMDebugger.json: Add an `options` paramater to `DOMDebugger.setEventBreakpoint` to allow configuration. * debugger/Breakpoint.h: (JSC::Breakpoint::id const): Added. (JSC::Breakpoint::sourceID const): Added. (JSC::Breakpoint::lineNumber const): Added. (JSC::Breakpoint::columnNumber const): Added. (JSC::Breakpoint::condition const): Added. (JSC::Breakpoint::actions const): Added. (JSC::Breakpoint::isAutoContinue const): Added. (JSC::Breakpoint::resetHitCount): Added. (JSC::Breakpoint::isLinked const): Added. (JSC::Breakpoint::isResolved const): Added. (JSC::BreakpointsList::~BreakpointsList): Deleted. * debugger/Breakpoint.cpp: Added. (JSC::Breakpoint::Action::Action): Added. (JSC::Breakpoint::create): Added. (JSC::Breakpoint::Breakpoint): Added. (JSC::Breakpoint::link): Added. (JSC::Breakpoint::resolve): Added. (JSC::Breakpoint::shouldPause): Added. Unify `JSC::Breakpoint` and `Inspector::ScriptBreakpoint`. * debugger/DebuggerPrimitives.h: * debugger/Debugger.h: * debugger/Debugger.cpp: (JSC::Debugger::Debugger): (JSC::Debugger::addObserver): Added. (JSC::Debugger::removeObserver): Added. (JSC::Debugger::canDispatchFunctionToObservers const): Added. (JSC::Debugger::dispatchFunctionToObservers): Added. (JSC::Debugger::sourceParsed): Added. (JSC::Debugger::toggleBreakpoint): (JSC::Debugger::applyBreakpoints): (JSC::Debugger::resolveBreakpoint): (JSC::Debugger::setBreakpoint): (JSC::Debugger::removeBreakpoint): (JSC::Debugger::didHitBreakpoint): Added. (JSC::Debugger::clearBreakpoints): (JSC::Debugger::evaluateBreakpointCondition): Added. (JSC::Debugger::evaluateBreakpointActions): Added. (JSC::Debugger::schedulePauseAtNextOpportunity): Added. (JSC::Debugger::cancelPauseAtNextOpportunity): Added. (JSC::Debugger::schedulePauseForSpecialBreakpoint): Added. (JSC::Debugger::cancelPauseForSpecialBreakpoint): Added. (JSC::Debugger::continueProgram): (JSC::Debugger::stepNextExpression): (JSC::Debugger::stepIntoStatement): (JSC::Debugger::stepOverStatement): (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::pauseIfNeeded): (JSC::Debugger::handlePause): Added. (JSC::Debugger::exceptionOrCaughtValue): Added. (JSC::Debugger::atExpression): (JSC::Debugger::clearNextPauseState): (JSC::Debugger::willRunMicrotask): Added. (JSC::Debugger::didRunMicrotask): Added. (JSC::Debugger::hasBreakpoint): Deleted. (JSC::Debugger::setPauseOnNextStatement): Deleted. Unify `JSC::Debugger` and `Inspector::ScriptDebugServer` to simplify breakpoint logic. Introduce the concept of a "special breakpoint", which is essentially a `JSC::Breakpoint` that is expected to pause at the next opportunity but isn't tied to a particular location. As an example, whenever an event breakpoint is hit, instead of just pausing at the next opportunity, the newly managed `JSC::Breakpoint` is used as a "special breakpoint", allowing for it's configuration (ie.g. condition, ignore count, actions, auto-continue) to be used. * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::objectGroupForBreakpointAction): (Inspector::breakpointActionTypeForString): Added. (Inspector::parseBreakpointOptions): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::fromPayload): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::ProtocolBreakpoint): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::createDebuggerBreakpoint const): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::matchesScriptURL const): Added. (Inspector::InspectorDebuggerAgent::debuggerBreakpointFromPayload): Added. (Inspector::InspectorDebuggerAgent::enable): (Inspector::InspectorDebuggerAgent::disable): (Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason): (Inspector::InspectorDebuggerAgent::handleConsoleAssert): (Inspector::InspectorDebuggerAgent::didScheduleAsyncCall): (Inspector::buildDebuggerLocation): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::didSetBreakpoint): (Inspector::InspectorDebuggerAgent::resolveBreakpoint): (Inspector::InspectorDebuggerAgent::removeBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::schedulePauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::cancelPauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::schedulePauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::cancelPauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::pause): (Inspector::InspectorDebuggerAgent::resume): (Inspector::InspectorDebuggerAgent::didBecomeIdle): (Inspector::InspectorDebuggerAgent::sourceMapURLForScript): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::willRunMicrotask): (Inspector::InspectorDebuggerAgent::didRunMicrotask): (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionSound): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::clearInspectorBreakpointState): (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): (Inspector::matches): Deleted. (Inspector::buildObjectForBreakpointCookie): Deleted. (Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol): Deleted. (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): Deleted. (Inspector::InspectorDebuggerAgent::cancelPauseOnNextStatement): Deleted. Create a private `ProtocolBreakpoint` class that holds the data sent by the frontend. This is necessary because breakpoints in the frontend have a potentially one-to-many relationship with breakpoints in the backend, as the same script can be loaded many times on a page. Each of those scripts is independent, however, and can execute differently, meaning that the same breakpoint for each script also needs a different state (e.g. ignore count). As such, the `ProtocolBreakpoint` is effectively a template that is actualized whenever a new script is parsed that matches the URL of the `ProtocolBreakpoint` to create a `JSC::Breakpoint` that is used by the `JSC::Debugger`. `ProtocolBreakpoint` also parses breakpoint configurations. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectScriptDebugServer.h: * inspector/JSGlobalObjectScriptDebugServer.cpp: (Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer): (Inspector::JSGlobalObjectScriptDebugServer::attachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::detachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused): * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: (Inspector::InspectorAuditAgent::run): * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::setPauseOnExceptionsState): (Inspector::InspectorRuntimeAgent::evaluate): (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::getPreview): (Inspector::InspectorRuntimeAgent::getProperties): (Inspector::InspectorRuntimeAgent::getDisplayableProperties): * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.h: Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * runtime/JSMicrotask.cpp: (JSC::JSMicrotask::run): Drive-by: r248894 mistakenly omitted the call to notify the debugger that the microtask ran. * inspector/ScriptBreakpoint.h: Removed. * inspector/ScriptDebugListener.h: Removed. * inspector/ScriptDebugServer.h: Removed. * inspector/ScriptDebugServer.cpp: Removed. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: Source/WebCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing Tests: inspector/dom/breakpoint-for-event-listener.html inspector/dom-debugger/event-animation-frame-breakpoints.html inspector/dom-debugger/event-interval-breakpoints.html inspector/dom-debugger/event-listener-breakpoints.html inspector/dom-debugger/event-timeout-breakpoints.html * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::getEventListenersForNode): (WebCore::InspectorDOMAgent::setBreakpointForEventListener): (WebCore::InspectorDOMAgent::removeBreakpointForEventListener): (WebCore::InspectorDOMAgent::buildObjectForEventListener): (WebCore::InspectorDOMAgent::breakpointForEventListener): (WebCore::InspectorDOMAgent::hasBreakpointForEventListener): Deleted. * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::disable): (WebCore::InspectorDOMDebuggerAgent::mainFrameNavigated): (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::willHandleEvent): (WebCore::InspectorDOMDebuggerAgent::didHandleEvent): (WebCore::InspectorDOMDebuggerAgent::willFireTimer): (WebCore::InspectorDOMDebuggerAgent::didFireTimer): * inspector/agents/page/PageDOMDebuggerAgent.h: * inspector/agents/page/PageDOMDebuggerAgent.cpp: (WebCore::PageDOMDebuggerAgent::disable): (WebCore::PageDOMDebuggerAgent::mainFrameNavigated): (WebCore::PageDOMDebuggerAgent::willFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::didFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::setAnimationFrameBreakpoint): * inspector/agents/worker/WorkerDOMDebuggerAgent.h: * inspector/agents/worker/WorkerDOMDebuggerAgent.cpp: (WebCore::WorkerDOMDebuggerAgent::setAnimationFrameBreakpoint): Keep a `JSC::Breakpoint` for each event breakpoint instead of a simple `bool`, allowing for configuration when the breakpoint is first set. When any of these breakpoints are hit, pass it to the `JSC::Debugger` as a "special breakpoint", which behaves the same as "pause ASAP" but also supports a condition, an ignore count, actions, and auto-continue. Reset the hit count for any of these "special breakpoints" that persist across Web Inspector sessions when the main frame navigates. * inspector/PageScriptDebugServer.h: * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::PageScriptDebugServer): (WebCore::PageScriptDebugServer::attachDebugger): (WebCore::PageScriptDebugServer::detachDebugger): (WebCore::PageScriptDebugServer::didPause): (WebCore::PageScriptDebugServer::didContinue): (WebCore::PageScriptDebugServer::runEventLoopWhilePaused): (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal): (WebCore::PageScriptDebugServer::isContentScript const): (WebCore::PageScriptDebugServer::reportException const): * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException const): * inspector/agents/page/PageDebuggerAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: (WebCore::PageDebuggerAgent::sourceMapURLForScript): Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * inspector/TimelineRecordFactory.h: * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createProbeSampleData): * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::breakpointActionProbe): Replace `Inspector::ScriptBreakpoint` with `JSC::Breakpoint`. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::didFireTimer): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didHandleEventImpl): (WebCore::InspectorInstrumentation::didFireTimerImpl): (WebCore::InspectorInstrumentation::didCommitLoadImpl): (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl): * dom/EventTarget.cpp: (WebCore::EventTarget::innerInvokeEventListeners): * page/DOMTimer.cpp: (WebCore::DOMTimer::fired): When notifying Web Inspector that activity did occur, include all information previously included when notifying Web Inspector that that activity was about to occur so that Web Inspector can know whether a pause for the "special breakpoint" for that activity is still scheduled and if so cancel it. Source/WebInspectorUI: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * UserInterface/Models/Breakpoint.js: (WI.Breakpoint): (WI.Breakpoint.prototype.toJSON): (WI.Breakpoint.prototype.get special): Added. (WI.Breakpoint.prototype.get removable): Added. (WI.Breakpoint.prototype.get editable): Added. (WI.Breakpoint.prototype.set condition): (WI.Breakpoint.prototype.get ignoreCount): (WI.Breakpoint.prototype.set ignoreCount): (WI.Breakpoint.prototype.get autoContinue): (WI.Breakpoint.prototype.set autoContinue): (WI.Breakpoint.prototype.get actions): (WI.Breakpoint.prototype.get probeActions): (WI.Breakpoint.prototype.cycleToNextMode): (WI.Breakpoint.prototype.createAction): (WI.Breakpoint.prototype.recreateAction): (WI.Breakpoint.prototype.removeAction): (WI.Breakpoint.prototype.clearActions): (WI.Breakpoint.prototype.remove): Added. (WI.Breakpoint.prototype.optionsToProtocol): Added. (WI.Breakpoint.prototype.breakpointActionDidChange): (WI.Breakpoint.fromJSON): Deleted. (WI.Breakpoint.prototype.get sourceCodeLocation): Deleted. (WI.Breakpoint.prototype.get contentIdentifier): Deleted. (WI.Breakpoint.prototype.get scriptIdentifier): Deleted. (WI.Breakpoint.prototype.get target): Deleted. (WI.Breakpoint.prototype.get identifier): Deleted. (WI.Breakpoint.prototype.set identifier): Deleted. (WI.Breakpoint.prototype.get resolved): Deleted. (WI.Breakpoint.prototype.set resolved): Deleted. (WI.Breakpoint.prototype.saveIdentityToCookie): Deleted. (WI.Breakpoint.prototype._isSpecial): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationLocationChanged): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationDisplayLocationChanged): Deleted. * UserInterface/Models/DOMBreakpoint.js: (WI.DOMBreakpoint): (WI.DOMBreakpoint.fromJSON): Added. (WI.DOMBreakpoint.prototype.remove): Added. (WI.DOMBreakpoint.prototype.toJSON): (WI.DOMBreakpoint.deserialize): Deleted. (WI.DOMBreakpoint.prototype.get disabled): Deleted. (WI.DOMBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/EventBreakpoint.js: (WI.EventBreakpoint): (WI.EventBreakpoint.fromJSON): Added. (WI.EventBreakpoint.prototype.get special): Added. (WI.EventBreakpoint.prototype.get editable): Added. (WI.EventBreakpoint.prototype.remove): Added. (WI.EventBreakpoint.prototype.saveIdentityToCookie): (WI.EventBreakpoint.prototype.toJSON): (WI.EventBreakpoint.deserialize): Deleted. (WI.EventBreakpoint.prototype.get disabled): Deleted. (WI.EventBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/JavaScriptBreakpoint.js: Copied from UserInterface/Models/Breakpoint.js. (WI.JavaScriptBreakpoint): (WI.JavaScriptBreakpoint.fromJSON): (WI.JavaScriptBreakpoint.prototype.toJSON): (WI.JavaScriptBreakpoint.prototype.get sourceCodeLocation): (WI.JavaScriptBreakpoint.prototype.get contentIdentifier): (WI.JavaScriptBreakpoint.prototype.get scriptIdentifier): (WI.JavaScriptBreakpoint.prototype.get target): (WI.JavaScriptBreakpoint.prototype.get special): Added. (WI.JavaScriptBreakpoint.prototype.get removable): Added. (WI.JavaScriptBreakpoint.prototype.get editable): Added. (WI.JavaScriptBreakpoint.prototype.get identifier): (WI.JavaScriptBreakpoint.prototype.set identifier): (WI.JavaScriptBreakpoint.prototype.get resolved): (WI.JavaScriptBreakpoint.prototype.set resolved): (WI.JavaScriptBreakpoint.prototype.remove): Added. (WI.JavaScriptBreakpoint.prototype.saveIdentityToCookie): (WI.JavaScriptBreakpoint.prototype._isSpecial): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationLocationChanged): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationDisplayLocationChanged): * UserInterface/Models/URLBreakpoint.js: (WI.URLBreakpoint): (WI.URLBreakpoint.fromJSON): Added. (WI.URLBreakpoint.prototype.get special): Added. (WI.URLBreakpoint.prototype.remove): Added. (WI.URLBreakpoint.prototype.toJSON): (WI.URLBreakpoint.deserialize): Deleted. (WI.URLBreakpoint.prototype.get disabled): Deleted. (WI.URLBreakpoint.prototype.set disabled): Deleted. Rename `WI.Breakpoint` to `WI.JavaScriptBreakpoint` and use `WI.Breakpoint` as a new common base class for all breakpoint types, allowing more logic to be shared (e.g. disabled state). Additionally, breakpoints are now able to - determine whether or not they're - special - removable - editable (i.e. configurable) - remove themselves without the caller needing to know what manager to consult with. * UserInterface/Controllers/DOMManager.js: (WI.DOMManager): (WI.DOMManager.supportsEventListenerBreakpointConfiguration): Added. (WI.DOMManager.prototype.setBreakpointForEventListener): (WI.DOMManager.prototype.removeBreakpointForEventListener): (WI.DOMManager.prototype._setEventBreakpoint): Added. (WI.DOMManager.prototype._removeEventBreakpoint): Added. (WI.DOMManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for specific listener breakpoints. * UserInterface/Controllers/DOMDebuggerManager.js: (WI.DOMDebuggerManager): (WI.DOMDebuggerManager.prototype.initializeTarget): (WI.DOMDebuggerManager.prototype.addDOMBreakpoint): (WI.DOMDebuggerManager.prototype.removeDOMBreakpoint): (WI.DOMDebuggerManager.prototype.addEventBreakpoint): (WI.DOMDebuggerManager.prototype.removeEventBreakpoint): (WI.DOMDebuggerManager.prototype.addURLBreakpoint): (WI.DOMDebuggerManager.prototype.removeURLBreakpoint): (WI.DOMDebuggerManager.prototype._commandArgumentsForEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._setEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._removeEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointDisabledStateChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMDebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DOMDebuggerManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for special event breakpoints. Store special event breakpoints inside `WI.objectStores.eventBreakpoints`. * UserInterface/Controllers/DebuggerManager.js: (WI.DebuggerManager): (WI.DebuggerManager.prototype.addBreakpoint): (WI.DebuggerManager.prototype.removeBreakpoint): (WI.DebuggerManager.prototype.addProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.removeProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.updateProbesForBreakpoint): Added. (WI.DebuggerManager.prototype._setBreakpoint): (WI.DebuggerManager.prototype._breakpointEditablePropertyDidChange): (WI.DebuggerManager.prototype._handleBreakpointActionsDidChange): (WI.DebuggerManager.prototype.isBreakpointRemovable): Deleted. (WI.DebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DebuggerManager.prototype.isBreakpointEditable): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointActionType): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointOptions): Deleted. (WI.DebuggerManager.prototype._addProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._removeProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._updateProbesForBreakpoint): Deleted. Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Controllers/BreakpointPopoverController.js: (WI.BreakpointPopoverController.prototype.appendContextMenuItems): (WI.BreakpointPopoverController.prototype._createPopoverContent): Allow any breakpoint instead of only `WI.JavaScriptBreakpoint`. Drive-by: the existing `ignoreCount` value wasn't being used to populate the `<input>`. * UserInterface/Views/BreakpointTreeElement.js: (WI.BreakpointTreeElement.prototype.ondelete): (WI.BreakpointTreeElement.prototype.get listenerSet): Added. (WI.BreakpointTreeElement.prototype.updateStatus): Added. (WI.BreakpointTreeElement.prototype.updateTitles): Added. (WI.BreakpointTreeElement.prototype.get breakpoint): Deleted. (WI.BreakpointTreeElement.prototype.get filterableData): Deleted. (WI.BreakpointTreeElement.prototype._updateTitles): Deleted. (WI.BreakpointTreeElement.prototype._updateStatus): Deleted. (WI.BreakpointTreeElement.prototype._breakpointLocationDidChange): Deleted. * UserInterface/Views/BreakpointTreeElement.css: (.item.breakpoint .status > .status-image): (.item.breakpoint.paused .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.paused .icon): Added. (.item.breakpoint .status > .status-image.resolved): Deleted. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.selected .status > .status-image.resolved): Deleted. (.item.breakpoint .subtitle.formatted-location): Deleted. (.breakpoint-debugger-statement-icon .icon): Deleted. (.breakpoint-exception-icon .icon): Deleted. (.breakpoint-assertion-icon .icon): Deleted. (.breakpoint-microtask-icon .icon): Deleted. (.breakpoint-paused-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon > span): Deleted. (.data-updated.breakpoint-generic-line-icon .icon > span): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-debugger-statement-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-exception-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-assertion-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-microtask-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-paused-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-generic-line-icon .icon): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.js: (WI.DOMBreakpointTreeElement): (WI.DOMBreakpointTreeElement.prototype.onattach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondetach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondelete): Deleted. (WI.DOMBreakpointTreeElement.prototype.onenter): Deleted. (WI.DOMBreakpointTreeElement.prototype.onspace): Deleted. (WI.DOMBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.DOMBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.DOMBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.css: (.item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (.breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/EventBreakpointTreeElement.js: (WI.EventBreakpointTreeElement): (WI.EventBreakpointTreeElement.prototype.onattach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondetach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondelete): Deleted. (WI.EventBreakpointTreeElement.prototype.onenter): Deleted. (WI.EventBreakpointTreeElement.prototype.onspace): Deleted. (WI.EventBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.EventBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.EventBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/EventBreakpointTreeElement.css: (.item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (.item.breakpoint.event.interval:not(.paused) .icon): Added. (.item.breakpoint.event.listener:not(.paused) .icon): Added. (.item.breakpoint.event.timeout:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.interval:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.listener:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.timeout:not(.paused) .icon): Added. (.breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/JavaScriptBreakpointTreeElement.js: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js. (WI.JavaScriptBreakpointTreeElement): (WI.JavaScriptBreakpointTreeElement.prototype.get filterableData): (WI.JavaScriptBreakpointTreeElement.prototype.updateStatus): Added. (WI.JavaScriptBreakpointTreeElement.prototype.updateTitles): Added. (WI.JavaScriptBreakpointTreeElement.prototype._breakpointLocationDidChange): * UserInterface/Views/JavaScriptBreakpointTreeElement.css: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css. (.item.breakpoint.javascript .status > .status-image): Added. (.item.breakpoint.javascript .status > .status-image.resolved): Added. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.javascript.selected .status > .status-image.resolved): Added. (.item.breakpoint.javascript .subtitle.formatted-location): Added. (.item.breakpoint.javascript.line .icon): Added. (.item.breakpoint.javascript.line .icon > span): Added. (.data-updated.item.breakpoint.javascript.line .icon > span): Added. (.item.breakpoint.javascript.debugger-statement .icon): Added. (.item.breakpoint.javascript.exception .icon): Added. (.item.breakpoint.javascript.assertion .icon): Added. (.item.breakpoint.javascript.microtask .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.line .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.debugger-statement .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.exception .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.assertion .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.microtask .icon): Added. * UserInterface/Views/URLBreakpointTreeElement.js: (WI.URLBreakpointTreeElement): (WI.URLBreakpointTreeElement.prototype.onattach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondetach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondelete): Deleted. (WI.URLBreakpointTreeElement.prototype.onenter): Deleted. (WI.URLBreakpointTreeElement.prototype.onspace): Deleted. (WI.URLBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.URLBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.URLBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/URLBreakpointTreeElement.css: (.item.breakpoint.url .subtitle): Added. (.item.breakpoint.url:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.url:not(.paused) .icon): Added. (.breakpoint.url .subtitle): Deleted. (.breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. Rename `WI.BreakpointTreeElement` to `WI.JavaScriptBreakpointTreeElement` and use `WI.BreakpointTreeElement` as a new common base class for all breakpoint tree elements, allowing more logic and styles to be shared (e.g. disabled state). * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel): (WI.SourcesNavigationSidebarPanel.prototype.closed): (WI.SourcesNavigationSidebarPanel.prototype._insertDebuggerTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._compareJavaScriptBreakpointTreeElements): Added. (WI.SourcesNavigationSidebarPanel.prototype._addBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._removeAllBreakpoints): (WI.SourcesNavigationSidebarPanel.prototype._breakpointsBeneathTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._addIssue): (WI.SourcesNavigationSidebarPanel.prototype._updatePauseReasonSection): (WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange): (WI.SourcesNavigationSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu.addToggleForSpecialEventBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu): (WI.SourcesNavigationSidebarPanel.prototype._handleDebuggerObjectDisplayLocationDidChange): (WI.SourcesNavigationSidebarPanel.prototype._compareBreakpointTreeElements): Deleted. * UserInterface/Models/ProbeSet.js: (WI.ProbeSet): (WI.ProbeSet.prototype.createProbe): (WI.ProbeSet.prototype.willRemove): * UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.prototype._processRecord): * UserInterface/Views/ProbeSetDetailsSection.js: (WI.ProbeSetDetailsSection): * UserInterface/Views/ProbeDetailsSidebarPanel.js: (WI.ProbeDetailsSidebarPanel.prototype.inspect): * UserInterface/Views/SourceCodeTextEditor.js: (WI.SourceCodeTextEditor): (WI.SourceCodeTextEditor.prototype.close): (WI.SourceCodeTextEditor.prototype.textEditorBreakpointAdded): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype.get supplementalRepresentedObjects): (WI.TextResourceContentView.prototype._probeSetsChanged): Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Views/ContentView.js: (WI.ContentView.createFromRepresentedObject): (WI.ContentView.resolvedRepresentedObjectForRepresentedObject): (WI.ContentView.isViewable): * UserInterface/Views/ContextMenuUtilities.js: (WI.appendContextMenuItemsForSourceCode): Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. * UserInterface/Views/DOMTreeContentView.js: (WI.DOMTreeContentView): Replace `WI.DOMBreakpoint` with `WI.Breakpoint`. * UserInterface/Views/EventListenerSectionGroup.js: (WI.EventListenerSectionGroup): * UserInterface/Views/EventListenerSectionGroup.css: (.event-listener-section > .content input[type="checkbox"] + .go-to-arrow): Added. (.event-listener-section > .content input[type="checkbox"]:not(:checked) + .go-to-arrow): Added. Add a go-to arrow next to the Breakpoint checkbox that reveals the `WI.EventBreakpoint` in the Sources Tab. * UserInterface/Views/BreakpointActionView.js: (WI.BreakpointActionView.prototype._appendActionButtonClicked): Drive-by: minor code cleanup. * UserInterface/Views/CallFrameTreeElement.js: (WI.CallFrameTreeElement.prototype.populateContextMenu): Drive-by: include source code location context menu items. * UserInterface/Base/Setting.js: * UserInterface/Main.html: * UserInterface/Test.html: LayoutTests: * inspector/dom-debugger/resources/event-breakpoint-utilities.js: (TestPage.registerInitializer.InspectorTest.EventBreakpoint.addBreakpointOptionsTestCases): Added. (TestPage.registerInitializer.InspectorTest.EventBreakpoint.async teardown): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.createBreakpoint): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.removeBreakpoint): * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/breakpoint-for-event-listener-expected.txt: * inspector/dom-debugger/event-animation-frame-breakpoints.html: * inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt: * inspector/dom-debugger/event-interval-breakpoints.html: * inspector/dom-debugger/event-interval-breakpoints-expected.txt: * inspector/dom-debugger/event-listener-breakpoints.html: * inspector/dom-debugger/event-listener-breakpoints-expected.txt: * inspector/dom-debugger/event-timeout-breakpoints.html: * inspector/dom-debugger/event-timeout-breakpoints-expected.txt: Add tests for new event breakpoint configuration options. * http/tests/inspector/debugger/debugger-test.js: (TestPage.registerInitializer.InspectorTest.startTracingBreakpoints): * http/tests/inspector/resources/probe-test.js: (TestPage.registerInitializer.ProtocolTest.Probe.installTracingListeners): * inspector/debugger/breakpoint-action-eval.html: * inspector/debugger/breakpoint-action-log.html: * inspector/debugger/breakpoint-columns.html: * inspector/debugger/breakpoint-scope.html: * inspector/debugger/debugger-stack-overflow.html: * inspector/debugger/pause-reason.html: * inspector/debugger/probe-manager-add-remove-actions.html: * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/debugger/tail-deleted-frames-this-value.html: * inspector/debugger/tail-recursion.html: * inspector/worker/debugger-pause.html: * inspector/worker/debugger-shared-breakpoint.html: Update existing breakpoint tests to use new model objects. Canonical link: https://commits.webkit.org/228551@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 17:34:12 +00:00
JSC::Debugger::attachDebugger();
Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope https://bugs.webkit.org/show_bug.cgi?id=218108 Reviewed by Darin Adler and Devin Rousso. Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope, in preparation for Worklets support. This will allow us to reuse this code when we add Web Inspector support for Worklets. No new tests, no behavior change yet. * Modules/webaudio/AudioWorkletThread.cpp: (WebCore::AudioWorkletThread::workerDebuggerProxy const): * Modules/webaudio/AudioWorkletThread.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::instrumentingAgentsForWebGPUDevice): (WebCore::InspectorInstrumentation::consoleAgentEnabled): (WebCore::InspectorInstrumentation::timelineAgentTracking): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didClearWindowObjectInWorld): (WebCore::InspectorInstrumentation::isDebuggerPaused): (WebCore::InspectorInstrumentation::identifierForNode): (WebCore::InspectorInstrumentation::addEventListenersToNode): (WebCore::InspectorInstrumentation::willInsertDOMNode): (WebCore::InspectorInstrumentation::didInsertDOMNode): (WebCore::InspectorInstrumentation::willRemoveDOMNode): (WebCore::InspectorInstrumentation::didRemoveDOMNode): (WebCore::InspectorInstrumentation::willModifyDOMAttr): (WebCore::InspectorInstrumentation::didModifyDOMAttr): (WebCore::InspectorInstrumentation::didRemoveDOMAttr): (WebCore::InspectorInstrumentation::willInvalidateStyleAttr): (WebCore::InspectorInstrumentation::didInvalidateStyleAttr): (WebCore::InspectorInstrumentation::documentDetached): (WebCore::InspectorInstrumentation::frameWindowDiscarded): (WebCore::InspectorInstrumentation::mediaQueryResultChanged): (WebCore::InspectorInstrumentation::activeStyleSheetsUpdated): (WebCore::InspectorInstrumentation::didPushShadowRoot): (WebCore::InspectorInstrumentation::willPopShadowRoot): (WebCore::InspectorInstrumentation::didChangeCustomElementState): (WebCore::InspectorInstrumentation::pseudoElementCreated): (WebCore::InspectorInstrumentation::pseudoElementDestroyed): (WebCore::InspectorInstrumentation::didCreateNamedFlow): (WebCore::InspectorInstrumentation::willRemoveNamedFlow): (WebCore::InspectorInstrumentation::didChangeRegionOverset): (WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::mouseDidMoveOverElement): (WebCore::InspectorInstrumentation::handleTouchEvent): (WebCore::InspectorInstrumentation::handleMousePress): (WebCore::InspectorInstrumentation::forcePseudoState): (WebCore::InspectorInstrumentation::characterDataModified): (WebCore::InspectorInstrumentation::willSendXMLHttpRequest): (WebCore::InspectorInstrumentation::willFetch): (WebCore::InspectorInstrumentation::didInstallTimer): (WebCore::InspectorInstrumentation::didRemoveTimer): (WebCore::InspectorInstrumentation::didAddEventListener): (WebCore::InspectorInstrumentation::willRemoveEventListener): (WebCore::InspectorInstrumentation::isEventListenerDisabled): (WebCore::InspectorInstrumentation::willPostMessage): (WebCore::InspectorInstrumentation::didPostMessage): (WebCore::InspectorInstrumentation::didFailPostMessage): (WebCore::InspectorInstrumentation::willDispatchPostMessage): (WebCore::InspectorInstrumentation::didDispatchPostMessage): (WebCore::InspectorInstrumentation::willCallFunction): (WebCore::InspectorInstrumentation::didCallFunction): (WebCore::InspectorInstrumentation::willDispatchEvent): (WebCore::InspectorInstrumentation::didDispatchEvent): (WebCore::InspectorInstrumentation::willHandleEvent): (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::willDispatchEventOnWindow): (WebCore::InspectorInstrumentation::didDispatchEventOnWindow): (WebCore::InspectorInstrumentation::eventDidResetAfterDispatch): (WebCore::InspectorInstrumentation::willEvaluateScript): (WebCore::InspectorInstrumentation::didEvaluateScript): (WebCore::InspectorInstrumentation::willFireTimer): (WebCore::InspectorInstrumentation::didFireTimer): (WebCore::InspectorInstrumentation::didInvalidateLayout): (WebCore::InspectorInstrumentation::willLayout): (WebCore::InspectorInstrumentation::didLayout): (WebCore::InspectorInstrumentation::didScroll): (WebCore::InspectorInstrumentation::willComposite): (WebCore::InspectorInstrumentation::didComposite): (WebCore::InspectorInstrumentation::willPaint): (WebCore::InspectorInstrumentation::didPaint): (WebCore::InspectorInstrumentation::willRecalculateStyle): (WebCore::InspectorInstrumentation::didRecalculateStyle): (WebCore::InspectorInstrumentation::didScheduleStyleRecalculation): (WebCore::InspectorInstrumentation::applyUserAgentOverride): (WebCore::InspectorInstrumentation::applyEmulatedMedia): (WebCore::InspectorInstrumentation::willSendRequest): (WebCore::InspectorInstrumentation::willSendRequestOfType): (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache): (WebCore::InspectorInstrumentation::didReceiveResourceResponse): (WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponse): (WebCore::InspectorInstrumentation::didReceiveData): (WebCore::InspectorInstrumentation::didFinishLoading): (WebCore::InspectorInstrumentation::didFailLoading): (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied): (WebCore::InspectorInstrumentation::continueWithPolicyDownload): (WebCore::InspectorInstrumentation::continueWithPolicyIgnore): (WebCore::InspectorInstrumentation::willLoadXHRSynchronously): (WebCore::InspectorInstrumentation::didLoadXHRSynchronously): (WebCore::InspectorInstrumentation::scriptImported): (WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSP): (WebCore::InspectorInstrumentation::didReceiveScriptResponse): (WebCore::InspectorInstrumentation::domContentLoadedEventFired): (WebCore::InspectorInstrumentation::loadEventFired): (WebCore::InspectorInstrumentation::frameDetachedFromParent): (WebCore::InspectorInstrumentation::didCommitLoad): (WebCore::InspectorInstrumentation::frameDocumentUpdated): (WebCore::InspectorInstrumentation::loaderDetachedFromFrame): (WebCore::InspectorInstrumentation::frameStartedLoading): (WebCore::InspectorInstrumentation::frameStoppedLoading): (WebCore::InspectorInstrumentation::frameScheduledNavigation): (WebCore::InspectorInstrumentation::frameClearedScheduledNavigation): (WebCore::InspectorInstrumentation::defaultAppearanceDidChange): (WebCore::InspectorInstrumentation::willIntercept): (WebCore::InspectorInstrumentation::shouldInterceptRequest): (WebCore::InspectorInstrumentation::shouldInterceptResponse): (WebCore::InspectorInstrumentation::interceptRequest): (WebCore::InspectorInstrumentation::interceptResponse): (WebCore::InspectorInstrumentation::didOpenDatabase): (WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent): (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStart): (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::didCreateWebSocket): (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest): (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorInstrumentation::didCloseWebSocket): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrame): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrameError): (WebCore::InspectorInstrumentation::didSendWebSocketFrame): (WebCore::InspectorInstrumentation::didHandleMemoryPressure): (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes): (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext): (WebCore::InspectorInstrumentation::didChangeCanvasMemory): (WebCore::InspectorInstrumentation::recordCanvasAction): (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame): (WebCore::InspectorInstrumentation::didEnableExtension): (WebCore::InspectorInstrumentation::didCreateWebGLProgram): (WebCore::InspectorInstrumentation::willDestroyWebGLProgram): (WebCore::InspectorInstrumentation::isWebGLProgramDisabled): (WebCore::InspectorInstrumentation::isWebGLProgramHighlighted): (WebCore::InspectorInstrumentation::willConfigureSwapChain): (WebCore::InspectorInstrumentation::willDestroyWebGPUPipeline): (WebCore::InspectorInstrumentation::willApplyKeyframeEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationName): (WebCore::InspectorInstrumentation::didSetWebAnimationEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTiming): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTarget): (WebCore::InspectorInstrumentation::didCreateWebAnimation): (WebCore::InspectorInstrumentation::willDestroyWebAnimation): (WebCore::InspectorInstrumentation::networkStateChanged): (WebCore::InspectorInstrumentation::updateApplicationCacheStatus): (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore::InspectorInstrumentation::consoleCount): (WebCore::InspectorInstrumentation::consoleCountReset): (WebCore::InspectorInstrumentation::takeHeapSnapshot): (WebCore::InspectorInstrumentation::startConsoleTiming): (WebCore::InspectorInstrumentation::logConsoleTiming): (WebCore::InspectorInstrumentation::stopConsoleTiming): (WebCore::InspectorInstrumentation::consoleTimeStamp): (WebCore::InspectorInstrumentation::startProfiling): (WebCore::InspectorInstrumentation::stopProfiling): (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas): (WebCore::InspectorInstrumentation::consoleStopRecordingCanvas): (WebCore::InspectorInstrumentation::didRequestAnimationFrame): (WebCore::InspectorInstrumentation::didCancelAnimationFrame): (WebCore::InspectorInstrumentation::willFireAnimationFrame): (WebCore::InspectorInstrumentation::didFireAnimationFrame): (WebCore::InspectorInstrumentation::willFireObserverCallback): (WebCore::InspectorInstrumentation::didFireObserverCallback): (WebCore::InspectorInstrumentation::layerTreeDidChange): (WebCore::InspectorInstrumentation::renderLayerDestroyed): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForFrame): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForDocument): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. * inspector/InspectorWebAgentBase.h: (WebCore::WorkerAgentContext::WorkerAgentContext): * inspector/WorkerDebugger.cpp: (WebCore::WorkerDebugger::WorkerDebugger): (WebCore::WorkerDebugger::attachDebugger): (WebCore::WorkerDebugger::detachDebugger): (WebCore::WorkerDebugger::runEventLoopWhilePaused): * inspector/WorkerDebugger.h: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::workerAgentContext): (WebCore::WorkerInspectorController::createLazyAgents): (WebCore::WorkerInspectorController::vm): * inspector/WorkerInspectorController.h: * inspector/WorkerToPageFrontendChannel.h: * inspector/agents/worker/ServiceWorkerAgent.cpp: (WebCore::ServiceWorkerAgent::ServiceWorkerAgent): * inspector/agents/worker/WorkerAuditAgent.cpp: (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/agents/worker/WorkerAuditAgent.h: * inspector/agents/worker/WorkerConsoleAgent.cpp: (WebCore::WorkerConsoleAgent::WorkerConsoleAgent): * inspector/agents/worker/WorkerDebuggerAgent.cpp: (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent): (WebCore::WorkerDebuggerAgent::breakpointActionLog): (WebCore::WorkerDebuggerAgent::injectedScriptForEval): * inspector/agents/worker/WorkerDebuggerAgent.h: * inspector/agents/worker/WorkerNetworkAgent.cpp: (WebCore::WorkerNetworkAgent::WorkerNetworkAgent): (WebCore::WorkerNetworkAgent::setResourceCachingDisabledInternal): (WebCore::WorkerNetworkAgent::scriptExecutionContext): * inspector/agents/worker/WorkerNetworkAgent.h: * inspector/agents/worker/WorkerRuntimeAgent.cpp: (WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent): (WebCore::WorkerRuntimeAgent::injectedScriptForEval): * inspector/agents/worker/WorkerRuntimeAgent.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::prepareForDestruction): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController const): Deleted. * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): (WebCore::WorkerOrWorkletGlobalScope::prepareForDestruction): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::inspectorController const): * workers/WorkerOrWorkletThread.h: * workers/WorkerThread.h: (WebCore::WorkerThread::workerDebuggerProxy const): Deleted. Canonical link: https://commits.webkit.org/230818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-23 01:00:04 +00:00
m_globalScope.script()->attachDebugger(this);
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
}
Web Inspector: rename `ScriptDebugServer` subclasses/methods https://bugs.webkit.org/show_bug.cgi?id=215363 <rdar://problem/67310441> Reviewed by Brian Burg. r266074 merged `Inspector::ScriptDebugServer` into `JSC::Debugger`. All subclasses and functions should be renamed to match this change. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectDebugger.h: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h. * inspector/JSGlobalObjectDebugger.cpp: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp. * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.cpp: * inspector/remote/RemoteInspectionTarget.cpp: * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm: Source/WebCore: * Headers.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorController.h: * inspector/InspectorController.cpp: * inspector/PageDebugger.h: Renamed from Source/WebCore/inspector/PageScriptDebugServer.h. * inspector/PageDebugger.cpp: Renamed from Source/WebCore/inspector/PageScriptDebugServer.cpp. * inspector/mac/PageDebuggerMac.mm: Renamed from Source/WebCore/inspector/mac/PageScriptDebugServerMac.mm. * inspector/WorkerDebugger.h: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.h. * inspector/WorkerDebugger.cpp: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.cpp. * inspector/WorkerInspectorController.h: * inspector/WorkerInspectorController.cpp: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/page/PageDebuggerAgent.cpp: Canonical link: https://commits.webkit.org/228554@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 18:40:30 +00:00
void WorkerDebugger::detachDebugger(bool isBeingDestroyed)
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
{
Web Inspector: allow event breakpoints to be configured https://bugs.webkit.org/show_bug.cgi?id=215362 <rdar://problem/66932921> Reviewed by Brian Burg. Source/JavaScriptCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * inspector/protocol/DOM.json: Add an `options` paramater to `DOM.setBreakpointForEventListener` to allow configuration. * inspector/protocol/DOMDebugger.json: Add an `options` paramater to `DOMDebugger.setEventBreakpoint` to allow configuration. * debugger/Breakpoint.h: (JSC::Breakpoint::id const): Added. (JSC::Breakpoint::sourceID const): Added. (JSC::Breakpoint::lineNumber const): Added. (JSC::Breakpoint::columnNumber const): Added. (JSC::Breakpoint::condition const): Added. (JSC::Breakpoint::actions const): Added. (JSC::Breakpoint::isAutoContinue const): Added. (JSC::Breakpoint::resetHitCount): Added. (JSC::Breakpoint::isLinked const): Added. (JSC::Breakpoint::isResolved const): Added. (JSC::BreakpointsList::~BreakpointsList): Deleted. * debugger/Breakpoint.cpp: Added. (JSC::Breakpoint::Action::Action): Added. (JSC::Breakpoint::create): Added. (JSC::Breakpoint::Breakpoint): Added. (JSC::Breakpoint::link): Added. (JSC::Breakpoint::resolve): Added. (JSC::Breakpoint::shouldPause): Added. Unify `JSC::Breakpoint` and `Inspector::ScriptBreakpoint`. * debugger/DebuggerPrimitives.h: * debugger/Debugger.h: * debugger/Debugger.cpp: (JSC::Debugger::Debugger): (JSC::Debugger::addObserver): Added. (JSC::Debugger::removeObserver): Added. (JSC::Debugger::canDispatchFunctionToObservers const): Added. (JSC::Debugger::dispatchFunctionToObservers): Added. (JSC::Debugger::sourceParsed): Added. (JSC::Debugger::toggleBreakpoint): (JSC::Debugger::applyBreakpoints): (JSC::Debugger::resolveBreakpoint): (JSC::Debugger::setBreakpoint): (JSC::Debugger::removeBreakpoint): (JSC::Debugger::didHitBreakpoint): Added. (JSC::Debugger::clearBreakpoints): (JSC::Debugger::evaluateBreakpointCondition): Added. (JSC::Debugger::evaluateBreakpointActions): Added. (JSC::Debugger::schedulePauseAtNextOpportunity): Added. (JSC::Debugger::cancelPauseAtNextOpportunity): Added. (JSC::Debugger::schedulePauseForSpecialBreakpoint): Added. (JSC::Debugger::cancelPauseForSpecialBreakpoint): Added. (JSC::Debugger::continueProgram): (JSC::Debugger::stepNextExpression): (JSC::Debugger::stepIntoStatement): (JSC::Debugger::stepOverStatement): (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::pauseIfNeeded): (JSC::Debugger::handlePause): Added. (JSC::Debugger::exceptionOrCaughtValue): Added. (JSC::Debugger::atExpression): (JSC::Debugger::clearNextPauseState): (JSC::Debugger::willRunMicrotask): Added. (JSC::Debugger::didRunMicrotask): Added. (JSC::Debugger::hasBreakpoint): Deleted. (JSC::Debugger::setPauseOnNextStatement): Deleted. Unify `JSC::Debugger` and `Inspector::ScriptDebugServer` to simplify breakpoint logic. Introduce the concept of a "special breakpoint", which is essentially a `JSC::Breakpoint` that is expected to pause at the next opportunity but isn't tied to a particular location. As an example, whenever an event breakpoint is hit, instead of just pausing at the next opportunity, the newly managed `JSC::Breakpoint` is used as a "special breakpoint", allowing for it's configuration (ie.g. condition, ignore count, actions, auto-continue) to be used. * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::objectGroupForBreakpointAction): (Inspector::breakpointActionTypeForString): Added. (Inspector::parseBreakpointOptions): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::fromPayload): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::ProtocolBreakpoint): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::createDebuggerBreakpoint const): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::matchesScriptURL const): Added. (Inspector::InspectorDebuggerAgent::debuggerBreakpointFromPayload): Added. (Inspector::InspectorDebuggerAgent::enable): (Inspector::InspectorDebuggerAgent::disable): (Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason): (Inspector::InspectorDebuggerAgent::handleConsoleAssert): (Inspector::InspectorDebuggerAgent::didScheduleAsyncCall): (Inspector::buildDebuggerLocation): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::didSetBreakpoint): (Inspector::InspectorDebuggerAgent::resolveBreakpoint): (Inspector::InspectorDebuggerAgent::removeBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::schedulePauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::cancelPauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::schedulePauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::cancelPauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::pause): (Inspector::InspectorDebuggerAgent::resume): (Inspector::InspectorDebuggerAgent::didBecomeIdle): (Inspector::InspectorDebuggerAgent::sourceMapURLForScript): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::willRunMicrotask): (Inspector::InspectorDebuggerAgent::didRunMicrotask): (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionSound): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::clearInspectorBreakpointState): (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): (Inspector::matches): Deleted. (Inspector::buildObjectForBreakpointCookie): Deleted. (Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol): Deleted. (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): Deleted. (Inspector::InspectorDebuggerAgent::cancelPauseOnNextStatement): Deleted. Create a private `ProtocolBreakpoint` class that holds the data sent by the frontend. This is necessary because breakpoints in the frontend have a potentially one-to-many relationship with breakpoints in the backend, as the same script can be loaded many times on a page. Each of those scripts is independent, however, and can execute differently, meaning that the same breakpoint for each script also needs a different state (e.g. ignore count). As such, the `ProtocolBreakpoint` is effectively a template that is actualized whenever a new script is parsed that matches the URL of the `ProtocolBreakpoint` to create a `JSC::Breakpoint` that is used by the `JSC::Debugger`. `ProtocolBreakpoint` also parses breakpoint configurations. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectScriptDebugServer.h: * inspector/JSGlobalObjectScriptDebugServer.cpp: (Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer): (Inspector::JSGlobalObjectScriptDebugServer::attachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::detachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused): * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: (Inspector::InspectorAuditAgent::run): * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::setPauseOnExceptionsState): (Inspector::InspectorRuntimeAgent::evaluate): (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::getPreview): (Inspector::InspectorRuntimeAgent::getProperties): (Inspector::InspectorRuntimeAgent::getDisplayableProperties): * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.h: Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * runtime/JSMicrotask.cpp: (JSC::JSMicrotask::run): Drive-by: r248894 mistakenly omitted the call to notify the debugger that the microtask ran. * inspector/ScriptBreakpoint.h: Removed. * inspector/ScriptDebugListener.h: Removed. * inspector/ScriptDebugServer.h: Removed. * inspector/ScriptDebugServer.cpp: Removed. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: Source/WebCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing Tests: inspector/dom/breakpoint-for-event-listener.html inspector/dom-debugger/event-animation-frame-breakpoints.html inspector/dom-debugger/event-interval-breakpoints.html inspector/dom-debugger/event-listener-breakpoints.html inspector/dom-debugger/event-timeout-breakpoints.html * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::getEventListenersForNode): (WebCore::InspectorDOMAgent::setBreakpointForEventListener): (WebCore::InspectorDOMAgent::removeBreakpointForEventListener): (WebCore::InspectorDOMAgent::buildObjectForEventListener): (WebCore::InspectorDOMAgent::breakpointForEventListener): (WebCore::InspectorDOMAgent::hasBreakpointForEventListener): Deleted. * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::disable): (WebCore::InspectorDOMDebuggerAgent::mainFrameNavigated): (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::willHandleEvent): (WebCore::InspectorDOMDebuggerAgent::didHandleEvent): (WebCore::InspectorDOMDebuggerAgent::willFireTimer): (WebCore::InspectorDOMDebuggerAgent::didFireTimer): * inspector/agents/page/PageDOMDebuggerAgent.h: * inspector/agents/page/PageDOMDebuggerAgent.cpp: (WebCore::PageDOMDebuggerAgent::disable): (WebCore::PageDOMDebuggerAgent::mainFrameNavigated): (WebCore::PageDOMDebuggerAgent::willFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::didFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::setAnimationFrameBreakpoint): * inspector/agents/worker/WorkerDOMDebuggerAgent.h: * inspector/agents/worker/WorkerDOMDebuggerAgent.cpp: (WebCore::WorkerDOMDebuggerAgent::setAnimationFrameBreakpoint): Keep a `JSC::Breakpoint` for each event breakpoint instead of a simple `bool`, allowing for configuration when the breakpoint is first set. When any of these breakpoints are hit, pass it to the `JSC::Debugger` as a "special breakpoint", which behaves the same as "pause ASAP" but also supports a condition, an ignore count, actions, and auto-continue. Reset the hit count for any of these "special breakpoints" that persist across Web Inspector sessions when the main frame navigates. * inspector/PageScriptDebugServer.h: * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::PageScriptDebugServer): (WebCore::PageScriptDebugServer::attachDebugger): (WebCore::PageScriptDebugServer::detachDebugger): (WebCore::PageScriptDebugServer::didPause): (WebCore::PageScriptDebugServer::didContinue): (WebCore::PageScriptDebugServer::runEventLoopWhilePaused): (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal): (WebCore::PageScriptDebugServer::isContentScript const): (WebCore::PageScriptDebugServer::reportException const): * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException const): * inspector/agents/page/PageDebuggerAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: (WebCore::PageDebuggerAgent::sourceMapURLForScript): Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * inspector/TimelineRecordFactory.h: * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createProbeSampleData): * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::breakpointActionProbe): Replace `Inspector::ScriptBreakpoint` with `JSC::Breakpoint`. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::didFireTimer): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didHandleEventImpl): (WebCore::InspectorInstrumentation::didFireTimerImpl): (WebCore::InspectorInstrumentation::didCommitLoadImpl): (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl): * dom/EventTarget.cpp: (WebCore::EventTarget::innerInvokeEventListeners): * page/DOMTimer.cpp: (WebCore::DOMTimer::fired): When notifying Web Inspector that activity did occur, include all information previously included when notifying Web Inspector that that activity was about to occur so that Web Inspector can know whether a pause for the "special breakpoint" for that activity is still scheduled and if so cancel it. Source/WebInspectorUI: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * UserInterface/Models/Breakpoint.js: (WI.Breakpoint): (WI.Breakpoint.prototype.toJSON): (WI.Breakpoint.prototype.get special): Added. (WI.Breakpoint.prototype.get removable): Added. (WI.Breakpoint.prototype.get editable): Added. (WI.Breakpoint.prototype.set condition): (WI.Breakpoint.prototype.get ignoreCount): (WI.Breakpoint.prototype.set ignoreCount): (WI.Breakpoint.prototype.get autoContinue): (WI.Breakpoint.prototype.set autoContinue): (WI.Breakpoint.prototype.get actions): (WI.Breakpoint.prototype.get probeActions): (WI.Breakpoint.prototype.cycleToNextMode): (WI.Breakpoint.prototype.createAction): (WI.Breakpoint.prototype.recreateAction): (WI.Breakpoint.prototype.removeAction): (WI.Breakpoint.prototype.clearActions): (WI.Breakpoint.prototype.remove): Added. (WI.Breakpoint.prototype.optionsToProtocol): Added. (WI.Breakpoint.prototype.breakpointActionDidChange): (WI.Breakpoint.fromJSON): Deleted. (WI.Breakpoint.prototype.get sourceCodeLocation): Deleted. (WI.Breakpoint.prototype.get contentIdentifier): Deleted. (WI.Breakpoint.prototype.get scriptIdentifier): Deleted. (WI.Breakpoint.prototype.get target): Deleted. (WI.Breakpoint.prototype.get identifier): Deleted. (WI.Breakpoint.prototype.set identifier): Deleted. (WI.Breakpoint.prototype.get resolved): Deleted. (WI.Breakpoint.prototype.set resolved): Deleted. (WI.Breakpoint.prototype.saveIdentityToCookie): Deleted. (WI.Breakpoint.prototype._isSpecial): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationLocationChanged): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationDisplayLocationChanged): Deleted. * UserInterface/Models/DOMBreakpoint.js: (WI.DOMBreakpoint): (WI.DOMBreakpoint.fromJSON): Added. (WI.DOMBreakpoint.prototype.remove): Added. (WI.DOMBreakpoint.prototype.toJSON): (WI.DOMBreakpoint.deserialize): Deleted. (WI.DOMBreakpoint.prototype.get disabled): Deleted. (WI.DOMBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/EventBreakpoint.js: (WI.EventBreakpoint): (WI.EventBreakpoint.fromJSON): Added. (WI.EventBreakpoint.prototype.get special): Added. (WI.EventBreakpoint.prototype.get editable): Added. (WI.EventBreakpoint.prototype.remove): Added. (WI.EventBreakpoint.prototype.saveIdentityToCookie): (WI.EventBreakpoint.prototype.toJSON): (WI.EventBreakpoint.deserialize): Deleted. (WI.EventBreakpoint.prototype.get disabled): Deleted. (WI.EventBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/JavaScriptBreakpoint.js: Copied from UserInterface/Models/Breakpoint.js. (WI.JavaScriptBreakpoint): (WI.JavaScriptBreakpoint.fromJSON): (WI.JavaScriptBreakpoint.prototype.toJSON): (WI.JavaScriptBreakpoint.prototype.get sourceCodeLocation): (WI.JavaScriptBreakpoint.prototype.get contentIdentifier): (WI.JavaScriptBreakpoint.prototype.get scriptIdentifier): (WI.JavaScriptBreakpoint.prototype.get target): (WI.JavaScriptBreakpoint.prototype.get special): Added. (WI.JavaScriptBreakpoint.prototype.get removable): Added. (WI.JavaScriptBreakpoint.prototype.get editable): Added. (WI.JavaScriptBreakpoint.prototype.get identifier): (WI.JavaScriptBreakpoint.prototype.set identifier): (WI.JavaScriptBreakpoint.prototype.get resolved): (WI.JavaScriptBreakpoint.prototype.set resolved): (WI.JavaScriptBreakpoint.prototype.remove): Added. (WI.JavaScriptBreakpoint.prototype.saveIdentityToCookie): (WI.JavaScriptBreakpoint.prototype._isSpecial): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationLocationChanged): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationDisplayLocationChanged): * UserInterface/Models/URLBreakpoint.js: (WI.URLBreakpoint): (WI.URLBreakpoint.fromJSON): Added. (WI.URLBreakpoint.prototype.get special): Added. (WI.URLBreakpoint.prototype.remove): Added. (WI.URLBreakpoint.prototype.toJSON): (WI.URLBreakpoint.deserialize): Deleted. (WI.URLBreakpoint.prototype.get disabled): Deleted. (WI.URLBreakpoint.prototype.set disabled): Deleted. Rename `WI.Breakpoint` to `WI.JavaScriptBreakpoint` and use `WI.Breakpoint` as a new common base class for all breakpoint types, allowing more logic to be shared (e.g. disabled state). Additionally, breakpoints are now able to - determine whether or not they're - special - removable - editable (i.e. configurable) - remove themselves without the caller needing to know what manager to consult with. * UserInterface/Controllers/DOMManager.js: (WI.DOMManager): (WI.DOMManager.supportsEventListenerBreakpointConfiguration): Added. (WI.DOMManager.prototype.setBreakpointForEventListener): (WI.DOMManager.prototype.removeBreakpointForEventListener): (WI.DOMManager.prototype._setEventBreakpoint): Added. (WI.DOMManager.prototype._removeEventBreakpoint): Added. (WI.DOMManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for specific listener breakpoints. * UserInterface/Controllers/DOMDebuggerManager.js: (WI.DOMDebuggerManager): (WI.DOMDebuggerManager.prototype.initializeTarget): (WI.DOMDebuggerManager.prototype.addDOMBreakpoint): (WI.DOMDebuggerManager.prototype.removeDOMBreakpoint): (WI.DOMDebuggerManager.prototype.addEventBreakpoint): (WI.DOMDebuggerManager.prototype.removeEventBreakpoint): (WI.DOMDebuggerManager.prototype.addURLBreakpoint): (WI.DOMDebuggerManager.prototype.removeURLBreakpoint): (WI.DOMDebuggerManager.prototype._commandArgumentsForEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._setEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._removeEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointDisabledStateChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMDebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DOMDebuggerManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for special event breakpoints. Store special event breakpoints inside `WI.objectStores.eventBreakpoints`. * UserInterface/Controllers/DebuggerManager.js: (WI.DebuggerManager): (WI.DebuggerManager.prototype.addBreakpoint): (WI.DebuggerManager.prototype.removeBreakpoint): (WI.DebuggerManager.prototype.addProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.removeProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.updateProbesForBreakpoint): Added. (WI.DebuggerManager.prototype._setBreakpoint): (WI.DebuggerManager.prototype._breakpointEditablePropertyDidChange): (WI.DebuggerManager.prototype._handleBreakpointActionsDidChange): (WI.DebuggerManager.prototype.isBreakpointRemovable): Deleted. (WI.DebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DebuggerManager.prototype.isBreakpointEditable): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointActionType): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointOptions): Deleted. (WI.DebuggerManager.prototype._addProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._removeProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._updateProbesForBreakpoint): Deleted. Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Controllers/BreakpointPopoverController.js: (WI.BreakpointPopoverController.prototype.appendContextMenuItems): (WI.BreakpointPopoverController.prototype._createPopoverContent): Allow any breakpoint instead of only `WI.JavaScriptBreakpoint`. Drive-by: the existing `ignoreCount` value wasn't being used to populate the `<input>`. * UserInterface/Views/BreakpointTreeElement.js: (WI.BreakpointTreeElement.prototype.ondelete): (WI.BreakpointTreeElement.prototype.get listenerSet): Added. (WI.BreakpointTreeElement.prototype.updateStatus): Added. (WI.BreakpointTreeElement.prototype.updateTitles): Added. (WI.BreakpointTreeElement.prototype.get breakpoint): Deleted. (WI.BreakpointTreeElement.prototype.get filterableData): Deleted. (WI.BreakpointTreeElement.prototype._updateTitles): Deleted. (WI.BreakpointTreeElement.prototype._updateStatus): Deleted. (WI.BreakpointTreeElement.prototype._breakpointLocationDidChange): Deleted. * UserInterface/Views/BreakpointTreeElement.css: (.item.breakpoint .status > .status-image): (.item.breakpoint.paused .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.paused .icon): Added. (.item.breakpoint .status > .status-image.resolved): Deleted. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.selected .status > .status-image.resolved): Deleted. (.item.breakpoint .subtitle.formatted-location): Deleted. (.breakpoint-debugger-statement-icon .icon): Deleted. (.breakpoint-exception-icon .icon): Deleted. (.breakpoint-assertion-icon .icon): Deleted. (.breakpoint-microtask-icon .icon): Deleted. (.breakpoint-paused-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon > span): Deleted. (.data-updated.breakpoint-generic-line-icon .icon > span): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-debugger-statement-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-exception-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-assertion-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-microtask-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-paused-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-generic-line-icon .icon): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.js: (WI.DOMBreakpointTreeElement): (WI.DOMBreakpointTreeElement.prototype.onattach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondetach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondelete): Deleted. (WI.DOMBreakpointTreeElement.prototype.onenter): Deleted. (WI.DOMBreakpointTreeElement.prototype.onspace): Deleted. (WI.DOMBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.DOMBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.DOMBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.css: (.item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (.breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/EventBreakpointTreeElement.js: (WI.EventBreakpointTreeElement): (WI.EventBreakpointTreeElement.prototype.onattach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondetach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondelete): Deleted. (WI.EventBreakpointTreeElement.prototype.onenter): Deleted. (WI.EventBreakpointTreeElement.prototype.onspace): Deleted. (WI.EventBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.EventBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.EventBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/EventBreakpointTreeElement.css: (.item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (.item.breakpoint.event.interval:not(.paused) .icon): Added. (.item.breakpoint.event.listener:not(.paused) .icon): Added. (.item.breakpoint.event.timeout:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.interval:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.listener:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.timeout:not(.paused) .icon): Added. (.breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/JavaScriptBreakpointTreeElement.js: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js. (WI.JavaScriptBreakpointTreeElement): (WI.JavaScriptBreakpointTreeElement.prototype.get filterableData): (WI.JavaScriptBreakpointTreeElement.prototype.updateStatus): Added. (WI.JavaScriptBreakpointTreeElement.prototype.updateTitles): Added. (WI.JavaScriptBreakpointTreeElement.prototype._breakpointLocationDidChange): * UserInterface/Views/JavaScriptBreakpointTreeElement.css: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css. (.item.breakpoint.javascript .status > .status-image): Added. (.item.breakpoint.javascript .status > .status-image.resolved): Added. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.javascript.selected .status > .status-image.resolved): Added. (.item.breakpoint.javascript .subtitle.formatted-location): Added. (.item.breakpoint.javascript.line .icon): Added. (.item.breakpoint.javascript.line .icon > span): Added. (.data-updated.item.breakpoint.javascript.line .icon > span): Added. (.item.breakpoint.javascript.debugger-statement .icon): Added. (.item.breakpoint.javascript.exception .icon): Added. (.item.breakpoint.javascript.assertion .icon): Added. (.item.breakpoint.javascript.microtask .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.line .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.debugger-statement .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.exception .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.assertion .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.microtask .icon): Added. * UserInterface/Views/URLBreakpointTreeElement.js: (WI.URLBreakpointTreeElement): (WI.URLBreakpointTreeElement.prototype.onattach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondetach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondelete): Deleted. (WI.URLBreakpointTreeElement.prototype.onenter): Deleted. (WI.URLBreakpointTreeElement.prototype.onspace): Deleted. (WI.URLBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.URLBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.URLBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/URLBreakpointTreeElement.css: (.item.breakpoint.url .subtitle): Added. (.item.breakpoint.url:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.url:not(.paused) .icon): Added. (.breakpoint.url .subtitle): Deleted. (.breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. Rename `WI.BreakpointTreeElement` to `WI.JavaScriptBreakpointTreeElement` and use `WI.BreakpointTreeElement` as a new common base class for all breakpoint tree elements, allowing more logic and styles to be shared (e.g. disabled state). * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel): (WI.SourcesNavigationSidebarPanel.prototype.closed): (WI.SourcesNavigationSidebarPanel.prototype._insertDebuggerTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._compareJavaScriptBreakpointTreeElements): Added. (WI.SourcesNavigationSidebarPanel.prototype._addBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._removeAllBreakpoints): (WI.SourcesNavigationSidebarPanel.prototype._breakpointsBeneathTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._addIssue): (WI.SourcesNavigationSidebarPanel.prototype._updatePauseReasonSection): (WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange): (WI.SourcesNavigationSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu.addToggleForSpecialEventBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu): (WI.SourcesNavigationSidebarPanel.prototype._handleDebuggerObjectDisplayLocationDidChange): (WI.SourcesNavigationSidebarPanel.prototype._compareBreakpointTreeElements): Deleted. * UserInterface/Models/ProbeSet.js: (WI.ProbeSet): (WI.ProbeSet.prototype.createProbe): (WI.ProbeSet.prototype.willRemove): * UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.prototype._processRecord): * UserInterface/Views/ProbeSetDetailsSection.js: (WI.ProbeSetDetailsSection): * UserInterface/Views/ProbeDetailsSidebarPanel.js: (WI.ProbeDetailsSidebarPanel.prototype.inspect): * UserInterface/Views/SourceCodeTextEditor.js: (WI.SourceCodeTextEditor): (WI.SourceCodeTextEditor.prototype.close): (WI.SourceCodeTextEditor.prototype.textEditorBreakpointAdded): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype.get supplementalRepresentedObjects): (WI.TextResourceContentView.prototype._probeSetsChanged): Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Views/ContentView.js: (WI.ContentView.createFromRepresentedObject): (WI.ContentView.resolvedRepresentedObjectForRepresentedObject): (WI.ContentView.isViewable): * UserInterface/Views/ContextMenuUtilities.js: (WI.appendContextMenuItemsForSourceCode): Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. * UserInterface/Views/DOMTreeContentView.js: (WI.DOMTreeContentView): Replace `WI.DOMBreakpoint` with `WI.Breakpoint`. * UserInterface/Views/EventListenerSectionGroup.js: (WI.EventListenerSectionGroup): * UserInterface/Views/EventListenerSectionGroup.css: (.event-listener-section > .content input[type="checkbox"] + .go-to-arrow): Added. (.event-listener-section > .content input[type="checkbox"]:not(:checked) + .go-to-arrow): Added. Add a go-to arrow next to the Breakpoint checkbox that reveals the `WI.EventBreakpoint` in the Sources Tab. * UserInterface/Views/BreakpointActionView.js: (WI.BreakpointActionView.prototype._appendActionButtonClicked): Drive-by: minor code cleanup. * UserInterface/Views/CallFrameTreeElement.js: (WI.CallFrameTreeElement.prototype.populateContextMenu): Drive-by: include source code location context menu items. * UserInterface/Base/Setting.js: * UserInterface/Main.html: * UserInterface/Test.html: LayoutTests: * inspector/dom-debugger/resources/event-breakpoint-utilities.js: (TestPage.registerInitializer.InspectorTest.EventBreakpoint.addBreakpointOptionsTestCases): Added. (TestPage.registerInitializer.InspectorTest.EventBreakpoint.async teardown): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.createBreakpoint): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.removeBreakpoint): * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/breakpoint-for-event-listener-expected.txt: * inspector/dom-debugger/event-animation-frame-breakpoints.html: * inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt: * inspector/dom-debugger/event-interval-breakpoints.html: * inspector/dom-debugger/event-interval-breakpoints-expected.txt: * inspector/dom-debugger/event-listener-breakpoints.html: * inspector/dom-debugger/event-listener-breakpoints-expected.txt: * inspector/dom-debugger/event-timeout-breakpoints.html: * inspector/dom-debugger/event-timeout-breakpoints-expected.txt: Add tests for new event breakpoint configuration options. * http/tests/inspector/debugger/debugger-test.js: (TestPage.registerInitializer.InspectorTest.startTracingBreakpoints): * http/tests/inspector/resources/probe-test.js: (TestPage.registerInitializer.ProtocolTest.Probe.installTracingListeners): * inspector/debugger/breakpoint-action-eval.html: * inspector/debugger/breakpoint-action-log.html: * inspector/debugger/breakpoint-columns.html: * inspector/debugger/breakpoint-scope.html: * inspector/debugger/debugger-stack-overflow.html: * inspector/debugger/pause-reason.html: * inspector/debugger/probe-manager-add-remove-actions.html: * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/debugger/tail-deleted-frames-this-value.html: * inspector/debugger/tail-recursion.html: * inspector/worker/debugger-pause.html: * inspector/worker/debugger-shared-breakpoint.html: Update existing breakpoint tests to use new model objects. Canonical link: https://commits.webkit.org/228551@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 17:34:12 +00:00
JSC::Debugger::detachDebugger(isBeingDestroyed);
Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope https://bugs.webkit.org/show_bug.cgi?id=218108 Reviewed by Darin Adler and Devin Rousso. Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope, in preparation for Worklets support. This will allow us to reuse this code when we add Web Inspector support for Worklets. No new tests, no behavior change yet. * Modules/webaudio/AudioWorkletThread.cpp: (WebCore::AudioWorkletThread::workerDebuggerProxy const): * Modules/webaudio/AudioWorkletThread.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::instrumentingAgentsForWebGPUDevice): (WebCore::InspectorInstrumentation::consoleAgentEnabled): (WebCore::InspectorInstrumentation::timelineAgentTracking): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didClearWindowObjectInWorld): (WebCore::InspectorInstrumentation::isDebuggerPaused): (WebCore::InspectorInstrumentation::identifierForNode): (WebCore::InspectorInstrumentation::addEventListenersToNode): (WebCore::InspectorInstrumentation::willInsertDOMNode): (WebCore::InspectorInstrumentation::didInsertDOMNode): (WebCore::InspectorInstrumentation::willRemoveDOMNode): (WebCore::InspectorInstrumentation::didRemoveDOMNode): (WebCore::InspectorInstrumentation::willModifyDOMAttr): (WebCore::InspectorInstrumentation::didModifyDOMAttr): (WebCore::InspectorInstrumentation::didRemoveDOMAttr): (WebCore::InspectorInstrumentation::willInvalidateStyleAttr): (WebCore::InspectorInstrumentation::didInvalidateStyleAttr): (WebCore::InspectorInstrumentation::documentDetached): (WebCore::InspectorInstrumentation::frameWindowDiscarded): (WebCore::InspectorInstrumentation::mediaQueryResultChanged): (WebCore::InspectorInstrumentation::activeStyleSheetsUpdated): (WebCore::InspectorInstrumentation::didPushShadowRoot): (WebCore::InspectorInstrumentation::willPopShadowRoot): (WebCore::InspectorInstrumentation::didChangeCustomElementState): (WebCore::InspectorInstrumentation::pseudoElementCreated): (WebCore::InspectorInstrumentation::pseudoElementDestroyed): (WebCore::InspectorInstrumentation::didCreateNamedFlow): (WebCore::InspectorInstrumentation::willRemoveNamedFlow): (WebCore::InspectorInstrumentation::didChangeRegionOverset): (WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::mouseDidMoveOverElement): (WebCore::InspectorInstrumentation::handleTouchEvent): (WebCore::InspectorInstrumentation::handleMousePress): (WebCore::InspectorInstrumentation::forcePseudoState): (WebCore::InspectorInstrumentation::characterDataModified): (WebCore::InspectorInstrumentation::willSendXMLHttpRequest): (WebCore::InspectorInstrumentation::willFetch): (WebCore::InspectorInstrumentation::didInstallTimer): (WebCore::InspectorInstrumentation::didRemoveTimer): (WebCore::InspectorInstrumentation::didAddEventListener): (WebCore::InspectorInstrumentation::willRemoveEventListener): (WebCore::InspectorInstrumentation::isEventListenerDisabled): (WebCore::InspectorInstrumentation::willPostMessage): (WebCore::InspectorInstrumentation::didPostMessage): (WebCore::InspectorInstrumentation::didFailPostMessage): (WebCore::InspectorInstrumentation::willDispatchPostMessage): (WebCore::InspectorInstrumentation::didDispatchPostMessage): (WebCore::InspectorInstrumentation::willCallFunction): (WebCore::InspectorInstrumentation::didCallFunction): (WebCore::InspectorInstrumentation::willDispatchEvent): (WebCore::InspectorInstrumentation::didDispatchEvent): (WebCore::InspectorInstrumentation::willHandleEvent): (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::willDispatchEventOnWindow): (WebCore::InspectorInstrumentation::didDispatchEventOnWindow): (WebCore::InspectorInstrumentation::eventDidResetAfterDispatch): (WebCore::InspectorInstrumentation::willEvaluateScript): (WebCore::InspectorInstrumentation::didEvaluateScript): (WebCore::InspectorInstrumentation::willFireTimer): (WebCore::InspectorInstrumentation::didFireTimer): (WebCore::InspectorInstrumentation::didInvalidateLayout): (WebCore::InspectorInstrumentation::willLayout): (WebCore::InspectorInstrumentation::didLayout): (WebCore::InspectorInstrumentation::didScroll): (WebCore::InspectorInstrumentation::willComposite): (WebCore::InspectorInstrumentation::didComposite): (WebCore::InspectorInstrumentation::willPaint): (WebCore::InspectorInstrumentation::didPaint): (WebCore::InspectorInstrumentation::willRecalculateStyle): (WebCore::InspectorInstrumentation::didRecalculateStyle): (WebCore::InspectorInstrumentation::didScheduleStyleRecalculation): (WebCore::InspectorInstrumentation::applyUserAgentOverride): (WebCore::InspectorInstrumentation::applyEmulatedMedia): (WebCore::InspectorInstrumentation::willSendRequest): (WebCore::InspectorInstrumentation::willSendRequestOfType): (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache): (WebCore::InspectorInstrumentation::didReceiveResourceResponse): (WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponse): (WebCore::InspectorInstrumentation::didReceiveData): (WebCore::InspectorInstrumentation::didFinishLoading): (WebCore::InspectorInstrumentation::didFailLoading): (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied): (WebCore::InspectorInstrumentation::continueWithPolicyDownload): (WebCore::InspectorInstrumentation::continueWithPolicyIgnore): (WebCore::InspectorInstrumentation::willLoadXHRSynchronously): (WebCore::InspectorInstrumentation::didLoadXHRSynchronously): (WebCore::InspectorInstrumentation::scriptImported): (WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSP): (WebCore::InspectorInstrumentation::didReceiveScriptResponse): (WebCore::InspectorInstrumentation::domContentLoadedEventFired): (WebCore::InspectorInstrumentation::loadEventFired): (WebCore::InspectorInstrumentation::frameDetachedFromParent): (WebCore::InspectorInstrumentation::didCommitLoad): (WebCore::InspectorInstrumentation::frameDocumentUpdated): (WebCore::InspectorInstrumentation::loaderDetachedFromFrame): (WebCore::InspectorInstrumentation::frameStartedLoading): (WebCore::InspectorInstrumentation::frameStoppedLoading): (WebCore::InspectorInstrumentation::frameScheduledNavigation): (WebCore::InspectorInstrumentation::frameClearedScheduledNavigation): (WebCore::InspectorInstrumentation::defaultAppearanceDidChange): (WebCore::InspectorInstrumentation::willIntercept): (WebCore::InspectorInstrumentation::shouldInterceptRequest): (WebCore::InspectorInstrumentation::shouldInterceptResponse): (WebCore::InspectorInstrumentation::interceptRequest): (WebCore::InspectorInstrumentation::interceptResponse): (WebCore::InspectorInstrumentation::didOpenDatabase): (WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent): (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStart): (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::didCreateWebSocket): (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest): (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorInstrumentation::didCloseWebSocket): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrame): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrameError): (WebCore::InspectorInstrumentation::didSendWebSocketFrame): (WebCore::InspectorInstrumentation::didHandleMemoryPressure): (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes): (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext): (WebCore::InspectorInstrumentation::didChangeCanvasMemory): (WebCore::InspectorInstrumentation::recordCanvasAction): (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame): (WebCore::InspectorInstrumentation::didEnableExtension): (WebCore::InspectorInstrumentation::didCreateWebGLProgram): (WebCore::InspectorInstrumentation::willDestroyWebGLProgram): (WebCore::InspectorInstrumentation::isWebGLProgramDisabled): (WebCore::InspectorInstrumentation::isWebGLProgramHighlighted): (WebCore::InspectorInstrumentation::willConfigureSwapChain): (WebCore::InspectorInstrumentation::willDestroyWebGPUPipeline): (WebCore::InspectorInstrumentation::willApplyKeyframeEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationName): (WebCore::InspectorInstrumentation::didSetWebAnimationEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTiming): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTarget): (WebCore::InspectorInstrumentation::didCreateWebAnimation): (WebCore::InspectorInstrumentation::willDestroyWebAnimation): (WebCore::InspectorInstrumentation::networkStateChanged): (WebCore::InspectorInstrumentation::updateApplicationCacheStatus): (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore::InspectorInstrumentation::consoleCount): (WebCore::InspectorInstrumentation::consoleCountReset): (WebCore::InspectorInstrumentation::takeHeapSnapshot): (WebCore::InspectorInstrumentation::startConsoleTiming): (WebCore::InspectorInstrumentation::logConsoleTiming): (WebCore::InspectorInstrumentation::stopConsoleTiming): (WebCore::InspectorInstrumentation::consoleTimeStamp): (WebCore::InspectorInstrumentation::startProfiling): (WebCore::InspectorInstrumentation::stopProfiling): (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas): (WebCore::InspectorInstrumentation::consoleStopRecordingCanvas): (WebCore::InspectorInstrumentation::didRequestAnimationFrame): (WebCore::InspectorInstrumentation::didCancelAnimationFrame): (WebCore::InspectorInstrumentation::willFireAnimationFrame): (WebCore::InspectorInstrumentation::didFireAnimationFrame): (WebCore::InspectorInstrumentation::willFireObserverCallback): (WebCore::InspectorInstrumentation::didFireObserverCallback): (WebCore::InspectorInstrumentation::layerTreeDidChange): (WebCore::InspectorInstrumentation::renderLayerDestroyed): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForFrame): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForDocument): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. * inspector/InspectorWebAgentBase.h: (WebCore::WorkerAgentContext::WorkerAgentContext): * inspector/WorkerDebugger.cpp: (WebCore::WorkerDebugger::WorkerDebugger): (WebCore::WorkerDebugger::attachDebugger): (WebCore::WorkerDebugger::detachDebugger): (WebCore::WorkerDebugger::runEventLoopWhilePaused): * inspector/WorkerDebugger.h: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::workerAgentContext): (WebCore::WorkerInspectorController::createLazyAgents): (WebCore::WorkerInspectorController::vm): * inspector/WorkerInspectorController.h: * inspector/WorkerToPageFrontendChannel.h: * inspector/agents/worker/ServiceWorkerAgent.cpp: (WebCore::ServiceWorkerAgent::ServiceWorkerAgent): * inspector/agents/worker/WorkerAuditAgent.cpp: (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/agents/worker/WorkerAuditAgent.h: * inspector/agents/worker/WorkerConsoleAgent.cpp: (WebCore::WorkerConsoleAgent::WorkerConsoleAgent): * inspector/agents/worker/WorkerDebuggerAgent.cpp: (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent): (WebCore::WorkerDebuggerAgent::breakpointActionLog): (WebCore::WorkerDebuggerAgent::injectedScriptForEval): * inspector/agents/worker/WorkerDebuggerAgent.h: * inspector/agents/worker/WorkerNetworkAgent.cpp: (WebCore::WorkerNetworkAgent::WorkerNetworkAgent): (WebCore::WorkerNetworkAgent::setResourceCachingDisabledInternal): (WebCore::WorkerNetworkAgent::scriptExecutionContext): * inspector/agents/worker/WorkerNetworkAgent.h: * inspector/agents/worker/WorkerRuntimeAgent.cpp: (WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent): (WebCore::WorkerRuntimeAgent::injectedScriptForEval): * inspector/agents/worker/WorkerRuntimeAgent.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::prepareForDestruction): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController const): Deleted. * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): (WebCore::WorkerOrWorkletGlobalScope::prepareForDestruction): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::inspectorController const): * workers/WorkerOrWorkletThread.h: * workers/WorkerThread.h: (WebCore::WorkerThread::workerDebuggerProxy const): Deleted. Canonical link: https://commits.webkit.org/230818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-23 01:00:04 +00:00
if (m_globalScope.script())
m_globalScope.script()->detachDebugger(this);
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
if (!isBeingDestroyed)
recompileAllJSFunctions();
}
Web Inspector: rename `ScriptDebugServer` subclasses/methods https://bugs.webkit.org/show_bug.cgi?id=215363 <rdar://problem/67310441> Reviewed by Brian Burg. r266074 merged `Inspector::ScriptDebugServer` into `JSC::Debugger`. All subclasses and functions should be renamed to match this change. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectDebugger.h: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h. * inspector/JSGlobalObjectDebugger.cpp: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp. * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.cpp: * inspector/remote/RemoteInspectionTarget.cpp: * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm: Source/WebCore: * Headers.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorController.h: * inspector/InspectorController.cpp: * inspector/PageDebugger.h: Renamed from Source/WebCore/inspector/PageScriptDebugServer.h. * inspector/PageDebugger.cpp: Renamed from Source/WebCore/inspector/PageScriptDebugServer.cpp. * inspector/mac/PageDebuggerMac.mm: Renamed from Source/WebCore/inspector/mac/PageScriptDebugServerMac.mm. * inspector/WorkerDebugger.h: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.h. * inspector/WorkerDebugger.cpp: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.cpp. * inspector/WorkerInspectorController.h: * inspector/WorkerInspectorController.cpp: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/page/PageDebuggerAgent.cpp: Canonical link: https://commits.webkit.org/228554@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 18:40:30 +00:00
void WorkerDebugger::recompileAllJSFunctions()
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
{
JSC::JSLockHolder lock(vm());
JSC::Debugger::recompileAllJSFunctions();
}
Web Inspector: rename `ScriptDebugServer` subclasses/methods https://bugs.webkit.org/show_bug.cgi?id=215363 <rdar://problem/67310441> Reviewed by Brian Burg. r266074 merged `Inspector::ScriptDebugServer` into `JSC::Debugger`. All subclasses and functions should be renamed to match this change. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectDebugger.h: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h. * inspector/JSGlobalObjectDebugger.cpp: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp. * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.cpp: * inspector/remote/RemoteInspectionTarget.cpp: * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm: Source/WebCore: * Headers.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorController.h: * inspector/InspectorController.cpp: * inspector/PageDebugger.h: Renamed from Source/WebCore/inspector/PageScriptDebugServer.h. * inspector/PageDebugger.cpp: Renamed from Source/WebCore/inspector/PageScriptDebugServer.cpp. * inspector/mac/PageDebuggerMac.mm: Renamed from Source/WebCore/inspector/mac/PageScriptDebugServerMac.mm. * inspector/WorkerDebugger.h: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.h. * inspector/WorkerDebugger.cpp: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.cpp. * inspector/WorkerInspectorController.h: * inspector/WorkerInspectorController.cpp: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/page/PageDebuggerAgent.cpp: Canonical link: https://commits.webkit.org/228554@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 18:40:30 +00:00
void WorkerDebugger::runEventLoopWhilePaused()
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
{
Web Inspector: allow event breakpoints to be configured https://bugs.webkit.org/show_bug.cgi?id=215362 <rdar://problem/66932921> Reviewed by Brian Burg. Source/JavaScriptCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * inspector/protocol/DOM.json: Add an `options` paramater to `DOM.setBreakpointForEventListener` to allow configuration. * inspector/protocol/DOMDebugger.json: Add an `options` paramater to `DOMDebugger.setEventBreakpoint` to allow configuration. * debugger/Breakpoint.h: (JSC::Breakpoint::id const): Added. (JSC::Breakpoint::sourceID const): Added. (JSC::Breakpoint::lineNumber const): Added. (JSC::Breakpoint::columnNumber const): Added. (JSC::Breakpoint::condition const): Added. (JSC::Breakpoint::actions const): Added. (JSC::Breakpoint::isAutoContinue const): Added. (JSC::Breakpoint::resetHitCount): Added. (JSC::Breakpoint::isLinked const): Added. (JSC::Breakpoint::isResolved const): Added. (JSC::BreakpointsList::~BreakpointsList): Deleted. * debugger/Breakpoint.cpp: Added. (JSC::Breakpoint::Action::Action): Added. (JSC::Breakpoint::create): Added. (JSC::Breakpoint::Breakpoint): Added. (JSC::Breakpoint::link): Added. (JSC::Breakpoint::resolve): Added. (JSC::Breakpoint::shouldPause): Added. Unify `JSC::Breakpoint` and `Inspector::ScriptBreakpoint`. * debugger/DebuggerPrimitives.h: * debugger/Debugger.h: * debugger/Debugger.cpp: (JSC::Debugger::Debugger): (JSC::Debugger::addObserver): Added. (JSC::Debugger::removeObserver): Added. (JSC::Debugger::canDispatchFunctionToObservers const): Added. (JSC::Debugger::dispatchFunctionToObservers): Added. (JSC::Debugger::sourceParsed): Added. (JSC::Debugger::toggleBreakpoint): (JSC::Debugger::applyBreakpoints): (JSC::Debugger::resolveBreakpoint): (JSC::Debugger::setBreakpoint): (JSC::Debugger::removeBreakpoint): (JSC::Debugger::didHitBreakpoint): Added. (JSC::Debugger::clearBreakpoints): (JSC::Debugger::evaluateBreakpointCondition): Added. (JSC::Debugger::evaluateBreakpointActions): Added. (JSC::Debugger::schedulePauseAtNextOpportunity): Added. (JSC::Debugger::cancelPauseAtNextOpportunity): Added. (JSC::Debugger::schedulePauseForSpecialBreakpoint): Added. (JSC::Debugger::cancelPauseForSpecialBreakpoint): Added. (JSC::Debugger::continueProgram): (JSC::Debugger::stepNextExpression): (JSC::Debugger::stepIntoStatement): (JSC::Debugger::stepOverStatement): (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::pauseIfNeeded): (JSC::Debugger::handlePause): Added. (JSC::Debugger::exceptionOrCaughtValue): Added. (JSC::Debugger::atExpression): (JSC::Debugger::clearNextPauseState): (JSC::Debugger::willRunMicrotask): Added. (JSC::Debugger::didRunMicrotask): Added. (JSC::Debugger::hasBreakpoint): Deleted. (JSC::Debugger::setPauseOnNextStatement): Deleted. Unify `JSC::Debugger` and `Inspector::ScriptDebugServer` to simplify breakpoint logic. Introduce the concept of a "special breakpoint", which is essentially a `JSC::Breakpoint` that is expected to pause at the next opportunity but isn't tied to a particular location. As an example, whenever an event breakpoint is hit, instead of just pausing at the next opportunity, the newly managed `JSC::Breakpoint` is used as a "special breakpoint", allowing for it's configuration (ie.g. condition, ignore count, actions, auto-continue) to be used. * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::objectGroupForBreakpointAction): (Inspector::breakpointActionTypeForString): Added. (Inspector::parseBreakpointOptions): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::fromPayload): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::ProtocolBreakpoint): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::createDebuggerBreakpoint const): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::matchesScriptURL const): Added. (Inspector::InspectorDebuggerAgent::debuggerBreakpointFromPayload): Added. (Inspector::InspectorDebuggerAgent::enable): (Inspector::InspectorDebuggerAgent::disable): (Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason): (Inspector::InspectorDebuggerAgent::handleConsoleAssert): (Inspector::InspectorDebuggerAgent::didScheduleAsyncCall): (Inspector::buildDebuggerLocation): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::didSetBreakpoint): (Inspector::InspectorDebuggerAgent::resolveBreakpoint): (Inspector::InspectorDebuggerAgent::removeBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::schedulePauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::cancelPauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::schedulePauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::cancelPauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::pause): (Inspector::InspectorDebuggerAgent::resume): (Inspector::InspectorDebuggerAgent::didBecomeIdle): (Inspector::InspectorDebuggerAgent::sourceMapURLForScript): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::willRunMicrotask): (Inspector::InspectorDebuggerAgent::didRunMicrotask): (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionSound): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::clearInspectorBreakpointState): (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): (Inspector::matches): Deleted. (Inspector::buildObjectForBreakpointCookie): Deleted. (Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol): Deleted. (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): Deleted. (Inspector::InspectorDebuggerAgent::cancelPauseOnNextStatement): Deleted. Create a private `ProtocolBreakpoint` class that holds the data sent by the frontend. This is necessary because breakpoints in the frontend have a potentially one-to-many relationship with breakpoints in the backend, as the same script can be loaded many times on a page. Each of those scripts is independent, however, and can execute differently, meaning that the same breakpoint for each script also needs a different state (e.g. ignore count). As such, the `ProtocolBreakpoint` is effectively a template that is actualized whenever a new script is parsed that matches the URL of the `ProtocolBreakpoint` to create a `JSC::Breakpoint` that is used by the `JSC::Debugger`. `ProtocolBreakpoint` also parses breakpoint configurations. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectScriptDebugServer.h: * inspector/JSGlobalObjectScriptDebugServer.cpp: (Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer): (Inspector::JSGlobalObjectScriptDebugServer::attachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::detachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused): * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: (Inspector::InspectorAuditAgent::run): * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::setPauseOnExceptionsState): (Inspector::InspectorRuntimeAgent::evaluate): (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::getPreview): (Inspector::InspectorRuntimeAgent::getProperties): (Inspector::InspectorRuntimeAgent::getDisplayableProperties): * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.h: Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * runtime/JSMicrotask.cpp: (JSC::JSMicrotask::run): Drive-by: r248894 mistakenly omitted the call to notify the debugger that the microtask ran. * inspector/ScriptBreakpoint.h: Removed. * inspector/ScriptDebugListener.h: Removed. * inspector/ScriptDebugServer.h: Removed. * inspector/ScriptDebugServer.cpp: Removed. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: Source/WebCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing Tests: inspector/dom/breakpoint-for-event-listener.html inspector/dom-debugger/event-animation-frame-breakpoints.html inspector/dom-debugger/event-interval-breakpoints.html inspector/dom-debugger/event-listener-breakpoints.html inspector/dom-debugger/event-timeout-breakpoints.html * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::getEventListenersForNode): (WebCore::InspectorDOMAgent::setBreakpointForEventListener): (WebCore::InspectorDOMAgent::removeBreakpointForEventListener): (WebCore::InspectorDOMAgent::buildObjectForEventListener): (WebCore::InspectorDOMAgent::breakpointForEventListener): (WebCore::InspectorDOMAgent::hasBreakpointForEventListener): Deleted. * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::disable): (WebCore::InspectorDOMDebuggerAgent::mainFrameNavigated): (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::willHandleEvent): (WebCore::InspectorDOMDebuggerAgent::didHandleEvent): (WebCore::InspectorDOMDebuggerAgent::willFireTimer): (WebCore::InspectorDOMDebuggerAgent::didFireTimer): * inspector/agents/page/PageDOMDebuggerAgent.h: * inspector/agents/page/PageDOMDebuggerAgent.cpp: (WebCore::PageDOMDebuggerAgent::disable): (WebCore::PageDOMDebuggerAgent::mainFrameNavigated): (WebCore::PageDOMDebuggerAgent::willFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::didFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::setAnimationFrameBreakpoint): * inspector/agents/worker/WorkerDOMDebuggerAgent.h: * inspector/agents/worker/WorkerDOMDebuggerAgent.cpp: (WebCore::WorkerDOMDebuggerAgent::setAnimationFrameBreakpoint): Keep a `JSC::Breakpoint` for each event breakpoint instead of a simple `bool`, allowing for configuration when the breakpoint is first set. When any of these breakpoints are hit, pass it to the `JSC::Debugger` as a "special breakpoint", which behaves the same as "pause ASAP" but also supports a condition, an ignore count, actions, and auto-continue. Reset the hit count for any of these "special breakpoints" that persist across Web Inspector sessions when the main frame navigates. * inspector/PageScriptDebugServer.h: * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::PageScriptDebugServer): (WebCore::PageScriptDebugServer::attachDebugger): (WebCore::PageScriptDebugServer::detachDebugger): (WebCore::PageScriptDebugServer::didPause): (WebCore::PageScriptDebugServer::didContinue): (WebCore::PageScriptDebugServer::runEventLoopWhilePaused): (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal): (WebCore::PageScriptDebugServer::isContentScript const): (WebCore::PageScriptDebugServer::reportException const): * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException const): * inspector/agents/page/PageDebuggerAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: (WebCore::PageDebuggerAgent::sourceMapURLForScript): Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * inspector/TimelineRecordFactory.h: * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createProbeSampleData): * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::breakpointActionProbe): Replace `Inspector::ScriptBreakpoint` with `JSC::Breakpoint`. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::didFireTimer): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didHandleEventImpl): (WebCore::InspectorInstrumentation::didFireTimerImpl): (WebCore::InspectorInstrumentation::didCommitLoadImpl): (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl): * dom/EventTarget.cpp: (WebCore::EventTarget::innerInvokeEventListeners): * page/DOMTimer.cpp: (WebCore::DOMTimer::fired): When notifying Web Inspector that activity did occur, include all information previously included when notifying Web Inspector that that activity was about to occur so that Web Inspector can know whether a pause for the "special breakpoint" for that activity is still scheduled and if so cancel it. Source/WebInspectorUI: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * UserInterface/Models/Breakpoint.js: (WI.Breakpoint): (WI.Breakpoint.prototype.toJSON): (WI.Breakpoint.prototype.get special): Added. (WI.Breakpoint.prototype.get removable): Added. (WI.Breakpoint.prototype.get editable): Added. (WI.Breakpoint.prototype.set condition): (WI.Breakpoint.prototype.get ignoreCount): (WI.Breakpoint.prototype.set ignoreCount): (WI.Breakpoint.prototype.get autoContinue): (WI.Breakpoint.prototype.set autoContinue): (WI.Breakpoint.prototype.get actions): (WI.Breakpoint.prototype.get probeActions): (WI.Breakpoint.prototype.cycleToNextMode): (WI.Breakpoint.prototype.createAction): (WI.Breakpoint.prototype.recreateAction): (WI.Breakpoint.prototype.removeAction): (WI.Breakpoint.prototype.clearActions): (WI.Breakpoint.prototype.remove): Added. (WI.Breakpoint.prototype.optionsToProtocol): Added. (WI.Breakpoint.prototype.breakpointActionDidChange): (WI.Breakpoint.fromJSON): Deleted. (WI.Breakpoint.prototype.get sourceCodeLocation): Deleted. (WI.Breakpoint.prototype.get contentIdentifier): Deleted. (WI.Breakpoint.prototype.get scriptIdentifier): Deleted. (WI.Breakpoint.prototype.get target): Deleted. (WI.Breakpoint.prototype.get identifier): Deleted. (WI.Breakpoint.prototype.set identifier): Deleted. (WI.Breakpoint.prototype.get resolved): Deleted. (WI.Breakpoint.prototype.set resolved): Deleted. (WI.Breakpoint.prototype.saveIdentityToCookie): Deleted. (WI.Breakpoint.prototype._isSpecial): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationLocationChanged): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationDisplayLocationChanged): Deleted. * UserInterface/Models/DOMBreakpoint.js: (WI.DOMBreakpoint): (WI.DOMBreakpoint.fromJSON): Added. (WI.DOMBreakpoint.prototype.remove): Added. (WI.DOMBreakpoint.prototype.toJSON): (WI.DOMBreakpoint.deserialize): Deleted. (WI.DOMBreakpoint.prototype.get disabled): Deleted. (WI.DOMBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/EventBreakpoint.js: (WI.EventBreakpoint): (WI.EventBreakpoint.fromJSON): Added. (WI.EventBreakpoint.prototype.get special): Added. (WI.EventBreakpoint.prototype.get editable): Added. (WI.EventBreakpoint.prototype.remove): Added. (WI.EventBreakpoint.prototype.saveIdentityToCookie): (WI.EventBreakpoint.prototype.toJSON): (WI.EventBreakpoint.deserialize): Deleted. (WI.EventBreakpoint.prototype.get disabled): Deleted. (WI.EventBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/JavaScriptBreakpoint.js: Copied from UserInterface/Models/Breakpoint.js. (WI.JavaScriptBreakpoint): (WI.JavaScriptBreakpoint.fromJSON): (WI.JavaScriptBreakpoint.prototype.toJSON): (WI.JavaScriptBreakpoint.prototype.get sourceCodeLocation): (WI.JavaScriptBreakpoint.prototype.get contentIdentifier): (WI.JavaScriptBreakpoint.prototype.get scriptIdentifier): (WI.JavaScriptBreakpoint.prototype.get target): (WI.JavaScriptBreakpoint.prototype.get special): Added. (WI.JavaScriptBreakpoint.prototype.get removable): Added. (WI.JavaScriptBreakpoint.prototype.get editable): Added. (WI.JavaScriptBreakpoint.prototype.get identifier): (WI.JavaScriptBreakpoint.prototype.set identifier): (WI.JavaScriptBreakpoint.prototype.get resolved): (WI.JavaScriptBreakpoint.prototype.set resolved): (WI.JavaScriptBreakpoint.prototype.remove): Added. (WI.JavaScriptBreakpoint.prototype.saveIdentityToCookie): (WI.JavaScriptBreakpoint.prototype._isSpecial): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationLocationChanged): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationDisplayLocationChanged): * UserInterface/Models/URLBreakpoint.js: (WI.URLBreakpoint): (WI.URLBreakpoint.fromJSON): Added. (WI.URLBreakpoint.prototype.get special): Added. (WI.URLBreakpoint.prototype.remove): Added. (WI.URLBreakpoint.prototype.toJSON): (WI.URLBreakpoint.deserialize): Deleted. (WI.URLBreakpoint.prototype.get disabled): Deleted. (WI.URLBreakpoint.prototype.set disabled): Deleted. Rename `WI.Breakpoint` to `WI.JavaScriptBreakpoint` and use `WI.Breakpoint` as a new common base class for all breakpoint types, allowing more logic to be shared (e.g. disabled state). Additionally, breakpoints are now able to - determine whether or not they're - special - removable - editable (i.e. configurable) - remove themselves without the caller needing to know what manager to consult with. * UserInterface/Controllers/DOMManager.js: (WI.DOMManager): (WI.DOMManager.supportsEventListenerBreakpointConfiguration): Added. (WI.DOMManager.prototype.setBreakpointForEventListener): (WI.DOMManager.prototype.removeBreakpointForEventListener): (WI.DOMManager.prototype._setEventBreakpoint): Added. (WI.DOMManager.prototype._removeEventBreakpoint): Added. (WI.DOMManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for specific listener breakpoints. * UserInterface/Controllers/DOMDebuggerManager.js: (WI.DOMDebuggerManager): (WI.DOMDebuggerManager.prototype.initializeTarget): (WI.DOMDebuggerManager.prototype.addDOMBreakpoint): (WI.DOMDebuggerManager.prototype.removeDOMBreakpoint): (WI.DOMDebuggerManager.prototype.addEventBreakpoint): (WI.DOMDebuggerManager.prototype.removeEventBreakpoint): (WI.DOMDebuggerManager.prototype.addURLBreakpoint): (WI.DOMDebuggerManager.prototype.removeURLBreakpoint): (WI.DOMDebuggerManager.prototype._commandArgumentsForEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._setEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._removeEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointDisabledStateChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMDebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DOMDebuggerManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for special event breakpoints. Store special event breakpoints inside `WI.objectStores.eventBreakpoints`. * UserInterface/Controllers/DebuggerManager.js: (WI.DebuggerManager): (WI.DebuggerManager.prototype.addBreakpoint): (WI.DebuggerManager.prototype.removeBreakpoint): (WI.DebuggerManager.prototype.addProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.removeProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.updateProbesForBreakpoint): Added. (WI.DebuggerManager.prototype._setBreakpoint): (WI.DebuggerManager.prototype._breakpointEditablePropertyDidChange): (WI.DebuggerManager.prototype._handleBreakpointActionsDidChange): (WI.DebuggerManager.prototype.isBreakpointRemovable): Deleted. (WI.DebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DebuggerManager.prototype.isBreakpointEditable): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointActionType): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointOptions): Deleted. (WI.DebuggerManager.prototype._addProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._removeProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._updateProbesForBreakpoint): Deleted. Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Controllers/BreakpointPopoverController.js: (WI.BreakpointPopoverController.prototype.appendContextMenuItems): (WI.BreakpointPopoverController.prototype._createPopoverContent): Allow any breakpoint instead of only `WI.JavaScriptBreakpoint`. Drive-by: the existing `ignoreCount` value wasn't being used to populate the `<input>`. * UserInterface/Views/BreakpointTreeElement.js: (WI.BreakpointTreeElement.prototype.ondelete): (WI.BreakpointTreeElement.prototype.get listenerSet): Added. (WI.BreakpointTreeElement.prototype.updateStatus): Added. (WI.BreakpointTreeElement.prototype.updateTitles): Added. (WI.BreakpointTreeElement.prototype.get breakpoint): Deleted. (WI.BreakpointTreeElement.prototype.get filterableData): Deleted. (WI.BreakpointTreeElement.prototype._updateTitles): Deleted. (WI.BreakpointTreeElement.prototype._updateStatus): Deleted. (WI.BreakpointTreeElement.prototype._breakpointLocationDidChange): Deleted. * UserInterface/Views/BreakpointTreeElement.css: (.item.breakpoint .status > .status-image): (.item.breakpoint.paused .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.paused .icon): Added. (.item.breakpoint .status > .status-image.resolved): Deleted. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.selected .status > .status-image.resolved): Deleted. (.item.breakpoint .subtitle.formatted-location): Deleted. (.breakpoint-debugger-statement-icon .icon): Deleted. (.breakpoint-exception-icon .icon): Deleted. (.breakpoint-assertion-icon .icon): Deleted. (.breakpoint-microtask-icon .icon): Deleted. (.breakpoint-paused-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon > span): Deleted. (.data-updated.breakpoint-generic-line-icon .icon > span): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-debugger-statement-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-exception-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-assertion-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-microtask-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-paused-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-generic-line-icon .icon): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.js: (WI.DOMBreakpointTreeElement): (WI.DOMBreakpointTreeElement.prototype.onattach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondetach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondelete): Deleted. (WI.DOMBreakpointTreeElement.prototype.onenter): Deleted. (WI.DOMBreakpointTreeElement.prototype.onspace): Deleted. (WI.DOMBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.DOMBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.DOMBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.css: (.item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (.breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/EventBreakpointTreeElement.js: (WI.EventBreakpointTreeElement): (WI.EventBreakpointTreeElement.prototype.onattach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondetach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondelete): Deleted. (WI.EventBreakpointTreeElement.prototype.onenter): Deleted. (WI.EventBreakpointTreeElement.prototype.onspace): Deleted. (WI.EventBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.EventBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.EventBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/EventBreakpointTreeElement.css: (.item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (.item.breakpoint.event.interval:not(.paused) .icon): Added. (.item.breakpoint.event.listener:not(.paused) .icon): Added. (.item.breakpoint.event.timeout:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.interval:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.listener:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.timeout:not(.paused) .icon): Added. (.breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/JavaScriptBreakpointTreeElement.js: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js. (WI.JavaScriptBreakpointTreeElement): (WI.JavaScriptBreakpointTreeElement.prototype.get filterableData): (WI.JavaScriptBreakpointTreeElement.prototype.updateStatus): Added. (WI.JavaScriptBreakpointTreeElement.prototype.updateTitles): Added. (WI.JavaScriptBreakpointTreeElement.prototype._breakpointLocationDidChange): * UserInterface/Views/JavaScriptBreakpointTreeElement.css: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css. (.item.breakpoint.javascript .status > .status-image): Added. (.item.breakpoint.javascript .status > .status-image.resolved): Added. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.javascript.selected .status > .status-image.resolved): Added. (.item.breakpoint.javascript .subtitle.formatted-location): Added. (.item.breakpoint.javascript.line .icon): Added. (.item.breakpoint.javascript.line .icon > span): Added. (.data-updated.item.breakpoint.javascript.line .icon > span): Added. (.item.breakpoint.javascript.debugger-statement .icon): Added. (.item.breakpoint.javascript.exception .icon): Added. (.item.breakpoint.javascript.assertion .icon): Added. (.item.breakpoint.javascript.microtask .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.line .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.debugger-statement .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.exception .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.assertion .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.microtask .icon): Added. * UserInterface/Views/URLBreakpointTreeElement.js: (WI.URLBreakpointTreeElement): (WI.URLBreakpointTreeElement.prototype.onattach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondetach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondelete): Deleted. (WI.URLBreakpointTreeElement.prototype.onenter): Deleted. (WI.URLBreakpointTreeElement.prototype.onspace): Deleted. (WI.URLBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.URLBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.URLBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/URLBreakpointTreeElement.css: (.item.breakpoint.url .subtitle): Added. (.item.breakpoint.url:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.url:not(.paused) .icon): Added. (.breakpoint.url .subtitle): Deleted. (.breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. Rename `WI.BreakpointTreeElement` to `WI.JavaScriptBreakpointTreeElement` and use `WI.BreakpointTreeElement` as a new common base class for all breakpoint tree elements, allowing more logic and styles to be shared (e.g. disabled state). * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel): (WI.SourcesNavigationSidebarPanel.prototype.closed): (WI.SourcesNavigationSidebarPanel.prototype._insertDebuggerTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._compareJavaScriptBreakpointTreeElements): Added. (WI.SourcesNavigationSidebarPanel.prototype._addBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._removeAllBreakpoints): (WI.SourcesNavigationSidebarPanel.prototype._breakpointsBeneathTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._addIssue): (WI.SourcesNavigationSidebarPanel.prototype._updatePauseReasonSection): (WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange): (WI.SourcesNavigationSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu.addToggleForSpecialEventBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu): (WI.SourcesNavigationSidebarPanel.prototype._handleDebuggerObjectDisplayLocationDidChange): (WI.SourcesNavigationSidebarPanel.prototype._compareBreakpointTreeElements): Deleted. * UserInterface/Models/ProbeSet.js: (WI.ProbeSet): (WI.ProbeSet.prototype.createProbe): (WI.ProbeSet.prototype.willRemove): * UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.prototype._processRecord): * UserInterface/Views/ProbeSetDetailsSection.js: (WI.ProbeSetDetailsSection): * UserInterface/Views/ProbeDetailsSidebarPanel.js: (WI.ProbeDetailsSidebarPanel.prototype.inspect): * UserInterface/Views/SourceCodeTextEditor.js: (WI.SourceCodeTextEditor): (WI.SourceCodeTextEditor.prototype.close): (WI.SourceCodeTextEditor.prototype.textEditorBreakpointAdded): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype.get supplementalRepresentedObjects): (WI.TextResourceContentView.prototype._probeSetsChanged): Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Views/ContentView.js: (WI.ContentView.createFromRepresentedObject): (WI.ContentView.resolvedRepresentedObjectForRepresentedObject): (WI.ContentView.isViewable): * UserInterface/Views/ContextMenuUtilities.js: (WI.appendContextMenuItemsForSourceCode): Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. * UserInterface/Views/DOMTreeContentView.js: (WI.DOMTreeContentView): Replace `WI.DOMBreakpoint` with `WI.Breakpoint`. * UserInterface/Views/EventListenerSectionGroup.js: (WI.EventListenerSectionGroup): * UserInterface/Views/EventListenerSectionGroup.css: (.event-listener-section > .content input[type="checkbox"] + .go-to-arrow): Added. (.event-listener-section > .content input[type="checkbox"]:not(:checked) + .go-to-arrow): Added. Add a go-to arrow next to the Breakpoint checkbox that reveals the `WI.EventBreakpoint` in the Sources Tab. * UserInterface/Views/BreakpointActionView.js: (WI.BreakpointActionView.prototype._appendActionButtonClicked): Drive-by: minor code cleanup. * UserInterface/Views/CallFrameTreeElement.js: (WI.CallFrameTreeElement.prototype.populateContextMenu): Drive-by: include source code location context menu items. * UserInterface/Base/Setting.js: * UserInterface/Main.html: * UserInterface/Test.html: LayoutTests: * inspector/dom-debugger/resources/event-breakpoint-utilities.js: (TestPage.registerInitializer.InspectorTest.EventBreakpoint.addBreakpointOptionsTestCases): Added. (TestPage.registerInitializer.InspectorTest.EventBreakpoint.async teardown): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.createBreakpoint): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.removeBreakpoint): * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/breakpoint-for-event-listener-expected.txt: * inspector/dom-debugger/event-animation-frame-breakpoints.html: * inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt: * inspector/dom-debugger/event-interval-breakpoints.html: * inspector/dom-debugger/event-interval-breakpoints-expected.txt: * inspector/dom-debugger/event-listener-breakpoints.html: * inspector/dom-debugger/event-listener-breakpoints-expected.txt: * inspector/dom-debugger/event-timeout-breakpoints.html: * inspector/dom-debugger/event-timeout-breakpoints-expected.txt: Add tests for new event breakpoint configuration options. * http/tests/inspector/debugger/debugger-test.js: (TestPage.registerInitializer.InspectorTest.startTracingBreakpoints): * http/tests/inspector/resources/probe-test.js: (TestPage.registerInitializer.ProtocolTest.Probe.installTracingListeners): * inspector/debugger/breakpoint-action-eval.html: * inspector/debugger/breakpoint-action-log.html: * inspector/debugger/breakpoint-columns.html: * inspector/debugger/breakpoint-scope.html: * inspector/debugger/debugger-stack-overflow.html: * inspector/debugger/pause-reason.html: * inspector/debugger/probe-manager-add-remove-actions.html: * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/debugger/tail-deleted-frames-this-value.html: * inspector/debugger/tail-recursion.html: * inspector/worker/debugger-pause.html: * inspector/worker/debugger-shared-breakpoint.html: Update existing breakpoint tests to use new model objects. Canonical link: https://commits.webkit.org/228551@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 17:34:12 +00:00
JSC::Debugger::runEventLoopWhilePaused();
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
TimerBase::fireTimersInNestedEventLoop();
Web Inspector: Include DebuggerAgent in Workers - see, pause, and step through scripts https://bugs.webkit.org/show_bug.cgi?id=164136 <rdar://problem/29028462> Reviewed by Brian Burg. Source/WebCore: Tests: inspector/worker/debugger-pause.html inspector/worker/debugger-scripts.html * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: New file. * inspector/PageDebuggerAgent.h: * inspector/WorkerDebuggerAgent.cpp: Added. (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent): (WebCore::WorkerDebuggerAgent::~WorkerDebuggerAgent): (WebCore::WorkerDebuggerAgent::breakpointActionLog): (WebCore::WorkerDebuggerAgent::injectedScriptForEval): * inspector/WorkerDebuggerAgent.h: Added. DebuggerAgent customizations for Workers. * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): Add the new agent. * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): Implement the nested run loop for Workers. Source/WebInspectorUI: By implementing DebuggerAgent, Workers will inform the frontend about Scripts that evaluate in the Worker's VM and the Worker VM can pause and send the pausing CallFrames to the frontend. This means that WebInspector.Script and WebInspector.CallFrame will need to be made target aware. This also means that each Target will have its own set of debugger data, such as the list of scripts and pause data like the pause reason / call frames. Previously all this data was managed by DebuggerManager. With this change we split that data out of DebuggerManager to be per-target DebuggerData. DebuggerManager keeps `activeCallFrame` but the list of scripts and pause data have moved into `DebuggerData` which is per-target, accessed through DebuggerManager's new dataForTarget(target) method. Finally we make a few changes to the UserInterface to make Workers and their scripts, appear grouped together. The Resources sidebar previously had a single top level item for the Main Frame, which has all its resources as its children (potentially grouped into folders). With this change, each Worker gets its own top level item as well, and the Worker's subresources (imported scripts) become its children. We also now associate a single mainResource with Targets. In the case of Workers, we assume and assert that this is a Script. If this were to ever change we would need to adjust the assumptions. * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: * UserInterface/Test/Test.js: Add WebInspector.assumingMainTarget to fill in all the places where we assume the main target right now, but would need to handle non-main targets as other agents are implemented in workers. For example profile data that assumes the main target right now could be worker targets when we implement ScriptProfiler / Heap agents. * UserInterface/Protocol/Connection.js: (InspectorBackend.WorkerConnection): * UserInterface/Protocol/Target.js: (WebInspector.Target): (WebInspector.Target.prototype.get DebuggerAgent): (WebInspector.Target.prototype.get mainResource): (WebInspector.Target.prototype.set mainResource): (WebInspector.WorkerTarget.prototype.initialize): (WebInspector.WorkerTarget): Include DebuggerAgent in Targets. Include a mainResource for Worker Targets. * UserInterface/Protocol/DebuggerObserver.js: (WebInspector.DebuggerObserver.prototype.scriptParsed): (WebInspector.DebuggerObserver.prototype.breakpointResolved): (WebInspector.DebuggerObserver.prototype.paused): (WebInspector.DebuggerObserver.prototype.resumed): Pass the target on to managers when necessary. * UserInterface/Models/DebuggerData.js: Added. (WebInspector.DebuggerData): (WebInspector.DebuggerData.prototype.get target): (WebInspector.DebuggerData.prototype.get callFrames): (WebInspector.DebuggerData.prototype.get pauseReason): (WebInspector.DebuggerData.prototype.get pauseData): (WebInspector.DebuggerData.prototype.get scripts): (WebInspector.DebuggerData.prototype.scriptForIdentifier): (WebInspector.DebuggerData.prototype.scriptsForURL): (WebInspector.DebuggerData.prototype.reset): (WebInspector.DebuggerData.prototype.addScript): (WebInspector.DebuggerData.prototype.pause): (WebInspector.DebuggerData.prototype.unpause): Extract per-target data from DebuggerManager. This includes the list of scripts evaluated in a Target, and any pause data for this target such as the pause reason and call frames. * UserInterface/Controllers/DebuggerManager.js: (WebInspector.DebuggerManager.prototype.dataForTarget): (WebInspector.DebuggerManager.prototype.get pauseReason): Deleted. (WebInspector.DebuggerManager.prototype.get pauseData): Deleted. (WebInspector.DebuggerManager.prototype.get callFrames): Deleted. (WebInspector.DebuggerManager.prototype.reset): New way to access per-target debugger data. (WebInspector.DebuggerManager.prototype.initializeTarget): When a new Target is created, synchronize frontend state with the target. Things like the list of breakpoints and global breakpoint states. (WebInspector.DebuggerManager.prototype.scriptForIdentifier): (WebInspector.DebuggerManager.prototype.scriptsForURL): Convenience accessors for scripts must now provide a Target. (WebInspector.DebuggerManager.prototype.get knownNonResourceScripts): This is a convenience accessors for a list of all scripts across all targets so this handles getting the list across all targets. (WebInspector.DebuggerManager.prototype.pause): (WebInspector.DebuggerManager.prototype.resume): (WebInspector.DebuggerManager.prototype.stepOver): (WebInspector.DebuggerManager.prototype.stepInto): (WebInspector.DebuggerManager.prototype.stepOut): (WebInspector.DebuggerManager.prototype.continueToLocation): Stepping commands affect the current target with the active call frame. Eventually we will change Pause and Resume behavior to affect all targets. (WebInspector.DebuggerManager.prototype.addBreakpoint): (WebInspector.DebuggerManager.prototype.breakpointResolved): (WebInspector.DebuggerManager.prototype._setBreakpoint.didSetBreakpoint): (WebInspector.DebuggerManager.prototype._setBreakpoint): (WebInspector.DebuggerManager.prototype._removeBreakpoint): Breakpoints should be set on all targets, but we need a way to set them on a specific target, when initializing an individual target when we want to inform that single target of all of the breakpoints. (WebInspector.DebuggerManager.prototype._breakpointDisabledStateDidChange): (WebInspector.DebuggerManager.prototype._updateBreakOnExceptionsState): Changing global breakpoint state should inform all targets. (WebInspector.DebuggerManager.prototype.scriptDidParse): Associate Scripts with a Target. Identify the main resource of a Worker Target and set it as soon as we can. (WebInspector.DebuggerManager.prototype.debuggerDidPause): (WebInspector.DebuggerManager.prototype.debuggerDidResume): (WebInspector.DebuggerManager.prototype._sourceCodeLocationFromPayload): (WebInspector.DebuggerManager.prototype._scopeChainFromPayload): (WebInspector.DebuggerManager.prototype._scopeChainNodeFromPayload): (WebInspector.DebuggerManager.prototype._mainResourceDidChange): (WebInspector.DebuggerManager.prototype._didResumeInternal): Pausing and resuming now happens per-target, so associate created model objects (CallFrame, ScopeChain objects) and any other necessary data with the target. * UserInterface/Models/Breakpoint.js: (WebInspector.Breakpoint): (WebInspector.Breakpoint.prototype.get target): (WebInspector.Breakpoint.prototype.get info): * UserInterface/Models/CallFrame.js: (WebInspector.CallFrame): (WebInspector.CallFrame.prototype.get target): (WebInspector.CallFrame.fromDebuggerPayload): (WebInspector.CallFrame.fromPayload): * UserInterface/Models/ConsoleMessage.js: (WebInspector.ConsoleMessage): * UserInterface/Models/Script.js: (WebInspector.Script): (WebInspector.Script.prototype.get target): (WebInspector.Script.prototype.isMainResource): (WebInspector.Script.prototype.requestContentFromBackend): (WebInspector.Script.prototype._resolveResource): * UserInterface/Models/StackTrace.js: (WebInspector.StackTrace.fromPayload): (WebInspector.StackTrace.fromString): * UserInterface/Models/ProbeManager.js: (WebInspector.ProbeManager.prototype.didSampleProbe): * UserInterface/Models/Probe.js: (WebInspector.ProbeSample): * UserInterface/Views/ConsoleMessageView.js: (WebInspector.ConsoleMessageView.prototype._appendLocationLink): (WebInspector.ConsoleMessageView.prototype._formatParameterAsString): Associate model objects with a specific target where necessary. * UserInterface/Views/ObjectTreeBaseTreeElement.js: (WebInspector.ObjectTreeBaseTreeElement.prototype._appendMenusItemsForObject): * UserInterface/Controllers/RuntimeManager.js: (WebInspector.RuntimeManager.prototype.evaluateInInspectedWindow): * UserInterface/Protocol/RemoteObject.js: (WebInspector.RemoteObject.prototype.findFunctionSourceCodeLocation): Use target specific DebuggerAgent where necessary. * UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js: * UserInterface/Controllers/TimelineManager.js: (WebInspector.TimelineManager.prototype._callFramesFromPayload): * UserInterface/Models/ScriptTimelineRecord.js: (WebInspector.ScriptTimelineRecord.prototype._initializeProfileFromPayload.profileNodeFromPayload): * UserInterface/Views/EventListenerSectionGroup.js: (WebInspector.EventListenerSectionGroup.prototype._functionTextOrLink): (WebInspector.EventListenerSectionGroup): * UserInterface/Views/HeapSnapshotInstanceDataGridNode.js: (WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode.node.shortestGCRootPath.): (WebInspector.HeapSnapshotInstanceDataGridNode.logHeapSnapshotNode): (WebInspector.HeapSnapshotInstanceDataGridNode.prototype._populateWindowPreview): (WebInspector.HeapSnapshotInstanceDataGridNode.prototype._populatePreview): (WebInspector.HeapSnapshotInstanceDataGridNode.prototype._mouseoverHandler.appendPathRow): * UserInterface/Views/ProfileDataGridNode.js: (WebInspector.ProfileDataGridNode.prototype.iconClassName): (WebInspector.ProfileDataGridNode.prototype.filterableDataForColumn): (WebInspector.ProfileDataGridNode.prototype._displayContent): Use assumed main target and audit these when the Worker gets more Agents. * UserInterface/Controllers/FrameResourceManager.js: (WebInspector.FrameResourceManager.prototype._initiatorSourceCodeLocationFromPayload): This will always be the main target because only the main target has access to the DOM. * UserInterface/Views/SourceCodeTextEditor.js: (WebInspector.SourceCodeTextEditor.prototype.get target): (WebInspector.SourceCodeTextEditor.prototype.customPerformSearch): (WebInspector.SourceCodeTextEditor.prototype.textEditorGutterContextMenu): (WebInspector.SourceCodeTextEditor.prototype._tokenTrackingControllerHighlightedJavaScriptExpression.populate): (WebInspector.SourceCodeTextEditor.prototype._tokenTrackingControllerHighlightedJavaScriptExpression): (WebInspector.SourceCodeTextEditor.prototype._showPopoverForFunction.didGetDetails): (WebInspector.SourceCodeTextEditor.prototype._showPopoverForFunction): Update target specific actions to use the proper target's agents. * UserInterface/Views/TargetTreeElement.js: Added. (WebInspector.TargetTreeElement): (WebInspector.TargetTreeElement.prototype.get target): (WebInspector.TargetTreeElement.prototype.onexpand): (WebInspector.TargetTreeElement.prototype.oncollapse): Add a new tree element for a Target. We currently assume that the main resource for a Target will be a Script right now, as is the case for Web Workers. This simply remembers its expanded or collapsed state and has a better icon. * UserInterface/Views/ResourceIcons.css: (body:matches(.mac-platform, .windows-platform) .script.worker-icon .icon): (body:matches(.mac-platform, .windows-platform) .large .script.worker-icon .icon): * UserInterface/Images/WorkerScript.png: Renamed from Source/WebInspectorUI/UserInterface/Images/WorkerDocument.png. * UserInterface/Images/WorkerScript@2x.png: Renamed from Source/WebInspectorUI/UserInterface/Images/WorkerDocument@2x.png. * UserInterface/Images/WorkerScriptLarge.png: Renamed from Source/WebInspectorUI/UserInterface/Images/WorkerDocumentLarge.png. * UserInterface/Images/WorkerScriptLarge@2x.png: Renamed from Source/WebInspectorUI/UserInterface/Images/WorkerDocumentLarge@2x.png. Improve icon for a Worker's main resource script. * UserInterface/Views/ResourceSidebarPanel.js: (WebInspector.ResourceSidebarPanel): (WebInspector.ResourceSidebarPanel.prototype._scriptWasAdded): (WebInspector.ResourceSidebarPanel.prototype._scriptsCleared): (WebInspector.ResourceSidebarPanel.prototype._addScriptForNonMainTarget): (WebInspector.ResourceSidebarPanel.prototype._addTargetWithMainResource): (WebInspector.ResourceSidebarPanel.prototype._targetRemoved): * UserInterface/Views/SearchSidebarPanel.js: (WebInspector.SearchSidebarPanel.prototype.performSearch.searchScripts): (WebInspector.SearchSidebarPanel.prototype._searchTreeElementForScript): * UserInterface/Views/OpenResourceDialog.js: (WebInspector.OpenResourceDialog.prototype._populateResourceTreeOutline.createTreeElement): (WebInspector.OpenResourceDialog.prototype._populateResourceTreeOutline): (WebInspector.OpenResourceDialog.prototype.didDismissDialog): (WebInspector.OpenResourceDialog.prototype.didPresentDialog): (WebInspector.OpenResourceDialog.prototype._addResourcesForFrame): (WebInspector.OpenResourceDialog.prototype._addScriptsForTarget): (WebInspector.OpenResourceDialog.prototype._scriptAdded): (WebInspector.OpenResourceDialog): * UserInterface/Views/DebuggerSidebarPanel.js: (WebInspector.DebuggerSidebarPanel.prototype._addTreeElementForSourceCodeToTreeOutline): (WebInspector.DebuggerSidebarPanel.prototype._debuggerCallFramesDidChange): (WebInspector.DebuggerSidebarPanel.prototype._debuggerActiveCallFrameDidChange): (WebInspector.DebuggerSidebarPanel.prototype._updatePauseReasonSection): Include scripts from non-main targets in sidebars. LayoutTests: * inspector/worker/debugger-pause-expected.txt: Added. * inspector/worker/debugger-pause.html: Added. * inspector/worker/debugger-scripts-expected.txt: Added. * inspector/worker/debugger-scripts.html: Added. * inspector/worker/resources/worker-debugger-pause.js: Added. * inspector/worker/resources/worker-import-1.js: Added. * inspector/worker/resources/worker-scripts.js: Added. New tests for Debugger features in a Worker. * inspector/debugger/break-on-exception-throw-in-promise.html: * inspector/debugger/break-on-exception.html: * inspector/debugger/break-on-uncaught-exception.html: * inspector/debugger/evaluateOnCallFrame-CommandLineAPI.html: * inspector/debugger/pause-reason.html: * inspector/debugger/paused-scopes.html: * inspector/debugger/resources/log-pause-location.js: * inspector/debugger/stepping/stepInto.html: * inspector/debugger/stepping/stepOut.html: * inspector/debugger/stepping/stepOver.html: * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/debugger/tail-deleted-frames-from-vm-entry.html: * inspector/debugger/tail-deleted-frames-this-value.html: * inspector/debugger/tail-deleted-frames.html: * inspector/debugger/tail-recursion.html: Most debugger data moved from DebuggerManager into DebuggerData for a target. Update tests that access such data like pauseReason / pauseData / callFrames. Canonical link: https://commits.webkit.org/182063@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-11-02 21:51:36 +00:00
MessageQueueWaitResult result;
do {
Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope https://bugs.webkit.org/show_bug.cgi?id=218108 Reviewed by Darin Adler and Devin Rousso. Use WorkerOrWorkletGlobalScope in WebInspector code instead of WorkerGlobalScope, in preparation for Worklets support. This will allow us to reuse this code when we add Web Inspector support for Worklets. No new tests, no behavior change yet. * Modules/webaudio/AudioWorkletThread.cpp: (WebCore::AudioWorkletThread::workerDebuggerProxy const): * Modules/webaudio/AudioWorkletThread.h: * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::instrumentingAgentsForWebGPUDevice): (WebCore::InspectorInstrumentation::consoleAgentEnabled): (WebCore::InspectorInstrumentation::timelineAgentTracking): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didClearWindowObjectInWorld): (WebCore::InspectorInstrumentation::isDebuggerPaused): (WebCore::InspectorInstrumentation::identifierForNode): (WebCore::InspectorInstrumentation::addEventListenersToNode): (WebCore::InspectorInstrumentation::willInsertDOMNode): (WebCore::InspectorInstrumentation::didInsertDOMNode): (WebCore::InspectorInstrumentation::willRemoveDOMNode): (WebCore::InspectorInstrumentation::didRemoveDOMNode): (WebCore::InspectorInstrumentation::willModifyDOMAttr): (WebCore::InspectorInstrumentation::didModifyDOMAttr): (WebCore::InspectorInstrumentation::didRemoveDOMAttr): (WebCore::InspectorInstrumentation::willInvalidateStyleAttr): (WebCore::InspectorInstrumentation::didInvalidateStyleAttr): (WebCore::InspectorInstrumentation::documentDetached): (WebCore::InspectorInstrumentation::frameWindowDiscarded): (WebCore::InspectorInstrumentation::mediaQueryResultChanged): (WebCore::InspectorInstrumentation::activeStyleSheetsUpdated): (WebCore::InspectorInstrumentation::didPushShadowRoot): (WebCore::InspectorInstrumentation::willPopShadowRoot): (WebCore::InspectorInstrumentation::didChangeCustomElementState): (WebCore::InspectorInstrumentation::pseudoElementCreated): (WebCore::InspectorInstrumentation::pseudoElementDestroyed): (WebCore::InspectorInstrumentation::didCreateNamedFlow): (WebCore::InspectorInstrumentation::willRemoveNamedFlow): (WebCore::InspectorInstrumentation::didChangeRegionOverset): (WebCore::InspectorInstrumentation::didRegisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::didUnregisterNamedFlowContentElement): (WebCore::InspectorInstrumentation::mouseDidMoveOverElement): (WebCore::InspectorInstrumentation::handleTouchEvent): (WebCore::InspectorInstrumentation::handleMousePress): (WebCore::InspectorInstrumentation::forcePseudoState): (WebCore::InspectorInstrumentation::characterDataModified): (WebCore::InspectorInstrumentation::willSendXMLHttpRequest): (WebCore::InspectorInstrumentation::willFetch): (WebCore::InspectorInstrumentation::didInstallTimer): (WebCore::InspectorInstrumentation::didRemoveTimer): (WebCore::InspectorInstrumentation::didAddEventListener): (WebCore::InspectorInstrumentation::willRemoveEventListener): (WebCore::InspectorInstrumentation::isEventListenerDisabled): (WebCore::InspectorInstrumentation::willPostMessage): (WebCore::InspectorInstrumentation::didPostMessage): (WebCore::InspectorInstrumentation::didFailPostMessage): (WebCore::InspectorInstrumentation::willDispatchPostMessage): (WebCore::InspectorInstrumentation::didDispatchPostMessage): (WebCore::InspectorInstrumentation::willCallFunction): (WebCore::InspectorInstrumentation::didCallFunction): (WebCore::InspectorInstrumentation::willDispatchEvent): (WebCore::InspectorInstrumentation::didDispatchEvent): (WebCore::InspectorInstrumentation::willHandleEvent): (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::willDispatchEventOnWindow): (WebCore::InspectorInstrumentation::didDispatchEventOnWindow): (WebCore::InspectorInstrumentation::eventDidResetAfterDispatch): (WebCore::InspectorInstrumentation::willEvaluateScript): (WebCore::InspectorInstrumentation::didEvaluateScript): (WebCore::InspectorInstrumentation::willFireTimer): (WebCore::InspectorInstrumentation::didFireTimer): (WebCore::InspectorInstrumentation::didInvalidateLayout): (WebCore::InspectorInstrumentation::willLayout): (WebCore::InspectorInstrumentation::didLayout): (WebCore::InspectorInstrumentation::didScroll): (WebCore::InspectorInstrumentation::willComposite): (WebCore::InspectorInstrumentation::didComposite): (WebCore::InspectorInstrumentation::willPaint): (WebCore::InspectorInstrumentation::didPaint): (WebCore::InspectorInstrumentation::willRecalculateStyle): (WebCore::InspectorInstrumentation::didRecalculateStyle): (WebCore::InspectorInstrumentation::didScheduleStyleRecalculation): (WebCore::InspectorInstrumentation::applyUserAgentOverride): (WebCore::InspectorInstrumentation::applyEmulatedMedia): (WebCore::InspectorInstrumentation::willSendRequest): (WebCore::InspectorInstrumentation::willSendRequestOfType): (WebCore::InspectorInstrumentation::didLoadResourceFromMemoryCache): (WebCore::InspectorInstrumentation::didReceiveResourceResponse): (WebCore::InspectorInstrumentation::didReceiveThreadableLoaderResponse): (WebCore::InspectorInstrumentation::didReceiveData): (WebCore::InspectorInstrumentation::didFinishLoading): (WebCore::InspectorInstrumentation::didFailLoading): (WebCore::InspectorInstrumentation::continueAfterXFrameOptionsDenied): (WebCore::InspectorInstrumentation::continueWithPolicyDownload): (WebCore::InspectorInstrumentation::continueWithPolicyIgnore): (WebCore::InspectorInstrumentation::willLoadXHRSynchronously): (WebCore::InspectorInstrumentation::didLoadXHRSynchronously): (WebCore::InspectorInstrumentation::scriptImported): (WebCore::InspectorInstrumentation::scriptExecutionBlockedByCSP): (WebCore::InspectorInstrumentation::didReceiveScriptResponse): (WebCore::InspectorInstrumentation::domContentLoadedEventFired): (WebCore::InspectorInstrumentation::loadEventFired): (WebCore::InspectorInstrumentation::frameDetachedFromParent): (WebCore::InspectorInstrumentation::didCommitLoad): (WebCore::InspectorInstrumentation::frameDocumentUpdated): (WebCore::InspectorInstrumentation::loaderDetachedFromFrame): (WebCore::InspectorInstrumentation::frameStartedLoading): (WebCore::InspectorInstrumentation::frameStoppedLoading): (WebCore::InspectorInstrumentation::frameScheduledNavigation): (WebCore::InspectorInstrumentation::frameClearedScheduledNavigation): (WebCore::InspectorInstrumentation::defaultAppearanceDidChange): (WebCore::InspectorInstrumentation::willIntercept): (WebCore::InspectorInstrumentation::shouldInterceptRequest): (WebCore::InspectorInstrumentation::shouldInterceptResponse): (WebCore::InspectorInstrumentation::interceptRequest): (WebCore::InspectorInstrumentation::interceptResponse): (WebCore::InspectorInstrumentation::didOpenDatabase): (WebCore::InspectorInstrumentation::didDispatchDOMStorageEvent): (WebCore::InspectorInstrumentation::shouldWaitForDebuggerOnStart): (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::didCreateWebSocket): (WebCore::InspectorInstrumentation::willSendWebSocketHandshakeRequest): (WebCore::InspectorInstrumentation::didReceiveWebSocketHandshakeResponse): (WebCore::InspectorInstrumentation::didCloseWebSocket): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrame): (WebCore::InspectorInstrumentation::didReceiveWebSocketFrameError): (WebCore::InspectorInstrumentation::didSendWebSocketFrame): (WebCore::InspectorInstrumentation::didHandleMemoryPressure): (WebCore::InspectorInstrumentation::didChangeCSSCanvasClientNodes): (WebCore::InspectorInstrumentation::didCreateCanvasRenderingContext): (WebCore::InspectorInstrumentation::didChangeCanvasMemory): (WebCore::InspectorInstrumentation::recordCanvasAction): (WebCore::InspectorInstrumentation::didFinishRecordingCanvasFrame): (WebCore::InspectorInstrumentation::didEnableExtension): (WebCore::InspectorInstrumentation::didCreateWebGLProgram): (WebCore::InspectorInstrumentation::willDestroyWebGLProgram): (WebCore::InspectorInstrumentation::isWebGLProgramDisabled): (WebCore::InspectorInstrumentation::isWebGLProgramHighlighted): (WebCore::InspectorInstrumentation::willConfigureSwapChain): (WebCore::InspectorInstrumentation::willDestroyWebGPUPipeline): (WebCore::InspectorInstrumentation::willApplyKeyframeEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationName): (WebCore::InspectorInstrumentation::didSetWebAnimationEffect): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTiming): (WebCore::InspectorInstrumentation::didChangeWebAnimationEffectTarget): (WebCore::InspectorInstrumentation::didCreateWebAnimation): (WebCore::InspectorInstrumentation::willDestroyWebAnimation): (WebCore::InspectorInstrumentation::networkStateChanged): (WebCore::InspectorInstrumentation::updateApplicationCacheStatus): (WebCore::InspectorInstrumentation::addMessageToConsole): (WebCore::InspectorInstrumentation::consoleCount): (WebCore::InspectorInstrumentation::consoleCountReset): (WebCore::InspectorInstrumentation::takeHeapSnapshot): (WebCore::InspectorInstrumentation::startConsoleTiming): (WebCore::InspectorInstrumentation::logConsoleTiming): (WebCore::InspectorInstrumentation::stopConsoleTiming): (WebCore::InspectorInstrumentation::consoleTimeStamp): (WebCore::InspectorInstrumentation::startProfiling): (WebCore::InspectorInstrumentation::stopProfiling): (WebCore::InspectorInstrumentation::consoleStartRecordingCanvas): (WebCore::InspectorInstrumentation::consoleStopRecordingCanvas): (WebCore::InspectorInstrumentation::didRequestAnimationFrame): (WebCore::InspectorInstrumentation::didCancelAnimationFrame): (WebCore::InspectorInstrumentation::willFireAnimationFrame): (WebCore::InspectorInstrumentation::didFireAnimationFrame): (WebCore::InspectorInstrumentation::willFireObserverCallback): (WebCore::InspectorInstrumentation::didFireObserverCallback): (WebCore::InspectorInstrumentation::layerTreeDidChange): (WebCore::InspectorInstrumentation::renderLayerDestroyed): (WebCore::InspectorInstrumentation::instrumentingAgentsFor): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForFrame): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForDocument): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForPage): Deleted. (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): Deleted. * inspector/InspectorWebAgentBase.h: (WebCore::WorkerAgentContext::WorkerAgentContext): * inspector/WorkerDebugger.cpp: (WebCore::WorkerDebugger::WorkerDebugger): (WebCore::WorkerDebugger::attachDebugger): (WebCore::WorkerDebugger::detachDebugger): (WebCore::WorkerDebugger::runEventLoopWhilePaused): * inspector/WorkerDebugger.h: * inspector/WorkerInspectorController.cpp: (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::workerAgentContext): (WebCore::WorkerInspectorController::createLazyAgents): (WebCore::WorkerInspectorController::vm): * inspector/WorkerInspectorController.h: * inspector/WorkerToPageFrontendChannel.h: * inspector/agents/worker/ServiceWorkerAgent.cpp: (WebCore::ServiceWorkerAgent::ServiceWorkerAgent): * inspector/agents/worker/WorkerAuditAgent.cpp: (WebCore::WorkerAuditAgent::WorkerAuditAgent): (WebCore::WorkerAuditAgent::injectedScriptForEval): * inspector/agents/worker/WorkerAuditAgent.h: * inspector/agents/worker/WorkerConsoleAgent.cpp: (WebCore::WorkerConsoleAgent::WorkerConsoleAgent): * inspector/agents/worker/WorkerDebuggerAgent.cpp: (WebCore::WorkerDebuggerAgent::WorkerDebuggerAgent): (WebCore::WorkerDebuggerAgent::breakpointActionLog): (WebCore::WorkerDebuggerAgent::injectedScriptForEval): * inspector/agents/worker/WorkerDebuggerAgent.h: * inspector/agents/worker/WorkerNetworkAgent.cpp: (WebCore::WorkerNetworkAgent::WorkerNetworkAgent): (WebCore::WorkerNetworkAgent::setResourceCachingDisabledInternal): (WebCore::WorkerNetworkAgent::scriptExecutionContext): * inspector/agents/worker/WorkerNetworkAgent.h: * inspector/agents/worker/WorkerRuntimeAgent.cpp: (WebCore::WorkerRuntimeAgent::WorkerRuntimeAgent): (WebCore::WorkerRuntimeAgent::injectedScriptForEval): * inspector/agents/worker/WorkerRuntimeAgent.h: * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): (WebCore::WorkerGlobalScope::prepareForDestruction): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController const): Deleted. * workers/WorkerOrWorkletGlobalScope.cpp: (WebCore::WorkerOrWorkletGlobalScope::WorkerOrWorkletGlobalScope): (WebCore::WorkerOrWorkletGlobalScope::prepareForDestruction): * workers/WorkerOrWorkletGlobalScope.h: (WebCore::WorkerOrWorkletGlobalScope::inspectorController const): * workers/WorkerOrWorkletThread.h: * workers/WorkerThread.h: (WebCore::WorkerThread::workerDebuggerProxy const): Deleted. Canonical link: https://commits.webkit.org/230818@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268900 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-23 01:00:04 +00:00
result = m_globalScope.workerOrWorkletThread()->runLoop().runInDebuggerMode(m_globalScope);
Web Inspector: allow event breakpoints to be configured https://bugs.webkit.org/show_bug.cgi?id=215362 <rdar://problem/66932921> Reviewed by Brian Burg. Source/JavaScriptCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * inspector/protocol/DOM.json: Add an `options` paramater to `DOM.setBreakpointForEventListener` to allow configuration. * inspector/protocol/DOMDebugger.json: Add an `options` paramater to `DOMDebugger.setEventBreakpoint` to allow configuration. * debugger/Breakpoint.h: (JSC::Breakpoint::id const): Added. (JSC::Breakpoint::sourceID const): Added. (JSC::Breakpoint::lineNumber const): Added. (JSC::Breakpoint::columnNumber const): Added. (JSC::Breakpoint::condition const): Added. (JSC::Breakpoint::actions const): Added. (JSC::Breakpoint::isAutoContinue const): Added. (JSC::Breakpoint::resetHitCount): Added. (JSC::Breakpoint::isLinked const): Added. (JSC::Breakpoint::isResolved const): Added. (JSC::BreakpointsList::~BreakpointsList): Deleted. * debugger/Breakpoint.cpp: Added. (JSC::Breakpoint::Action::Action): Added. (JSC::Breakpoint::create): Added. (JSC::Breakpoint::Breakpoint): Added. (JSC::Breakpoint::link): Added. (JSC::Breakpoint::resolve): Added. (JSC::Breakpoint::shouldPause): Added. Unify `JSC::Breakpoint` and `Inspector::ScriptBreakpoint`. * debugger/DebuggerPrimitives.h: * debugger/Debugger.h: * debugger/Debugger.cpp: (JSC::Debugger::Debugger): (JSC::Debugger::addObserver): Added. (JSC::Debugger::removeObserver): Added. (JSC::Debugger::canDispatchFunctionToObservers const): Added. (JSC::Debugger::dispatchFunctionToObservers): Added. (JSC::Debugger::sourceParsed): Added. (JSC::Debugger::toggleBreakpoint): (JSC::Debugger::applyBreakpoints): (JSC::Debugger::resolveBreakpoint): (JSC::Debugger::setBreakpoint): (JSC::Debugger::removeBreakpoint): (JSC::Debugger::didHitBreakpoint): Added. (JSC::Debugger::clearBreakpoints): (JSC::Debugger::evaluateBreakpointCondition): Added. (JSC::Debugger::evaluateBreakpointActions): Added. (JSC::Debugger::schedulePauseAtNextOpportunity): Added. (JSC::Debugger::cancelPauseAtNextOpportunity): Added. (JSC::Debugger::schedulePauseForSpecialBreakpoint): Added. (JSC::Debugger::cancelPauseForSpecialBreakpoint): Added. (JSC::Debugger::continueProgram): (JSC::Debugger::stepNextExpression): (JSC::Debugger::stepIntoStatement): (JSC::Debugger::stepOverStatement): (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::pauseIfNeeded): (JSC::Debugger::handlePause): Added. (JSC::Debugger::exceptionOrCaughtValue): Added. (JSC::Debugger::atExpression): (JSC::Debugger::clearNextPauseState): (JSC::Debugger::willRunMicrotask): Added. (JSC::Debugger::didRunMicrotask): Added. (JSC::Debugger::hasBreakpoint): Deleted. (JSC::Debugger::setPauseOnNextStatement): Deleted. Unify `JSC::Debugger` and `Inspector::ScriptDebugServer` to simplify breakpoint logic. Introduce the concept of a "special breakpoint", which is essentially a `JSC::Breakpoint` that is expected to pause at the next opportunity but isn't tied to a particular location. As an example, whenever an event breakpoint is hit, instead of just pausing at the next opportunity, the newly managed `JSC::Breakpoint` is used as a "special breakpoint", allowing for it's configuration (ie.g. condition, ignore count, actions, auto-continue) to be used. * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::objectGroupForBreakpointAction): (Inspector::breakpointActionTypeForString): Added. (Inspector::parseBreakpointOptions): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::fromPayload): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::ProtocolBreakpoint): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::createDebuggerBreakpoint const): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::matchesScriptURL const): Added. (Inspector::InspectorDebuggerAgent::debuggerBreakpointFromPayload): Added. (Inspector::InspectorDebuggerAgent::enable): (Inspector::InspectorDebuggerAgent::disable): (Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason): (Inspector::InspectorDebuggerAgent::handleConsoleAssert): (Inspector::InspectorDebuggerAgent::didScheduleAsyncCall): (Inspector::buildDebuggerLocation): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::didSetBreakpoint): (Inspector::InspectorDebuggerAgent::resolveBreakpoint): (Inspector::InspectorDebuggerAgent::removeBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::schedulePauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::cancelPauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::schedulePauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::cancelPauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::pause): (Inspector::InspectorDebuggerAgent::resume): (Inspector::InspectorDebuggerAgent::didBecomeIdle): (Inspector::InspectorDebuggerAgent::sourceMapURLForScript): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::willRunMicrotask): (Inspector::InspectorDebuggerAgent::didRunMicrotask): (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionSound): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::clearInspectorBreakpointState): (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): (Inspector::matches): Deleted. (Inspector::buildObjectForBreakpointCookie): Deleted. (Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol): Deleted. (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): Deleted. (Inspector::InspectorDebuggerAgent::cancelPauseOnNextStatement): Deleted. Create a private `ProtocolBreakpoint` class that holds the data sent by the frontend. This is necessary because breakpoints in the frontend have a potentially one-to-many relationship with breakpoints in the backend, as the same script can be loaded many times on a page. Each of those scripts is independent, however, and can execute differently, meaning that the same breakpoint for each script also needs a different state (e.g. ignore count). As such, the `ProtocolBreakpoint` is effectively a template that is actualized whenever a new script is parsed that matches the URL of the `ProtocolBreakpoint` to create a `JSC::Breakpoint` that is used by the `JSC::Debugger`. `ProtocolBreakpoint` also parses breakpoint configurations. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectScriptDebugServer.h: * inspector/JSGlobalObjectScriptDebugServer.cpp: (Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer): (Inspector::JSGlobalObjectScriptDebugServer::attachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::detachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused): * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: (Inspector::InspectorAuditAgent::run): * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::setPauseOnExceptionsState): (Inspector::InspectorRuntimeAgent::evaluate): (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::getPreview): (Inspector::InspectorRuntimeAgent::getProperties): (Inspector::InspectorRuntimeAgent::getDisplayableProperties): * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.h: Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * runtime/JSMicrotask.cpp: (JSC::JSMicrotask::run): Drive-by: r248894 mistakenly omitted the call to notify the debugger that the microtask ran. * inspector/ScriptBreakpoint.h: Removed. * inspector/ScriptDebugListener.h: Removed. * inspector/ScriptDebugServer.h: Removed. * inspector/ScriptDebugServer.cpp: Removed. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: Source/WebCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing Tests: inspector/dom/breakpoint-for-event-listener.html inspector/dom-debugger/event-animation-frame-breakpoints.html inspector/dom-debugger/event-interval-breakpoints.html inspector/dom-debugger/event-listener-breakpoints.html inspector/dom-debugger/event-timeout-breakpoints.html * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::getEventListenersForNode): (WebCore::InspectorDOMAgent::setBreakpointForEventListener): (WebCore::InspectorDOMAgent::removeBreakpointForEventListener): (WebCore::InspectorDOMAgent::buildObjectForEventListener): (WebCore::InspectorDOMAgent::breakpointForEventListener): (WebCore::InspectorDOMAgent::hasBreakpointForEventListener): Deleted. * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::disable): (WebCore::InspectorDOMDebuggerAgent::mainFrameNavigated): (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::willHandleEvent): (WebCore::InspectorDOMDebuggerAgent::didHandleEvent): (WebCore::InspectorDOMDebuggerAgent::willFireTimer): (WebCore::InspectorDOMDebuggerAgent::didFireTimer): * inspector/agents/page/PageDOMDebuggerAgent.h: * inspector/agents/page/PageDOMDebuggerAgent.cpp: (WebCore::PageDOMDebuggerAgent::disable): (WebCore::PageDOMDebuggerAgent::mainFrameNavigated): (WebCore::PageDOMDebuggerAgent::willFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::didFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::setAnimationFrameBreakpoint): * inspector/agents/worker/WorkerDOMDebuggerAgent.h: * inspector/agents/worker/WorkerDOMDebuggerAgent.cpp: (WebCore::WorkerDOMDebuggerAgent::setAnimationFrameBreakpoint): Keep a `JSC::Breakpoint` for each event breakpoint instead of a simple `bool`, allowing for configuration when the breakpoint is first set. When any of these breakpoints are hit, pass it to the `JSC::Debugger` as a "special breakpoint", which behaves the same as "pause ASAP" but also supports a condition, an ignore count, actions, and auto-continue. Reset the hit count for any of these "special breakpoints" that persist across Web Inspector sessions when the main frame navigates. * inspector/PageScriptDebugServer.h: * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::PageScriptDebugServer): (WebCore::PageScriptDebugServer::attachDebugger): (WebCore::PageScriptDebugServer::detachDebugger): (WebCore::PageScriptDebugServer::didPause): (WebCore::PageScriptDebugServer::didContinue): (WebCore::PageScriptDebugServer::runEventLoopWhilePaused): (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal): (WebCore::PageScriptDebugServer::isContentScript const): (WebCore::PageScriptDebugServer::reportException const): * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException const): * inspector/agents/page/PageDebuggerAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: (WebCore::PageDebuggerAgent::sourceMapURLForScript): Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * inspector/TimelineRecordFactory.h: * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createProbeSampleData): * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::breakpointActionProbe): Replace `Inspector::ScriptBreakpoint` with `JSC::Breakpoint`. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::didFireTimer): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didHandleEventImpl): (WebCore::InspectorInstrumentation::didFireTimerImpl): (WebCore::InspectorInstrumentation::didCommitLoadImpl): (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl): * dom/EventTarget.cpp: (WebCore::EventTarget::innerInvokeEventListeners): * page/DOMTimer.cpp: (WebCore::DOMTimer::fired): When notifying Web Inspector that activity did occur, include all information previously included when notifying Web Inspector that that activity was about to occur so that Web Inspector can know whether a pause for the "special breakpoint" for that activity is still scheduled and if so cancel it. Source/WebInspectorUI: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * UserInterface/Models/Breakpoint.js: (WI.Breakpoint): (WI.Breakpoint.prototype.toJSON): (WI.Breakpoint.prototype.get special): Added. (WI.Breakpoint.prototype.get removable): Added. (WI.Breakpoint.prototype.get editable): Added. (WI.Breakpoint.prototype.set condition): (WI.Breakpoint.prototype.get ignoreCount): (WI.Breakpoint.prototype.set ignoreCount): (WI.Breakpoint.prototype.get autoContinue): (WI.Breakpoint.prototype.set autoContinue): (WI.Breakpoint.prototype.get actions): (WI.Breakpoint.prototype.get probeActions): (WI.Breakpoint.prototype.cycleToNextMode): (WI.Breakpoint.prototype.createAction): (WI.Breakpoint.prototype.recreateAction): (WI.Breakpoint.prototype.removeAction): (WI.Breakpoint.prototype.clearActions): (WI.Breakpoint.prototype.remove): Added. (WI.Breakpoint.prototype.optionsToProtocol): Added. (WI.Breakpoint.prototype.breakpointActionDidChange): (WI.Breakpoint.fromJSON): Deleted. (WI.Breakpoint.prototype.get sourceCodeLocation): Deleted. (WI.Breakpoint.prototype.get contentIdentifier): Deleted. (WI.Breakpoint.prototype.get scriptIdentifier): Deleted. (WI.Breakpoint.prototype.get target): Deleted. (WI.Breakpoint.prototype.get identifier): Deleted. (WI.Breakpoint.prototype.set identifier): Deleted. (WI.Breakpoint.prototype.get resolved): Deleted. (WI.Breakpoint.prototype.set resolved): Deleted. (WI.Breakpoint.prototype.saveIdentityToCookie): Deleted. (WI.Breakpoint.prototype._isSpecial): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationLocationChanged): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationDisplayLocationChanged): Deleted. * UserInterface/Models/DOMBreakpoint.js: (WI.DOMBreakpoint): (WI.DOMBreakpoint.fromJSON): Added. (WI.DOMBreakpoint.prototype.remove): Added. (WI.DOMBreakpoint.prototype.toJSON): (WI.DOMBreakpoint.deserialize): Deleted. (WI.DOMBreakpoint.prototype.get disabled): Deleted. (WI.DOMBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/EventBreakpoint.js: (WI.EventBreakpoint): (WI.EventBreakpoint.fromJSON): Added. (WI.EventBreakpoint.prototype.get special): Added. (WI.EventBreakpoint.prototype.get editable): Added. (WI.EventBreakpoint.prototype.remove): Added. (WI.EventBreakpoint.prototype.saveIdentityToCookie): (WI.EventBreakpoint.prototype.toJSON): (WI.EventBreakpoint.deserialize): Deleted. (WI.EventBreakpoint.prototype.get disabled): Deleted. (WI.EventBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/JavaScriptBreakpoint.js: Copied from UserInterface/Models/Breakpoint.js. (WI.JavaScriptBreakpoint): (WI.JavaScriptBreakpoint.fromJSON): (WI.JavaScriptBreakpoint.prototype.toJSON): (WI.JavaScriptBreakpoint.prototype.get sourceCodeLocation): (WI.JavaScriptBreakpoint.prototype.get contentIdentifier): (WI.JavaScriptBreakpoint.prototype.get scriptIdentifier): (WI.JavaScriptBreakpoint.prototype.get target): (WI.JavaScriptBreakpoint.prototype.get special): Added. (WI.JavaScriptBreakpoint.prototype.get removable): Added. (WI.JavaScriptBreakpoint.prototype.get editable): Added. (WI.JavaScriptBreakpoint.prototype.get identifier): (WI.JavaScriptBreakpoint.prototype.set identifier): (WI.JavaScriptBreakpoint.prototype.get resolved): (WI.JavaScriptBreakpoint.prototype.set resolved): (WI.JavaScriptBreakpoint.prototype.remove): Added. (WI.JavaScriptBreakpoint.prototype.saveIdentityToCookie): (WI.JavaScriptBreakpoint.prototype._isSpecial): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationLocationChanged): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationDisplayLocationChanged): * UserInterface/Models/URLBreakpoint.js: (WI.URLBreakpoint): (WI.URLBreakpoint.fromJSON): Added. (WI.URLBreakpoint.prototype.get special): Added. (WI.URLBreakpoint.prototype.remove): Added. (WI.URLBreakpoint.prototype.toJSON): (WI.URLBreakpoint.deserialize): Deleted. (WI.URLBreakpoint.prototype.get disabled): Deleted. (WI.URLBreakpoint.prototype.set disabled): Deleted. Rename `WI.Breakpoint` to `WI.JavaScriptBreakpoint` and use `WI.Breakpoint` as a new common base class for all breakpoint types, allowing more logic to be shared (e.g. disabled state). Additionally, breakpoints are now able to - determine whether or not they're - special - removable - editable (i.e. configurable) - remove themselves without the caller needing to know what manager to consult with. * UserInterface/Controllers/DOMManager.js: (WI.DOMManager): (WI.DOMManager.supportsEventListenerBreakpointConfiguration): Added. (WI.DOMManager.prototype.setBreakpointForEventListener): (WI.DOMManager.prototype.removeBreakpointForEventListener): (WI.DOMManager.prototype._setEventBreakpoint): Added. (WI.DOMManager.prototype._removeEventBreakpoint): Added. (WI.DOMManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for specific listener breakpoints. * UserInterface/Controllers/DOMDebuggerManager.js: (WI.DOMDebuggerManager): (WI.DOMDebuggerManager.prototype.initializeTarget): (WI.DOMDebuggerManager.prototype.addDOMBreakpoint): (WI.DOMDebuggerManager.prototype.removeDOMBreakpoint): (WI.DOMDebuggerManager.prototype.addEventBreakpoint): (WI.DOMDebuggerManager.prototype.removeEventBreakpoint): (WI.DOMDebuggerManager.prototype.addURLBreakpoint): (WI.DOMDebuggerManager.prototype.removeURLBreakpoint): (WI.DOMDebuggerManager.prototype._commandArgumentsForEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._setEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._removeEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointDisabledStateChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMDebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DOMDebuggerManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for special event breakpoints. Store special event breakpoints inside `WI.objectStores.eventBreakpoints`. * UserInterface/Controllers/DebuggerManager.js: (WI.DebuggerManager): (WI.DebuggerManager.prototype.addBreakpoint): (WI.DebuggerManager.prototype.removeBreakpoint): (WI.DebuggerManager.prototype.addProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.removeProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.updateProbesForBreakpoint): Added. (WI.DebuggerManager.prototype._setBreakpoint): (WI.DebuggerManager.prototype._breakpointEditablePropertyDidChange): (WI.DebuggerManager.prototype._handleBreakpointActionsDidChange): (WI.DebuggerManager.prototype.isBreakpointRemovable): Deleted. (WI.DebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DebuggerManager.prototype.isBreakpointEditable): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointActionType): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointOptions): Deleted. (WI.DebuggerManager.prototype._addProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._removeProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._updateProbesForBreakpoint): Deleted. Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Controllers/BreakpointPopoverController.js: (WI.BreakpointPopoverController.prototype.appendContextMenuItems): (WI.BreakpointPopoverController.prototype._createPopoverContent): Allow any breakpoint instead of only `WI.JavaScriptBreakpoint`. Drive-by: the existing `ignoreCount` value wasn't being used to populate the `<input>`. * UserInterface/Views/BreakpointTreeElement.js: (WI.BreakpointTreeElement.prototype.ondelete): (WI.BreakpointTreeElement.prototype.get listenerSet): Added. (WI.BreakpointTreeElement.prototype.updateStatus): Added. (WI.BreakpointTreeElement.prototype.updateTitles): Added. (WI.BreakpointTreeElement.prototype.get breakpoint): Deleted. (WI.BreakpointTreeElement.prototype.get filterableData): Deleted. (WI.BreakpointTreeElement.prototype._updateTitles): Deleted. (WI.BreakpointTreeElement.prototype._updateStatus): Deleted. (WI.BreakpointTreeElement.prototype._breakpointLocationDidChange): Deleted. * UserInterface/Views/BreakpointTreeElement.css: (.item.breakpoint .status > .status-image): (.item.breakpoint.paused .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.paused .icon): Added. (.item.breakpoint .status > .status-image.resolved): Deleted. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.selected .status > .status-image.resolved): Deleted. (.item.breakpoint .subtitle.formatted-location): Deleted. (.breakpoint-debugger-statement-icon .icon): Deleted. (.breakpoint-exception-icon .icon): Deleted. (.breakpoint-assertion-icon .icon): Deleted. (.breakpoint-microtask-icon .icon): Deleted. (.breakpoint-paused-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon > span): Deleted. (.data-updated.breakpoint-generic-line-icon .icon > span): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-debugger-statement-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-exception-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-assertion-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-microtask-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-paused-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-generic-line-icon .icon): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.js: (WI.DOMBreakpointTreeElement): (WI.DOMBreakpointTreeElement.prototype.onattach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondetach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondelete): Deleted. (WI.DOMBreakpointTreeElement.prototype.onenter): Deleted. (WI.DOMBreakpointTreeElement.prototype.onspace): Deleted. (WI.DOMBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.DOMBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.DOMBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.css: (.item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (.breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/EventBreakpointTreeElement.js: (WI.EventBreakpointTreeElement): (WI.EventBreakpointTreeElement.prototype.onattach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondetach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondelete): Deleted. (WI.EventBreakpointTreeElement.prototype.onenter): Deleted. (WI.EventBreakpointTreeElement.prototype.onspace): Deleted. (WI.EventBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.EventBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.EventBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/EventBreakpointTreeElement.css: (.item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (.item.breakpoint.event.interval:not(.paused) .icon): Added. (.item.breakpoint.event.listener:not(.paused) .icon): Added. (.item.breakpoint.event.timeout:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.interval:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.listener:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.timeout:not(.paused) .icon): Added. (.breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/JavaScriptBreakpointTreeElement.js: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js. (WI.JavaScriptBreakpointTreeElement): (WI.JavaScriptBreakpointTreeElement.prototype.get filterableData): (WI.JavaScriptBreakpointTreeElement.prototype.updateStatus): Added. (WI.JavaScriptBreakpointTreeElement.prototype.updateTitles): Added. (WI.JavaScriptBreakpointTreeElement.prototype._breakpointLocationDidChange): * UserInterface/Views/JavaScriptBreakpointTreeElement.css: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css. (.item.breakpoint.javascript .status > .status-image): Added. (.item.breakpoint.javascript .status > .status-image.resolved): Added. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.javascript.selected .status > .status-image.resolved): Added. (.item.breakpoint.javascript .subtitle.formatted-location): Added. (.item.breakpoint.javascript.line .icon): Added. (.item.breakpoint.javascript.line .icon > span): Added. (.data-updated.item.breakpoint.javascript.line .icon > span): Added. (.item.breakpoint.javascript.debugger-statement .icon): Added. (.item.breakpoint.javascript.exception .icon): Added. (.item.breakpoint.javascript.assertion .icon): Added. (.item.breakpoint.javascript.microtask .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.line .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.debugger-statement .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.exception .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.assertion .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.microtask .icon): Added. * UserInterface/Views/URLBreakpointTreeElement.js: (WI.URLBreakpointTreeElement): (WI.URLBreakpointTreeElement.prototype.onattach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondetach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondelete): Deleted. (WI.URLBreakpointTreeElement.prototype.onenter): Deleted. (WI.URLBreakpointTreeElement.prototype.onspace): Deleted. (WI.URLBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.URLBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.URLBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/URLBreakpointTreeElement.css: (.item.breakpoint.url .subtitle): Added. (.item.breakpoint.url:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.url:not(.paused) .icon): Added. (.breakpoint.url .subtitle): Deleted. (.breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. Rename `WI.BreakpointTreeElement` to `WI.JavaScriptBreakpointTreeElement` and use `WI.BreakpointTreeElement` as a new common base class for all breakpoint tree elements, allowing more logic and styles to be shared (e.g. disabled state). * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel): (WI.SourcesNavigationSidebarPanel.prototype.closed): (WI.SourcesNavigationSidebarPanel.prototype._insertDebuggerTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._compareJavaScriptBreakpointTreeElements): Added. (WI.SourcesNavigationSidebarPanel.prototype._addBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._removeAllBreakpoints): (WI.SourcesNavigationSidebarPanel.prototype._breakpointsBeneathTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._addIssue): (WI.SourcesNavigationSidebarPanel.prototype._updatePauseReasonSection): (WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange): (WI.SourcesNavigationSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu.addToggleForSpecialEventBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu): (WI.SourcesNavigationSidebarPanel.prototype._handleDebuggerObjectDisplayLocationDidChange): (WI.SourcesNavigationSidebarPanel.prototype._compareBreakpointTreeElements): Deleted. * UserInterface/Models/ProbeSet.js: (WI.ProbeSet): (WI.ProbeSet.prototype.createProbe): (WI.ProbeSet.prototype.willRemove): * UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.prototype._processRecord): * UserInterface/Views/ProbeSetDetailsSection.js: (WI.ProbeSetDetailsSection): * UserInterface/Views/ProbeDetailsSidebarPanel.js: (WI.ProbeDetailsSidebarPanel.prototype.inspect): * UserInterface/Views/SourceCodeTextEditor.js: (WI.SourceCodeTextEditor): (WI.SourceCodeTextEditor.prototype.close): (WI.SourceCodeTextEditor.prototype.textEditorBreakpointAdded): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype.get supplementalRepresentedObjects): (WI.TextResourceContentView.prototype._probeSetsChanged): Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Views/ContentView.js: (WI.ContentView.createFromRepresentedObject): (WI.ContentView.resolvedRepresentedObjectForRepresentedObject): (WI.ContentView.isViewable): * UserInterface/Views/ContextMenuUtilities.js: (WI.appendContextMenuItemsForSourceCode): Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. * UserInterface/Views/DOMTreeContentView.js: (WI.DOMTreeContentView): Replace `WI.DOMBreakpoint` with `WI.Breakpoint`. * UserInterface/Views/EventListenerSectionGroup.js: (WI.EventListenerSectionGroup): * UserInterface/Views/EventListenerSectionGroup.css: (.event-listener-section > .content input[type="checkbox"] + .go-to-arrow): Added. (.event-listener-section > .content input[type="checkbox"]:not(:checked) + .go-to-arrow): Added. Add a go-to arrow next to the Breakpoint checkbox that reveals the `WI.EventBreakpoint` in the Sources Tab. * UserInterface/Views/BreakpointActionView.js: (WI.BreakpointActionView.prototype._appendActionButtonClicked): Drive-by: minor code cleanup. * UserInterface/Views/CallFrameTreeElement.js: (WI.CallFrameTreeElement.prototype.populateContextMenu): Drive-by: include source code location context menu items. * UserInterface/Base/Setting.js: * UserInterface/Main.html: * UserInterface/Test.html: LayoutTests: * inspector/dom-debugger/resources/event-breakpoint-utilities.js: (TestPage.registerInitializer.InspectorTest.EventBreakpoint.addBreakpointOptionsTestCases): Added. (TestPage.registerInitializer.InspectorTest.EventBreakpoint.async teardown): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.createBreakpoint): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.removeBreakpoint): * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/breakpoint-for-event-listener-expected.txt: * inspector/dom-debugger/event-animation-frame-breakpoints.html: * inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt: * inspector/dom-debugger/event-interval-breakpoints.html: * inspector/dom-debugger/event-interval-breakpoints-expected.txt: * inspector/dom-debugger/event-listener-breakpoints.html: * inspector/dom-debugger/event-listener-breakpoints-expected.txt: * inspector/dom-debugger/event-timeout-breakpoints.html: * inspector/dom-debugger/event-timeout-breakpoints-expected.txt: Add tests for new event breakpoint configuration options. * http/tests/inspector/debugger/debugger-test.js: (TestPage.registerInitializer.InspectorTest.startTracingBreakpoints): * http/tests/inspector/resources/probe-test.js: (TestPage.registerInitializer.ProtocolTest.Probe.installTracingListeners): * inspector/debugger/breakpoint-action-eval.html: * inspector/debugger/breakpoint-action-log.html: * inspector/debugger/breakpoint-columns.html: * inspector/debugger/breakpoint-scope.html: * inspector/debugger/debugger-stack-overflow.html: * inspector/debugger/pause-reason.html: * inspector/debugger/probe-manager-add-remove-actions.html: * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/debugger/tail-deleted-frames-this-value.html: * inspector/debugger/tail-recursion.html: * inspector/worker/debugger-pause.html: * inspector/worker/debugger-shared-breakpoint.html: Update existing breakpoint tests to use new model objects. Canonical link: https://commits.webkit.org/228551@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 17:34:12 +00:00
} while (result != MessageQueueTerminated && !doneProcessingDebuggerEvents());
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
}
Web Inspector: rename `ScriptDebugServer` subclasses/methods https://bugs.webkit.org/show_bug.cgi?id=215363 <rdar://problem/67310441> Reviewed by Brian Burg. r266074 merged `Inspector::ScriptDebugServer` into `JSC::Debugger`. All subclasses and functions should be renamed to match this change. Source/JavaScriptCore: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectDebugger.h: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.h. * inspector/JSGlobalObjectDebugger.cpp: Renamed from Source/JavaScriptCore/inspector/JSGlobalObjectScriptDebugServer.cpp. * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.cpp: * inspector/remote/RemoteInspectionTarget.cpp: * inspector/remote/cocoa/RemoteConnectionToTargetCocoa.mm: Source/WebCore: * Headers.cmake: * Sources.txt: * SourcesCocoa.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorController.h: * inspector/InspectorController.cpp: * inspector/PageDebugger.h: Renamed from Source/WebCore/inspector/PageScriptDebugServer.h. * inspector/PageDebugger.cpp: Renamed from Source/WebCore/inspector/PageScriptDebugServer.cpp. * inspector/mac/PageDebuggerMac.mm: Renamed from Source/WebCore/inspector/mac/PageScriptDebugServerMac.mm. * inspector/WorkerDebugger.h: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.h. * inspector/WorkerDebugger.cpp: Renamed from Source/WebCore/inspector/WorkerScriptDebugServer.cpp. * inspector/WorkerInspectorController.h: * inspector/WorkerInspectorController.cpp: * inspector/agents/InspectorTimelineAgent.cpp: * inspector/agents/page/PageDebuggerAgent.cpp: Canonical link: https://commits.webkit.org/228554@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 18:40:30 +00:00
void WorkerDebugger::reportException(JSC::JSGlobalObject* exec, JSC::Exception* exception) const
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
{
Web Inspector: allow event breakpoints to be configured https://bugs.webkit.org/show_bug.cgi?id=215362 <rdar://problem/66932921> Reviewed by Brian Burg. Source/JavaScriptCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * inspector/protocol/DOM.json: Add an `options` paramater to `DOM.setBreakpointForEventListener` to allow configuration. * inspector/protocol/DOMDebugger.json: Add an `options` paramater to `DOMDebugger.setEventBreakpoint` to allow configuration. * debugger/Breakpoint.h: (JSC::Breakpoint::id const): Added. (JSC::Breakpoint::sourceID const): Added. (JSC::Breakpoint::lineNumber const): Added. (JSC::Breakpoint::columnNumber const): Added. (JSC::Breakpoint::condition const): Added. (JSC::Breakpoint::actions const): Added. (JSC::Breakpoint::isAutoContinue const): Added. (JSC::Breakpoint::resetHitCount): Added. (JSC::Breakpoint::isLinked const): Added. (JSC::Breakpoint::isResolved const): Added. (JSC::BreakpointsList::~BreakpointsList): Deleted. * debugger/Breakpoint.cpp: Added. (JSC::Breakpoint::Action::Action): Added. (JSC::Breakpoint::create): Added. (JSC::Breakpoint::Breakpoint): Added. (JSC::Breakpoint::link): Added. (JSC::Breakpoint::resolve): Added. (JSC::Breakpoint::shouldPause): Added. Unify `JSC::Breakpoint` and `Inspector::ScriptBreakpoint`. * debugger/DebuggerPrimitives.h: * debugger/Debugger.h: * debugger/Debugger.cpp: (JSC::Debugger::Debugger): (JSC::Debugger::addObserver): Added. (JSC::Debugger::removeObserver): Added. (JSC::Debugger::canDispatchFunctionToObservers const): Added. (JSC::Debugger::dispatchFunctionToObservers): Added. (JSC::Debugger::sourceParsed): Added. (JSC::Debugger::toggleBreakpoint): (JSC::Debugger::applyBreakpoints): (JSC::Debugger::resolveBreakpoint): (JSC::Debugger::setBreakpoint): (JSC::Debugger::removeBreakpoint): (JSC::Debugger::didHitBreakpoint): Added. (JSC::Debugger::clearBreakpoints): (JSC::Debugger::evaluateBreakpointCondition): Added. (JSC::Debugger::evaluateBreakpointActions): Added. (JSC::Debugger::schedulePauseAtNextOpportunity): Added. (JSC::Debugger::cancelPauseAtNextOpportunity): Added. (JSC::Debugger::schedulePauseForSpecialBreakpoint): Added. (JSC::Debugger::cancelPauseForSpecialBreakpoint): Added. (JSC::Debugger::continueProgram): (JSC::Debugger::stepNextExpression): (JSC::Debugger::stepIntoStatement): (JSC::Debugger::stepOverStatement): (JSC::Debugger::stepOutOfFunction): (JSC::Debugger::pauseIfNeeded): (JSC::Debugger::handlePause): Added. (JSC::Debugger::exceptionOrCaughtValue): Added. (JSC::Debugger::atExpression): (JSC::Debugger::clearNextPauseState): (JSC::Debugger::willRunMicrotask): Added. (JSC::Debugger::didRunMicrotask): Added. (JSC::Debugger::hasBreakpoint): Deleted. (JSC::Debugger::setPauseOnNextStatement): Deleted. Unify `JSC::Debugger` and `Inspector::ScriptDebugServer` to simplify breakpoint logic. Introduce the concept of a "special breakpoint", which is essentially a `JSC::Breakpoint` that is expected to pause at the next opportunity but isn't tied to a particular location. As an example, whenever an event breakpoint is hit, instead of just pausing at the next opportunity, the newly managed `JSC::Breakpoint` is used as a "special breakpoint", allowing for it's configuration (ie.g. condition, ignore count, actions, auto-continue) to be used. * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::objectGroupForBreakpointAction): (Inspector::breakpointActionTypeForString): Added. (Inspector::parseBreakpointOptions): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::fromPayload): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::ProtocolBreakpoint): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::createDebuggerBreakpoint const): Added. (Inspector::InspectorDebuggerAgent::ProtocolBreakpoint::matchesScriptURL const): Added. (Inspector::InspectorDebuggerAgent::debuggerBreakpointFromPayload): Added. (Inspector::InspectorDebuggerAgent::enable): (Inspector::InspectorDebuggerAgent::disable): (Inspector::InspectorDebuggerAgent::buildBreakpointPauseReason): (Inspector::InspectorDebuggerAgent::handleConsoleAssert): (Inspector::InspectorDebuggerAgent::didScheduleAsyncCall): (Inspector::buildDebuggerLocation): (Inspector::InspectorDebuggerAgent::setBreakpointByUrl): (Inspector::InspectorDebuggerAgent::setBreakpoint): (Inspector::InspectorDebuggerAgent::didSetBreakpoint): (Inspector::InspectorDebuggerAgent::resolveBreakpoint): (Inspector::InspectorDebuggerAgent::removeBreakpoint): (Inspector::InspectorDebuggerAgent::continueToLocation): (Inspector::InspectorDebuggerAgent::schedulePauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::cancelPauseAtNextOpportunity): Added. (Inspector::InspectorDebuggerAgent::schedulePauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::cancelPauseForSpecialBreakpoint): Added. (Inspector::InspectorDebuggerAgent::pause): (Inspector::InspectorDebuggerAgent::resume): (Inspector::InspectorDebuggerAgent::didBecomeIdle): (Inspector::InspectorDebuggerAgent::sourceMapURLForScript): (Inspector::InspectorDebuggerAgent::didParseSource): (Inspector::InspectorDebuggerAgent::willRunMicrotask): (Inspector::InspectorDebuggerAgent::didRunMicrotask): (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionSound): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::clearInspectorBreakpointState): (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): (Inspector::matches): Deleted. (Inspector::buildObjectForBreakpointCookie): Deleted. (Inspector::InspectorDebuggerAgent::breakpointActionsFromProtocol): Deleted. (Inspector::InspectorDebuggerAgent::schedulePauseOnNextStatement): Deleted. (Inspector::InspectorDebuggerAgent::cancelPauseOnNextStatement): Deleted. Create a private `ProtocolBreakpoint` class that holds the data sent by the frontend. This is necessary because breakpoints in the frontend have a potentially one-to-many relationship with breakpoints in the backend, as the same script can be loaded many times on a page. Each of those scripts is independent, however, and can execute differently, meaning that the same breakpoint for each script also needs a different state (e.g. ignore count). As such, the `ProtocolBreakpoint` is effectively a template that is actualized whenever a new script is parsed that matches the URL of the `ProtocolBreakpoint` to create a `JSC::Breakpoint` that is used by the `JSC::Debugger`. `ProtocolBreakpoint` also parses breakpoint configurations. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectScriptDebugServer.h: * inspector/JSGlobalObjectScriptDebugServer.cpp: (Inspector::JSGlobalObjectScriptDebugServer::JSGlobalObjectScriptDebugServer): (Inspector::JSGlobalObjectScriptDebugServer::attachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::detachDebugger): (Inspector::JSGlobalObjectScriptDebugServer::runEventLoopWhilePaused): * inspector/agents/InspectorAuditAgent.h: * inspector/agents/InspectorAuditAgent.cpp: (Inspector::InspectorAuditAgent::run): * inspector/agents/InspectorRuntimeAgent.h: * inspector/agents/InspectorRuntimeAgent.cpp: (Inspector::setPauseOnExceptionsState): (Inspector::InspectorRuntimeAgent::evaluate): (Inspector::InspectorRuntimeAgent::callFunctionOn): (Inspector::InspectorRuntimeAgent::getPreview): (Inspector::InspectorRuntimeAgent::getProperties): (Inspector::InspectorRuntimeAgent::getDisplayableProperties): * inspector/agents/InspectorScriptProfilerAgent.cpp: * inspector/agents/JSGlobalObjectDebuggerAgent.h: Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * runtime/JSMicrotask.cpp: (JSC::JSMicrotask::run): Drive-by: r248894 mistakenly omitted the call to notify the debugger that the microtask ran. * inspector/ScriptBreakpoint.h: Removed. * inspector/ScriptDebugListener.h: Removed. * inspector/ScriptDebugServer.h: Removed. * inspector/ScriptDebugServer.cpp: Removed. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: Source/WebCore: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing Tests: inspector/dom/breakpoint-for-event-listener.html inspector/dom-debugger/event-animation-frame-breakpoints.html inspector/dom-debugger/event-interval-breakpoints.html inspector/dom-debugger/event-listener-breakpoints.html inspector/dom-debugger/event-timeout-breakpoints.html * inspector/agents/InspectorDOMAgent.h: * inspector/agents/InspectorDOMAgent.cpp: (WebCore::InspectorDOMAgent::getEventListenersForNode): (WebCore::InspectorDOMAgent::setBreakpointForEventListener): (WebCore::InspectorDOMAgent::removeBreakpointForEventListener): (WebCore::InspectorDOMAgent::buildObjectForEventListener): (WebCore::InspectorDOMAgent::breakpointForEventListener): (WebCore::InspectorDOMAgent::hasBreakpointForEventListener): Deleted. * inspector/agents/InspectorDOMDebuggerAgent.h: * inspector/agents/InspectorDOMDebuggerAgent.cpp: (WebCore::InspectorDOMDebuggerAgent::disable): (WebCore::InspectorDOMDebuggerAgent::mainFrameNavigated): (WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint): (WebCore::InspectorDOMDebuggerAgent::willHandleEvent): (WebCore::InspectorDOMDebuggerAgent::didHandleEvent): (WebCore::InspectorDOMDebuggerAgent::willFireTimer): (WebCore::InspectorDOMDebuggerAgent::didFireTimer): * inspector/agents/page/PageDOMDebuggerAgent.h: * inspector/agents/page/PageDOMDebuggerAgent.cpp: (WebCore::PageDOMDebuggerAgent::disable): (WebCore::PageDOMDebuggerAgent::mainFrameNavigated): (WebCore::PageDOMDebuggerAgent::willFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::didFireAnimationFrame): (WebCore::PageDOMDebuggerAgent::setAnimationFrameBreakpoint): * inspector/agents/worker/WorkerDOMDebuggerAgent.h: * inspector/agents/worker/WorkerDOMDebuggerAgent.cpp: (WebCore::WorkerDOMDebuggerAgent::setAnimationFrameBreakpoint): Keep a `JSC::Breakpoint` for each event breakpoint instead of a simple `bool`, allowing for configuration when the breakpoint is first set. When any of these breakpoints are hit, pass it to the `JSC::Debugger` as a "special breakpoint", which behaves the same as "pause ASAP" but also supports a condition, an ignore count, actions, and auto-continue. Reset the hit count for any of these "special breakpoints" that persist across Web Inspector sessions when the main frame navigates. * inspector/PageScriptDebugServer.h: * inspector/PageScriptDebugServer.cpp: (WebCore::PageScriptDebugServer::PageScriptDebugServer): (WebCore::PageScriptDebugServer::attachDebugger): (WebCore::PageScriptDebugServer::detachDebugger): (WebCore::PageScriptDebugServer::didPause): (WebCore::PageScriptDebugServer::didContinue): (WebCore::PageScriptDebugServer::runEventLoopWhilePaused): (WebCore::PageScriptDebugServer::runEventLoopWhilePausedInternal): (WebCore::PageScriptDebugServer::isContentScript const): (WebCore::PageScriptDebugServer::reportException const): * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException const): * inspector/agents/page/PageDebuggerAgent.h: * inspector/agents/page/PageDebuggerAgent.cpp: (WebCore::PageDebuggerAgent::sourceMapURLForScript): Replace `Inspector::ScriptDebugServer` with `JSC::Debugger`. * inspector/TimelineRecordFactory.h: * inspector/TimelineRecordFactory.cpp: (WebCore::TimelineRecordFactory::createProbeSampleData): * inspector/agents/InspectorTimelineAgent.h: * inspector/agents/InspectorTimelineAgent.cpp: (WebCore::InspectorTimelineAgent::internalStart): (WebCore::InspectorTimelineAgent::internalStop): (WebCore::InspectorTimelineAgent::breakpointActionProbe): Replace `Inspector::ScriptBreakpoint` with `JSC::Breakpoint`. * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::didHandleEvent): (WebCore::InspectorInstrumentation::didFireTimer): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::didHandleEventImpl): (WebCore::InspectorInstrumentation::didFireTimerImpl): (WebCore::InspectorInstrumentation::didCommitLoadImpl): (WebCore::InspectorInstrumentation::didFireAnimationFrameImpl): * dom/EventTarget.cpp: (WebCore::EventTarget::innerInvokeEventListeners): * page/DOMTimer.cpp: (WebCore::DOMTimer::fired): When notifying Web Inspector that activity did occur, include all information previously included when notifying Web Inspector that that activity was about to occur so that Web Inspector can know whether a pause for the "special breakpoint" for that activity is still scheduled and if so cancel it. Source/WebInspectorUI: This allows developers to do things like: - only pause when `window.event.type` is a certain value - ignore the first N pauses - evaluate JavaScript whenever an event listener is invoked without pausing * UserInterface/Models/Breakpoint.js: (WI.Breakpoint): (WI.Breakpoint.prototype.toJSON): (WI.Breakpoint.prototype.get special): Added. (WI.Breakpoint.prototype.get removable): Added. (WI.Breakpoint.prototype.get editable): Added. (WI.Breakpoint.prototype.set condition): (WI.Breakpoint.prototype.get ignoreCount): (WI.Breakpoint.prototype.set ignoreCount): (WI.Breakpoint.prototype.get autoContinue): (WI.Breakpoint.prototype.set autoContinue): (WI.Breakpoint.prototype.get actions): (WI.Breakpoint.prototype.get probeActions): (WI.Breakpoint.prototype.cycleToNextMode): (WI.Breakpoint.prototype.createAction): (WI.Breakpoint.prototype.recreateAction): (WI.Breakpoint.prototype.removeAction): (WI.Breakpoint.prototype.clearActions): (WI.Breakpoint.prototype.remove): Added. (WI.Breakpoint.prototype.optionsToProtocol): Added. (WI.Breakpoint.prototype.breakpointActionDidChange): (WI.Breakpoint.fromJSON): Deleted. (WI.Breakpoint.prototype.get sourceCodeLocation): Deleted. (WI.Breakpoint.prototype.get contentIdentifier): Deleted. (WI.Breakpoint.prototype.get scriptIdentifier): Deleted. (WI.Breakpoint.prototype.get target): Deleted. (WI.Breakpoint.prototype.get identifier): Deleted. (WI.Breakpoint.prototype.set identifier): Deleted. (WI.Breakpoint.prototype.get resolved): Deleted. (WI.Breakpoint.prototype.set resolved): Deleted. (WI.Breakpoint.prototype.saveIdentityToCookie): Deleted. (WI.Breakpoint.prototype._isSpecial): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationLocationChanged): Deleted. (WI.Breakpoint.prototype._sourceCodeLocationDisplayLocationChanged): Deleted. * UserInterface/Models/DOMBreakpoint.js: (WI.DOMBreakpoint): (WI.DOMBreakpoint.fromJSON): Added. (WI.DOMBreakpoint.prototype.remove): Added. (WI.DOMBreakpoint.prototype.toJSON): (WI.DOMBreakpoint.deserialize): Deleted. (WI.DOMBreakpoint.prototype.get disabled): Deleted. (WI.DOMBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/EventBreakpoint.js: (WI.EventBreakpoint): (WI.EventBreakpoint.fromJSON): Added. (WI.EventBreakpoint.prototype.get special): Added. (WI.EventBreakpoint.prototype.get editable): Added. (WI.EventBreakpoint.prototype.remove): Added. (WI.EventBreakpoint.prototype.saveIdentityToCookie): (WI.EventBreakpoint.prototype.toJSON): (WI.EventBreakpoint.deserialize): Deleted. (WI.EventBreakpoint.prototype.get disabled): Deleted. (WI.EventBreakpoint.prototype.set disabled): Deleted. * UserInterface/Models/JavaScriptBreakpoint.js: Copied from UserInterface/Models/Breakpoint.js. (WI.JavaScriptBreakpoint): (WI.JavaScriptBreakpoint.fromJSON): (WI.JavaScriptBreakpoint.prototype.toJSON): (WI.JavaScriptBreakpoint.prototype.get sourceCodeLocation): (WI.JavaScriptBreakpoint.prototype.get contentIdentifier): (WI.JavaScriptBreakpoint.prototype.get scriptIdentifier): (WI.JavaScriptBreakpoint.prototype.get target): (WI.JavaScriptBreakpoint.prototype.get special): Added. (WI.JavaScriptBreakpoint.prototype.get removable): Added. (WI.JavaScriptBreakpoint.prototype.get editable): Added. (WI.JavaScriptBreakpoint.prototype.get identifier): (WI.JavaScriptBreakpoint.prototype.set identifier): (WI.JavaScriptBreakpoint.prototype.get resolved): (WI.JavaScriptBreakpoint.prototype.set resolved): (WI.JavaScriptBreakpoint.prototype.remove): Added. (WI.JavaScriptBreakpoint.prototype.saveIdentityToCookie): (WI.JavaScriptBreakpoint.prototype._isSpecial): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationLocationChanged): (WI.JavaScriptBreakpoint.prototype._sourceCodeLocationDisplayLocationChanged): * UserInterface/Models/URLBreakpoint.js: (WI.URLBreakpoint): (WI.URLBreakpoint.fromJSON): Added. (WI.URLBreakpoint.prototype.get special): Added. (WI.URLBreakpoint.prototype.remove): Added. (WI.URLBreakpoint.prototype.toJSON): (WI.URLBreakpoint.deserialize): Deleted. (WI.URLBreakpoint.prototype.get disabled): Deleted. (WI.URLBreakpoint.prototype.set disabled): Deleted. Rename `WI.Breakpoint` to `WI.JavaScriptBreakpoint` and use `WI.Breakpoint` as a new common base class for all breakpoint types, allowing more logic to be shared (e.g. disabled state). Additionally, breakpoints are now able to - determine whether or not they're - special - removable - editable (i.e. configurable) - remove themselves without the caller needing to know what manager to consult with. * UserInterface/Controllers/DOMManager.js: (WI.DOMManager): (WI.DOMManager.supportsEventListenerBreakpointConfiguration): Added. (WI.DOMManager.prototype.setBreakpointForEventListener): (WI.DOMManager.prototype.removeBreakpointForEventListener): (WI.DOMManager.prototype._setEventBreakpoint): Added. (WI.DOMManager.prototype._removeEventBreakpoint): Added. (WI.DOMManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for specific listener breakpoints. * UserInterface/Controllers/DOMDebuggerManager.js: (WI.DOMDebuggerManager): (WI.DOMDebuggerManager.prototype.initializeTarget): (WI.DOMDebuggerManager.prototype.addDOMBreakpoint): (WI.DOMDebuggerManager.prototype.removeDOMBreakpoint): (WI.DOMDebuggerManager.prototype.addEventBreakpoint): (WI.DOMDebuggerManager.prototype.removeEventBreakpoint): (WI.DOMDebuggerManager.prototype.addURLBreakpoint): (WI.DOMDebuggerManager.prototype.removeURLBreakpoint): (WI.DOMDebuggerManager.prototype._commandArgumentsForEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._setEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._removeEventBreakpoint): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointDisabledStateChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointEditablePropertyChanged): Added. (WI.DOMDebuggerManager.prototype._handleEventBreakpointActionsChanged): Added. (WI.DOMDebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DOMDebuggerManager.prototype._updateEventBreakpoint): Deleted. Keep track of configuration changes for special event breakpoints. Store special event breakpoints inside `WI.objectStores.eventBreakpoints`. * UserInterface/Controllers/DebuggerManager.js: (WI.DebuggerManager): (WI.DebuggerManager.prototype.addBreakpoint): (WI.DebuggerManager.prototype.removeBreakpoint): (WI.DebuggerManager.prototype.addProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.removeProbesForBreakpoint): Added. (WI.DebuggerManager.prototype.updateProbesForBreakpoint): Added. (WI.DebuggerManager.prototype._setBreakpoint): (WI.DebuggerManager.prototype._breakpointEditablePropertyDidChange): (WI.DebuggerManager.prototype._handleBreakpointActionsDidChange): (WI.DebuggerManager.prototype.isBreakpointRemovable): Deleted. (WI.DebuggerManager.prototype.isBreakpointSpecial): Deleted. (WI.DebuggerManager.prototype.isBreakpointEditable): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointActionType): Deleted. (WI.DebuggerManager.prototype._debuggerBreakpointOptions): Deleted. (WI.DebuggerManager.prototype._addProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._removeProbesForBreakpoint): Deleted. (WI.DebuggerManager.prototype._updateProbesForBreakpoint): Deleted. Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Controllers/BreakpointPopoverController.js: (WI.BreakpointPopoverController.prototype.appendContextMenuItems): (WI.BreakpointPopoverController.prototype._createPopoverContent): Allow any breakpoint instead of only `WI.JavaScriptBreakpoint`. Drive-by: the existing `ignoreCount` value wasn't being used to populate the `<input>`. * UserInterface/Views/BreakpointTreeElement.js: (WI.BreakpointTreeElement.prototype.ondelete): (WI.BreakpointTreeElement.prototype.get listenerSet): Added. (WI.BreakpointTreeElement.prototype.updateStatus): Added. (WI.BreakpointTreeElement.prototype.updateTitles): Added. (WI.BreakpointTreeElement.prototype.get breakpoint): Deleted. (WI.BreakpointTreeElement.prototype.get filterableData): Deleted. (WI.BreakpointTreeElement.prototype._updateTitles): Deleted. (WI.BreakpointTreeElement.prototype._updateStatus): Deleted. (WI.BreakpointTreeElement.prototype._breakpointLocationDidChange): Deleted. * UserInterface/Views/BreakpointTreeElement.css: (.item.breakpoint .status > .status-image): (.item.breakpoint.paused .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.paused .icon): Added. (.item.breakpoint .status > .status-image.resolved): Deleted. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.selected .status > .status-image.resolved): Deleted. (.item.breakpoint .subtitle.formatted-location): Deleted. (.breakpoint-debugger-statement-icon .icon): Deleted. (.breakpoint-exception-icon .icon): Deleted. (.breakpoint-assertion-icon .icon): Deleted. (.breakpoint-microtask-icon .icon): Deleted. (.breakpoint-paused-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon): Deleted. (.breakpoint-generic-line-icon .icon > span): Deleted. (.data-updated.breakpoint-generic-line-icon .icon > span): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-debugger-statement-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-exception-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-assertion-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-microtask-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-paused-icon .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint-generic-line-icon .icon): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.js: (WI.DOMBreakpointTreeElement): (WI.DOMBreakpointTreeElement.prototype.onattach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondetach): Deleted. (WI.DOMBreakpointTreeElement.prototype.ondelete): Deleted. (WI.DOMBreakpointTreeElement.prototype.onenter): Deleted. (WI.DOMBreakpointTreeElement.prototype.onspace): Deleted. (WI.DOMBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.DOMBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.DOMBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.DOMBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/DOMBreakpointTreeElement.css: (.item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (.item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.subtree-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.attribute-modified:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.dom.node-removed:not(.paused) .icon): Added. (.breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-subtree-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-attribute-modified:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.dom.breakpoint-for-node-removed:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/EventBreakpointTreeElement.js: (WI.EventBreakpointTreeElement): (WI.EventBreakpointTreeElement.prototype.onattach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondetach): Deleted. (WI.EventBreakpointTreeElement.prototype.ondelete): Deleted. (WI.EventBreakpointTreeElement.prototype.onenter): Deleted. (WI.EventBreakpointTreeElement.prototype.onspace): Deleted. (WI.EventBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.EventBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.EventBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.EventBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/EventBreakpointTreeElement.css: (.item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (.item.breakpoint.event.interval:not(.paused) .icon): Added. (.item.breakpoint.event.listener:not(.paused) .icon): Added. (.item.breakpoint.event.timeout:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.animation-frame:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.interval:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.listener:not(.paused) .icon): Added. (@media(prefers-color-scheme: dark) .item.breakpoint.event.timeout:not(.paused) .icon): Added. (.breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (.breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-animation-frame:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-interval:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-listener:not(.breakpoint-paused-icon) .icon): Deleted. (@media(prefers-color-scheme: dark) .breakpoint.event.breakpoint-for-timeout:not(.breakpoint-paused-icon) .icon): Deleted. * UserInterface/Views/JavaScriptBreakpointTreeElement.js: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js. (WI.JavaScriptBreakpointTreeElement): (WI.JavaScriptBreakpointTreeElement.prototype.get filterableData): (WI.JavaScriptBreakpointTreeElement.prototype.updateStatus): Added. (WI.JavaScriptBreakpointTreeElement.prototype.updateTitles): Added. (WI.JavaScriptBreakpointTreeElement.prototype._breakpointLocationDidChange): * UserInterface/Views/JavaScriptBreakpointTreeElement.css: Copied from Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.css. (.item.breakpoint.javascript .status > .status-image): Added. (.item.breakpoint.javascript .status > .status-image.resolved): Added. (body:not(.window-inactive, .window-docked-inactive) .tree-outline:focus-within .item.breakpoint.javascript.selected .status > .status-image.resolved): Added. (.item.breakpoint.javascript .subtitle.formatted-location): Added. (.item.breakpoint.javascript.line .icon): Added. (.item.breakpoint.javascript.line .icon > span): Added. (.data-updated.item.breakpoint.javascript.line .icon > span): Added. (.item.breakpoint.javascript.debugger-statement .icon): Added. (.item.breakpoint.javascript.exception .icon): Added. (.item.breakpoint.javascript.assertion .icon): Added. (.item.breakpoint.javascript.microtask .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.line .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.debugger-statement .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.exception .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.assertion .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.javascript.microtask .icon): Added. * UserInterface/Views/URLBreakpointTreeElement.js: (WI.URLBreakpointTreeElement): (WI.URLBreakpointTreeElement.prototype.onattach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondetach): Deleted. (WI.URLBreakpointTreeElement.prototype.ondelete): Deleted. (WI.URLBreakpointTreeElement.prototype.onenter): Deleted. (WI.URLBreakpointTreeElement.prototype.onspace): Deleted. (WI.URLBreakpointTreeElement.prototype.populateContextMenu): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementClicked): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementFocused): Deleted. (WI.URLBreakpointTreeElement.prototype._statusImageElementMouseDown): Deleted. (WI.URLBreakpointTreeElement.prototype._toggleBreakpoint): Deleted. (WI.URLBreakpointTreeElement.prototype._updateStatus): Deleted. * UserInterface/Views/URLBreakpointTreeElement.css: (.item.breakpoint.url .subtitle): Added. (.item.breakpoint.url:not(.paused) .icon): Added. (@media (prefers-color-scheme: dark) .item.breakpoint.url:not(.paused) .icon): Added. (.breakpoint.url .subtitle): Deleted. (.breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. (@media (prefers-color-scheme: dark) .breakpoint.url:not(.breakpoint-paused-icon) .icon): Deleted. Rename `WI.BreakpointTreeElement` to `WI.JavaScriptBreakpointTreeElement` and use `WI.BreakpointTreeElement` as a new common base class for all breakpoint tree elements, allowing more logic and styles to be shared (e.g. disabled state). * UserInterface/Views/SourcesNavigationSidebarPanel.js: (WI.SourcesNavigationSidebarPanel): (WI.SourcesNavigationSidebarPanel.prototype.closed): (WI.SourcesNavigationSidebarPanel.prototype._insertDebuggerTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._compareJavaScriptBreakpointTreeElements): Added. (WI.SourcesNavigationSidebarPanel.prototype._addBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._removeAllBreakpoints): (WI.SourcesNavigationSidebarPanel.prototype._breakpointsBeneathTreeElement): (WI.SourcesNavigationSidebarPanel.prototype._addIssue): (WI.SourcesNavigationSidebarPanel.prototype._updatePauseReasonSection): (WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange): (WI.SourcesNavigationSidebarPanel.prototype._handleBreakpointElementAddedOrRemoved): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu.addToggleForSpecialEventBreakpoint): (WI.SourcesNavigationSidebarPanel.prototype._populateCreateBreakpointContextMenu): (WI.SourcesNavigationSidebarPanel.prototype._handleDebuggerObjectDisplayLocationDidChange): (WI.SourcesNavigationSidebarPanel.prototype._compareBreakpointTreeElements): Deleted. * UserInterface/Models/ProbeSet.js: (WI.ProbeSet): (WI.ProbeSet.prototype.createProbe): (WI.ProbeSet.prototype.willRemove): * UserInterface/Controllers/TimelineManager.js: (WI.TimelineManager.prototype._processRecord): * UserInterface/Views/ProbeSetDetailsSection.js: (WI.ProbeSetDetailsSection): * UserInterface/Views/ProbeDetailsSidebarPanel.js: (WI.ProbeDetailsSidebarPanel.prototype.inspect): * UserInterface/Views/SourceCodeTextEditor.js: (WI.SourceCodeTextEditor): (WI.SourceCodeTextEditor.prototype.close): (WI.SourceCodeTextEditor.prototype.textEditorBreakpointAdded): * UserInterface/Views/TextResourceContentView.js: (WI.TextResourceContentView.prototype.get supplementalRepresentedObjects): (WI.TextResourceContentView.prototype._probeSetsChanged): Probes now support `WI.EventBreakpoint` in addition to `WI.JavaScriptBreakpoint`. * UserInterface/Views/ContentView.js: (WI.ContentView.createFromRepresentedObject): (WI.ContentView.resolvedRepresentedObjectForRepresentedObject): (WI.ContentView.isViewable): * UserInterface/Views/ContextMenuUtilities.js: (WI.appendContextMenuItemsForSourceCode): Replace `WI.Breakpoint` with `WI.JavaScriptBreakpoint`. * UserInterface/Views/DOMTreeContentView.js: (WI.DOMTreeContentView): Replace `WI.DOMBreakpoint` with `WI.Breakpoint`. * UserInterface/Views/EventListenerSectionGroup.js: (WI.EventListenerSectionGroup): * UserInterface/Views/EventListenerSectionGroup.css: (.event-listener-section > .content input[type="checkbox"] + .go-to-arrow): Added. (.event-listener-section > .content input[type="checkbox"]:not(:checked) + .go-to-arrow): Added. Add a go-to arrow next to the Breakpoint checkbox that reveals the `WI.EventBreakpoint` in the Sources Tab. * UserInterface/Views/BreakpointActionView.js: (WI.BreakpointActionView.prototype._appendActionButtonClicked): Drive-by: minor code cleanup. * UserInterface/Views/CallFrameTreeElement.js: (WI.CallFrameTreeElement.prototype.populateContextMenu): Drive-by: include source code location context menu items. * UserInterface/Base/Setting.js: * UserInterface/Main.html: * UserInterface/Test.html: LayoutTests: * inspector/dom-debugger/resources/event-breakpoint-utilities.js: (TestPage.registerInitializer.InspectorTest.EventBreakpoint.addBreakpointOptionsTestCases): Added. (TestPage.registerInitializer.InspectorTest.EventBreakpoint.async teardown): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.createBreakpoint): (TestPage.registerInitializer.InspectorTest.EventBreakpoint.removeBreakpoint): * inspector/dom/breakpoint-for-event-listener.html: * inspector/dom/breakpoint-for-event-listener-expected.txt: * inspector/dom-debugger/event-animation-frame-breakpoints.html: * inspector/dom-debugger/event-animation-frame-breakpoints-expected.txt: * inspector/dom-debugger/event-interval-breakpoints.html: * inspector/dom-debugger/event-interval-breakpoints-expected.txt: * inspector/dom-debugger/event-listener-breakpoints.html: * inspector/dom-debugger/event-listener-breakpoints-expected.txt: * inspector/dom-debugger/event-timeout-breakpoints.html: * inspector/dom-debugger/event-timeout-breakpoints-expected.txt: Add tests for new event breakpoint configuration options. * http/tests/inspector/debugger/debugger-test.js: (TestPage.registerInitializer.InspectorTest.startTracingBreakpoints): * http/tests/inspector/resources/probe-test.js: (TestPage.registerInitializer.ProtocolTest.Probe.installTracingListeners): * inspector/debugger/breakpoint-action-eval.html: * inspector/debugger/breakpoint-action-log.html: * inspector/debugger/breakpoint-columns.html: * inspector/debugger/breakpoint-scope.html: * inspector/debugger/debugger-stack-overflow.html: * inspector/debugger/pause-reason.html: * inspector/debugger/probe-manager-add-remove-actions.html: * inspector/debugger/stepping/stepping-through-autoContinue-breakpoint.html: * inspector/debugger/tail-deleted-frames-this-value.html: * inspector/debugger/tail-recursion.html: * inspector/worker/debugger-pause.html: * inspector/worker/debugger-shared-breakpoint.html: Update existing breakpoint tests to use new model objects. Canonical link: https://commits.webkit.org/228551@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@266074 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-08-24 17:34:12 +00:00
JSC::Debugger::reportException(exec, exception);
Web Inspector: Introduce Page WorkerAgent and Worker InspectorController https://bugs.webkit.org/show_bug.cgi?id=163817 <rdar://problem/28899063> Reviewed by Brian Burg. Source/JavaScriptCore: * CMakeLists.txt: * DerivedSources.make: * inspector/protocol/Worker.json: Added. New Worker domain. Source/WebCore: Test: inspector/worker/worker-create-and-terminate.html From the perspective of an Inspector frontend, Workers are like a special JavaScript context, separate from the page, that may have its own set of Agents. This patch adds the necessary backend infrastructure to provide WorkerGlobalObject with an InspectorController and the means to communicate with a frontend through a Page's WorkerAgent. Pages now get a WorkerAgent. This informs the frontend about created and terminated Workers. It also provides a communication channel to dispatch and return inspector protocol messages to each of the Workers. The Page side always interacts with the WorkerInspectorProxy on the main thread. The Page's Worker Agent can sends and receives messages to WorkerInspectorControllers. WorkerGlobalScopes now get a WorkerInspectorController which will eventually contain its own set of agents. There are no agents yet, but they will be added individually in follow-up patches. The Worker side always interacts with the WorkerGlobalScope on the worker thread. WorkerInspectorController dispatches messages on its agents. All communication with Worker agents goes through Worker.sendMessageToWorker, which tunnels the command request to the Worker's InspectorController and agents. At the protocol level, worker agent command responses and worker agent events are sent as events through Worker.dispatchMessageFromWorker. On the frontend, the message dispatcher code will pair up replies with their commands, and no-reply messages as events, like normal. So calling worker agent methods in the frontend will be no different from the existing callback/promise-based ways. * CMakeLists.txt: * WebCore.xcodeproj/project.pbxproj: * inspector/InspectorAllInOne.cpp: Add new files. * bindings/js/WorkerScriptController.cpp: (WebCore::WorkerScriptController::WorkerScriptController): (WebCore::WorkerScriptController::initScript): * bindings/js/WorkerScriptController.h: Some cleanup. * inspector/InspectorController.cpp: (WebCore::InspectorController::InspectorController): * inspector/InspectorController.h: * inspector/InstrumentingAgents.cpp: (WebCore::InstrumentingAgents::reset): * inspector/InstrumentingAgents.h: (WebCore::InstrumentingAgents::inspectorWorkerAgent): (WebCore::InstrumentingAgents::setInspectorWorkerAgent): * inspector/InspectorInstrumentation.cpp: (WebCore::InspectorInstrumentation::workerStartedImpl): (WebCore::InspectorInstrumentation::workerTerminatedImpl): (WebCore::InspectorInstrumentation::instrumentingAgentsForWorkerGlobalScope): * inspector/InspectorInstrumentation.h: (WebCore::InspectorInstrumentation::workerStarted): (WebCore::InspectorInstrumentation::workerTerminated): (WebCore::InspectorInstrumentation::instrumentingAgentsForContext): Give the Page a WorkerAgent and Instrumentation methods for Worker creation and termination. * inspector/InspectorWorkerAgent.h: Added. * inspector/InspectorWorkerAgent.cpp: Added. (WebCore::InspectorWorkerAgent::InspectorWorkerAgent): (WebCore::InspectorWorkerAgent::didCreateFrontendAndBackend): (WebCore::InspectorWorkerAgent::willDestroyFrontendAndBackend): (WebCore::InspectorWorkerAgent::enable): (WebCore::InspectorWorkerAgent::disable): (WebCore::InspectorWorkerAgent::workerStarted): (WebCore::InspectorWorkerAgent::workerTerminated): (WebCore::InspectorWorkerAgent::connectToAllWorkerInspectorProxiesForPage): (WebCore::InspectorWorkerAgent::disconnectFromAllWorkerInspectorProxies): (WebCore::InspectorWorkerAgent::connectToWorkerInspectorProxy): (WebCore::InspectorWorkerAgent::disconnectFromWorkerInspectorProxy): Handle connecting to Workers. This performs the "connectFrontend" and "disconnectFrontend" dance with each Worker's InspectorController. We only connect to workers when the Worker domain is enabled. (WebCore::InspectorWorkerAgent::sendMessageToWorker): (WebCore::InspectorWorkerAgent::sendMessageFromWorkerToFrontend): Proxying messages to individual messages happens through the WorkerInspectorProxy. That takes care of passing messages across threads for us. * workers/WorkerInspectorProxy.cpp: Added. (WebCore::WorkerInspectorProxy::allWorkerInspectorProxies): (WebCore::WorkerInspectorProxy::WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::~WorkerInspectorProxy): (WebCore::WorkerInspectorProxy::workerStarted): (WebCore::WorkerInspectorProxy::workerTerminated): (WebCore::WorkerInspectorProxy::connectToWorkerInspector): (WebCore::WorkerInspectorProxy::disconnectFromWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageToWorkerInspector): (WebCore::WorkerInspectorProxy::sendMessageFromWorkerToFrontend): * workers/WorkerInspectorProxy.h: Added. (WebCore::WorkerInspectorProxy::PageChannel::~PageChannel): (WebCore::WorkerInspectorProxy::url): (WebCore::WorkerInspectorProxy::identifier): (WebCore::WorkerInspectorProxy::scriptExecutionContext): The WorkerInspectorProxy simplifies the cross thread communication between the Page Inspector and Worker Inspector. It also provides a clean interface between the two sides. * inspector/WorkerToPageFrontendChannel.h: Added. * inspector/WorkerInspectorController.h: Added. * inspector/WorkerInspectorController.cpp: Added. (WebCore::WorkerInspectorController::WorkerInspectorController): (WebCore::WorkerInspectorController::~WorkerInspectorController): (WebCore::WorkerInspectorController::workerTerminating): (WebCore::WorkerInspectorController::connectFrontend): (WebCore::WorkerInspectorController::disconnectFrontend): (WebCore::WorkerInspectorController::dispatchMessageFromFrontend): (WebCore::WorkerInspectorController::functionCallHandler): (WebCore::WorkerInspectorController::evaluateHandler): (WebCore::WorkerInspectorController::vm): A basic InspectorController for a WorkerGlobalScope. No agents yet, they will come soon. * inspector/WorkerScriptDebugServer.h: * inspector/WorkerScriptDebugServer.cpp: (WebCore::WorkerScriptDebugServer::WorkerScriptDebugServer): (WebCore::WorkerScriptDebugServer::attachDebugger): (WebCore::WorkerScriptDebugServer::detachDebugger): (WebCore::WorkerScriptDebugServer::recompileAllJSFunctions): (WebCore::WorkerScriptDebugServer::runEventLoopWhilePaused): (WebCore::WorkerScriptDebugServer::reportException): (WebCore::WorkerScriptDebugServer::interruptAndRunTask): A basic WorkerScriptDebug server for a WorkerGlobalScope. Not really used until we implement DebuggerAgent, but needed for InspectorEnvironment. * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): * workers/WorkerGlobalScope.h: (WebCore::WorkerGlobalScope::inspectorController): Give the WorkerGlobalScope an InspectorController. * workers/WorkerThread.cpp: (WebCore::WorkerThread::stop): Ensure the Worker InspectorController is immediately on the WorkerThread when it is about to be closed. * workers/WorkerMessagingProxy.cpp: (WebCore::WorkerMessagingProxy::WorkerMessagingProxy): (WebCore::WorkerMessagingProxy::startWorkerGlobalScope): (WebCore::WorkerMessagingProxy::postMessageToPageInspector): (WebCore::WorkerMessagingProxy::workerGlobalScopeDestroyedInternal): (WebCore::WorkerMessagingProxy::terminateWorkerGlobalScope): * workers/WorkerMessagingProxy.h: * workers/WorkerReportingProxy.h: Call into the WorkerInspectorProxy for any inspector related logic, such as creation, termination, and messages received from the Worker. Source/WebInspectorUI: * UserInterface/Main.html: * UserInterface/Test.html: New files. * UserInterface/Base/Main.js: (WebInspector.loaded): * UserInterface/Test/Test.js: (WebInspector.loaded): New Observers and Managers. * UserInterface/Protocol/WorkerObserver.js: Added. (WebInspector.WorkerObserver.prototype.workerCreated): (WebInspector.WorkerObserver.prototype.workerTerminated): (WebInspector.WorkerObserver.prototype.dispatchMessageFromWorker): (WebInspector.WorkerObserver): * UserInterface/Controllers/WorkerManager.js: Added. (WebInspector.WorkerManager): (WebInspector.WorkerManager.prototype.workerCreated): (WebInspector.WorkerManager.prototype.workerTerminated): (WebInspector.WorkerManager.prototype.dispatchMessageFromWorker): To be implemented with the first Worker agent implementation when there is actually something we can do with the Worker. LayoutTests: * inspector/worker/resources/worker-1.js: Added. * inspector/worker/resources/worker-2.js: Added. * inspector/worker/resources/worker-3.js: Added. * inspector/worker/worker-create-and-terminate-expected.txt: Added. * inspector/worker/worker-create-and-terminate.html: Added. Tests for the new Worker domain events. The rest of the Worker domain will be tested as soon as we add the first Agent in Workers. Canonical link: https://commits.webkit.org/181796@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@208008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-10-27 22:18:55 +00:00
WebCore::reportException(exec, exception);
}
} // namespace WebCore