Make ServiceWorker a Remote Inspector debuggable target
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Nov 2017 01:30:01 +0000 (01:30 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Nov 2017 01:30:01 +0000 (01:30 +0000)
commit760ce8beb74cf7286cac7f0f6c3f4544ecad4416
treeb7aa167133e1435c34f169a95f8754e18c8b1ab3
parentb49b2648036f58b2b8b43daac4ab53a8f545c8e1
Make ServiceWorker a Remote Inspector debuggable target
https://bugs.webkit.org/show_bug.cgi?id=179043
<rdar://problem/34126008>

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/remote/RemoteControllableTarget.h:
* inspector/remote/RemoteInspectionTarget.h:
* inspector/remote/RemoteInspectorConstants.h:
Include a new ServiceWorker remote inspector target type.

* inspector/remote/cocoa/RemoteInspectorCocoa.mm:
(Inspector::RemoteInspector::listingForInspectionTarget const):
Implement listing for a ServiceWorker to include a URL like a page.

* inspector/remote/glib/RemoteInspectorGlib.cpp:
(Inspector::RemoteInspector::listingForInspectionTarget const):
Bail for ServiceWorker support in glib. They will need to implement their support.

Source/WebCore:

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

* workers/service/context/ServiceWorkerDebuggable.h: Added.
* workers/service/context/ServiceWorkerDebuggable.cpp: Added.
(WebCore::ServiceWorkerDebuggable::ServiceWorkerDebuggable):
(WebCore::ServiceWorkerDebuggable::connect):
(WebCore::ServiceWorkerDebuggable::disconnect):
(WebCore::ServiceWorkerDebuggable::dispatchMessageFromRemote):
ServiceWorker remote inspector target, exposes the script url to debuggers.
Pass the channel on to the inspector proxy to hook it up to the worker.

* workers/service/context/ServiceWorkerInspectorProxy.h:
* workers/service/context/ServiceWorkerInspectorProxy.cpp: Added.
(WebCore::ServiceWorkerInspectorProxy::ServiceWorkerInspectorProxy):
(WebCore::ServiceWorkerInspectorProxy::~ServiceWorkerInspectorProxy):
(WebCore::ServiceWorkerInspectorProxy::serviceWorkerTerminated):
Handle interesting events throughout a Service Worker life cycle.

(WebCore::ServiceWorkerInspectorProxy::connectToWorker):
(WebCore::ServiceWorkerInspectorProxy::disconnectFromWorker):
(WebCore::ServiceWorkerInspectorProxy::sendMessageToWorker):
(WebCore::ServiceWorkerInspectorProxy::sendMessageFromWorkerToFrontend):
Implement existing worker debugger hooks for connection setup and sending messages.
Inspector protocol messages come in on the MainThread and hop over to the
WorkerThread to be handled on the expected context thread. Likewise outgoing
messages hop back to be sent through the InspectorFrontend channel on MainThread.

* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
* workers/service/context/ServiceWorkerThread.h:
* workers/service/context/ServiceWorkerThreadProxy.h:
* workers/service/context/ServiceWorkerThreadProxy.cpp:
(WebCore::ServiceWorkerThreadProxy::ServiceWorkerThreadProxy):
(WebCore::ServiceWorkerThreadProxy::postMessageToDebugger):
Construct the new inspector proxy and debuggable registration.
Call lifecycle events and debugger hooks when appropriate.

Source/WebInspectorUI:

Customize the Web Inspector frontend for a ServiceWorker target.
Currently this just behaves like a JavaScript Context target because
we haven't yet added support for Networking capabilities.

* UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager.prototype.get knownNonResourceScripts):
Drive-by fix a bug where lazily initializing the Resources / Debugger tabs
would show Console evaluation scripts. We should ignore them, like we
do in other places.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Controllers/AppController.js:
(WI.AppController):
(WI.AppController.debuggableTypeFromHost):
* UserInterface/Controllers/AppControllerBase.js:
* UserInterface/Controllers/TimelineManager.js:
(WI.TimelineManager.defaultTimelineTypes):
(WI.TimelineManager.availableTimelineTypes):
* UserInterface/Models/TimelineRecording.js:
(WI.TimelineRecording.sourceCodeTimelinesSupported):
* UserInterface/Protocol/MainTarget.js:
(WI.MainTarget.prototype.get displayName):
* UserInterface/Test/TestAppController.js:
* UserInterface/Views/DashboardContainerView.css:
(body:not(.web) .toolbar .dashboard-container):
(body.javascript .toolbar .dashboard-container): Deleted.
* UserInterface/Views/DefaultDashboardView.css:
(body:not(.web) .toolbar .dashboard.default > :matches(.resourcesCount, .resourcesSize, .time)):
(body.javascript .toolbar .dashboard.default > :matches(.resourcesCount, .resourcesSize, .time)): Deleted.
* UserInterface/Views/ResourceSidebarPanel.js:
(WI.ResourceSidebarPanel):
(WI.ResourceSidebarPanel.shouldPlaceResourcesAtTopLevel):
(WI.ResourceSidebarPanel.prototype.initialLayout):
(WI.ResourceSidebarPanel.prototype._addScript):
(WI.ResourceSidebarPanel.prototype._extraDomainsActivated):
* UserInterface/Views/Toolbar.js:

Source/WebKit:

* UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h:
* UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm:
(debuggableTypeString):
Provide a way to start a Remote Web Inspector frontend for a ServiceWorker target type.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224368 268f45cc-cd09-0410-ab3c-d52691b4dbfc
33 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/remote/RemoteControllableTarget.h
Source/JavaScriptCore/inspector/remote/RemoteInspectionTarget.h
Source/JavaScriptCore/inspector/remote/RemoteInspectorConstants.h
Source/JavaScriptCore/inspector/remote/cocoa/RemoteInspectorCocoa.mm
Source/JavaScriptCore/inspector/remote/glib/RemoteInspectorGlib.cpp
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/workers/service/context/ServiceWorkerDebuggable.cpp [new file with mode: 0644]
Source/WebCore/workers/service/context/ServiceWorkerDebuggable.h [new file with mode: 0644]
Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.cpp [new file with mode: 0644]
Source/WebCore/workers/service/context/ServiceWorkerInspectorProxy.h [new file with mode: 0644]
Source/WebCore/workers/service/context/ServiceWorkerThread.cpp
Source/WebCore/workers/service/context/ServiceWorkerThread.h
Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.cpp
Source/WebCore/workers/service/context/ServiceWorkerThreadProxy.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Controllers/AppController.js
Source/WebInspectorUI/UserInterface/Controllers/AppControllerBase.js
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js
Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js
Source/WebInspectorUI/UserInterface/Test/TestAppController.js
Source/WebInspectorUI/UserInterface/Views/DashboardContainerView.css
Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.css
Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/Toolbar.js
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.h
Source/WebKit/UIProcess/API/Cocoa/_WKRemoteWebInspectorViewController.mm