Web Inspector: DOMDebugger: support event breakpoints in Worker contexts
authordrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Aug 2019 01:08:03 +0000 (01:08 +0000)
committerdrousso@apple.com <drousso@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 30 Aug 2019 01:08:03 +0000 (01:08 +0000)
commit6437eed4b0015158a54c6e8dcb4bce73991067ee
treea02608c81e47307afc5189768a10433c3a888db2
parent0120613c79d8f252492ada65269e3977068f95c3
Web Inspector: DOMDebugger: support event breakpoints in Worker contexts
https://bugs.webkit.org/show_bug.cgi?id=200651

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

* inspector/protocol/DOMDebugger.json:
Make the domain available in "worker" contexts as well.

Source/WebCore:

Tests: inspector/worker/dom-debugger-dom-breakpoints.html
       inspector/worker/dom-debugger-event-animation-frame-breakpoints.html
       inspector/worker/dom-debugger-event-interval-breakpoints.html
       inspector/worker/dom-debugger-event-listener-breakpoints.html
       inspector/worker/dom-debugger-event-timeout-breakpoints.html
       inspector/worker/dom-debugger-url-breakpoints.html

* inspector/agents/InspectorDOMDebuggerAgent.h:
* inspector/agents/InspectorDOMDebuggerAgent.cpp:
(WebCore::InspectorDOMDebuggerAgent::InspectorDOMDebuggerAgent):
(WebCore::InspectorDOMDebuggerAgent::enabled const):
(WebCore::InspectorDOMDebuggerAgent::enable):
(WebCore::InspectorDOMDebuggerAgent::disable):
(WebCore::InspectorDOMDebuggerAgent::debuggerWasEnabled):
(WebCore::InspectorDOMDebuggerAgent::debuggerWasDisabled):
(WebCore::InspectorDOMDebuggerAgent::setEventBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::removeEventBreakpoint):
(WebCore::InspectorDOMDebuggerAgent::~InspectorDOMDebuggerAgent): Deleted.
(WebCore::InspectorDOMDebuggerAgent::frameDocumentUpdated): Deleted.
(WebCore::InspectorDOMDebuggerAgent::willInvalidateStyleAttr): Deleted.
(WebCore::InspectorDOMDebuggerAgent::didInsertDOMNode): Deleted.
(WebCore::InspectorDOMDebuggerAgent::didRemoveDOMNode): Deleted.
(WebCore::domTypeForName): Deleted.
(WebCore::domTypeName): Deleted.
(WebCore::InspectorDOMDebuggerAgent::setDOMBreakpoint): Deleted.
(WebCore::InspectorDOMDebuggerAgent::removeDOMBreakpoint): Deleted.
(WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode): Deleted.
(WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode): Deleted.
(WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr): Deleted.
(WebCore::InspectorDOMDebuggerAgent::descriptionForDOMEvent): Deleted.
(WebCore::InspectorDOMDebuggerAgent::hasBreakpoint): Deleted.
(WebCore::InspectorDOMDebuggerAgent::updateSubtreeBreakpoints): Deleted.
(WebCore::InspectorDOMDebuggerAgent::willFireAnimationFrame): Deleted.
* inspector/agents/page/PageDOMDebuggerAgent.h: Added.
* inspector/agents/page/PageDOMDebuggerAgent.cpp: Added.
(WebCore::domTypeForName):
(WebCore::domTypeName):
(WebCore::PageDOMDebuggerAgent::PageDOMDebuggerAgent):
(WebCore::PageDOMDebuggerAgent::enabled const):
(WebCore::PageDOMDebuggerAgent::enable):
(WebCore::PageDOMDebuggerAgent::disable):
(WebCore::PageDOMDebuggerAgent::setDOMBreakpoint):
(WebCore::PageDOMDebuggerAgent::removeDOMBreakpoint):
(WebCore::PageDOMDebuggerAgent::frameDocumentUpdated):
(WebCore::PageDOMDebuggerAgent::willInsertDOMNode):
(WebCore::PageDOMDebuggerAgent::didInsertDOMNode):
(WebCore::PageDOMDebuggerAgent::willRemoveDOMNode):
(WebCore::PageDOMDebuggerAgent::didRemoveDOMNode):
(WebCore::PageDOMDebuggerAgent::willModifyDOMAttr):
(WebCore::PageDOMDebuggerAgent::willFireAnimationFrame):
(WebCore::PageDOMDebuggerAgent::willInvalidateStyleAttr):
(WebCore::PageDOMDebuggerAgent::setAnimationFrameBreakpoint):
(WebCore::PageDOMDebuggerAgent::descriptionForDOMEvent):
(WebCore::PageDOMDebuggerAgent::updateSubtreeBreakpoints):
(WebCore::PageDOMDebuggerAgent::hasBreakpoint):
* inspector/agents/worker/WorkerDOMDebuggerAgent.h: Added.
* inspector/agents/worker/WorkerDOMDebuggerAgent.cpp: Added.
(WebCore::WorkerDOMDebuggerAgent::WorkerDOMDebuggerAgent):
(WebCore::WorkerDOMDebuggerAgent::setDOMBreakpoint):
(WebCore::WorkerDOMDebuggerAgent::removeDOMBreakpoint):
(WebCore::WorkerDOMDebuggerAgent::setAnimationFrameBreakpoint):
Split the `InspectorDOMDebuggerAgent` into two subclasses depending on the inspected target
type, as certain `DOMDebugger` commands don't make sense for a `Worker` context:
 - DOM breakpoints, as there is no DOM in a `Worker` context
 - animation frame event breakpoints, as there is no `requestAnimationFrame` function

