ServiceWorker Inspector: Various issues inspecting service worker on mobile.twitter.com
authorjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Dec 2017 23:03:58 +0000 (23:03 +0000)
committerjoepeck@webkit.org <joepeck@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Dec 2017 23:03:58 +0000 (23:03 +0000)
commitfb3db58729f9f8bf0cfe543056981f2ee5a4c95d
tree9b9270e6b0b6bdb90258aeb71d019e2d1f6025a6
parentd08d2557a46e993576a0b1d80237078da638b72d
ServiceWorker Inspector: Various issues inspecting service worker on mobile.twitter.com
https://bugs.webkit.org/show_bug.cgi?id=180520
<rdar://problem/35900764>

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/ServiceWorker.json:
Include content script content in the initialization info.

Source/WebCore:

* inspector/agents/worker/ServiceWorkerAgent.cpp:
(WebCore::ServiceWorkerAgent::getInitializationInfo):
* inspector/agents/worker/ServiceWorkerAgent.h:
Add initial script content to initialization so we always at least have main resource content.

Source/WebInspectorUI:

* UserInterface/Main.html:
* UserInterface/Test.html:
New files.

* UserInterface/Controllers/SourceMapManager.js:
(WI.SourceMapManager.prototype._loadAndParseSourceMap):
* UserInterface/Models/SourceMapResource.js:
(WI.SourceMapResource.prototype.requestContentFromBackend):
A ServiceWorker inspector doesn't have a main frame, fall back to an
empty frameIdentifier, it is ignored by the Service Worker network agent.

* UserInterface/Base/Main.js:
Handle a Service Worker inspector where there is no frame. This can
search the main resource's resource collection.

* UserInterface/Controllers/DebuggerManager.js:
(WI.DebuggerManager.prototype.scriptDidParse):

* UserInterface/Controllers/FrameResourceManager.js:
(WI.FrameResourceManager.prototype.resourceRequestDidFailLoading):
In Service Workers the resources won't have a parent frame.

(WI.FrameResourceManager.prototype._addNewResourceToFrameOrTarget):
(WI.FrameResourceManager.prototype._processServiceWorkerInitializationInfo):
In service worker initialization fallback to using the script content
as the main resource if we didn't get a Script that actually includes it.

* UserInterface/Models/LocalScript.js:
(WI.LocalScript):
(WI.LocalScript.prototype.requestContentFromBackend):
A way to create a local Script with content.

* UserInterface/Views/SourceCodeTextEditor.js:
(WI.SourceCodeTextEditor.prototype.get _supportsDebugging):
Disallow breakpoints in a LocalScript since we have no way to tell the
backend where to set breakpoints.

* UserInterface/Models/TextRange.js:
(WI.TextRange.fromText):
Add a way to get a TextRange from static text.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225709 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/protocol/ServiceWorker.json
Source/WebCore/ChangeLog
Source/WebCore/inspector/agents/worker/ServiceWorkerAgent.cpp
Source/WebCore/inspector/agents/worker/ServiceWorkerAgent.h
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js
Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js
Source/WebInspectorUI/UserInterface/Main.html
Source/WebInspectorUI/UserInterface/Models/LocalScript.js [new file with mode: 0644]
Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js
Source/WebInspectorUI/UserInterface/Models/TextRange.js
Source/WebInspectorUI/UserInterface/Test.html
Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js