* inspector/InspectorController.cpp:
(WebCore::InspectorController::createLazyAgents):
* inspector/WorkerInspectorController.cpp:
(WebCore::WorkerInspectorController::createLazyAgents):

* inspector/InstrumentingAgents.h:
(WebCore::InstrumentingAgents::pageDOMDebuggerAgent const): Added.
(WebCore::InstrumentingAgents::setPageDOMDebuggerAgent): Added.
* inspector/InstrumentingAgents.cpp:
(WebCore::InstrumentingAgents::reset):

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willInsertDOMNodeImpl):
(WebCore::InspectorInstrumentation::didInsertDOMNodeImpl):
(WebCore::InspectorInstrumentation::willRemoveDOMNodeImpl):
(WebCore::InspectorInstrumentation::didRemoveDOMNodeImpl):
(WebCore::InspectorInstrumentation::willModifyDOMAttrImpl):
(WebCore::InspectorInstrumentation::willInvalidateStyleAttrImpl):
(WebCore::InspectorInstrumentation::frameDocumentUpdatedImpl):
(WebCore::InspectorInstrumentation::willFireAnimationFrameImpl):

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

Source/WebInspectorUI:

* UserInterface/Controllers/DOMDebuggerManager.js:
(WI.DOMDebuggerManager.prototype._updateDOMBreakpoint):
(WI.DOMDebuggerManager.prototype._updateEventBreakpoint):
Add assertions when adding/removing DOM breakpoints or animation frame event breakpoints if
the target is a `WI.WorkerTarget`, as neither are supported by `Worker`s.

LayoutTests:

* inspector/worker/dom-debugger-dom-breakpoints.html: Added.
* inspector/worker/dom-debugger-dom-breakpoints-expected.txt: Added.
* inspector/worker/dom-debugger-event-animation-frame-breakpoints.html: Added.
* inspector/worker/dom-debugger-event-animation-frame-breakpoints-expected.txt: Added.
* inspector/worker/dom-debugger-event-interval-breakpoints.html: Added.
* inspector/worker/dom-debugger-event-interval-breakpoints-expected.txt: Added.
* inspector/worker/dom-debugger-event-listener-breakpoints.html: Added.
* inspector/worker/dom-debugger-event-listener-breakpoints-expected.txt: Added.
* inspector/worker/dom-debugger-event-timeout-breakpoints.html: Added.
* inspector/worker/dom-debugger-event-timeout-breakpoints-expected.txt: Added.
* inspector/worker/dom-debugger-url-breakpoints.html: Added.
* inspector/worker/dom-debugger-url-breakpoints-expected.txt: Added.

* inspector/debugger/resources/log-active-stack-trace.js: Added.
(TestPage.registerInitializer.window.logStackTrace): Added.
(TestPage.registerInitializer.window.logActiveStackTrace):

* inspector/worker/resources/dom-debugger-utilities.js: Added.
(TestPage.registerInitializer.InspectorTest.Worker.DOMDebugger.createWorkerTarget):
* inspector/worker/resources/worker-dom-debugger.js: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@249305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
34 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/debugger/resources/log-active-stack-trace.js
LayoutTests/inspector/worker/dom-debugger-dom-breakpoints-expected.txt [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-dom-breakpoints.html [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-event-animation-frame-breakpoints-expected.txt [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-event-animation-frame-breakpoints.html [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-event-interval-breakpoints-expected.txt [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-event-interval-breakpoints.html [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-event-listener-breakpoints-expected.txt [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-event-listener-breakpoints.html [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-event-timeout-breakpoints-expected.txt [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-event-timeout-breakpoints.html [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-url-breakpoints-expected.txt [new file with mode: 0644]
LayoutTests/inspector/worker/dom-debugger-url-breakpoints.html [new file with mode: 0644]
LayoutTests/inspector/worker/resources/dom-debugger-utilities.js [new file with mode: 0644]
LayoutTests/inspector/worker/resources/worker-dom-debugger.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/DOMDebugger.json
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/inspector/InspectorController.cpp
Source/WebCore/inspector/InspectorInstrumentation.cpp
Source/WebCore/inspector/InstrumentingAgents.cpp
Source/WebCore/inspector/InstrumentingAgents.h
Source/WebCore/inspector/WorkerInspectorController.cpp
Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.cpp
Source/WebCore/inspector/agents/InspectorDOMDebuggerAgent.h
Source/WebCore/inspector/agents/page/PageDOMDebuggerAgent.cpp [new file with mode: 0644]
Source/WebCore/inspector/agents/page/PageDOMDebuggerAgent.h [new file with mode: 0644]
Source/WebCore/inspector/agents/worker/WorkerDOMDebuggerAgent.cpp [new file with mode: 0644]
Source/WebCore/inspector/agents/worker/WorkerDOMDebuggerAgent.h [new file with mode: 0644]
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js