Diff
Modified: trunk/LayoutTests/ChangeLog (225243 => 225244)
--- trunk/LayoutTests/ChangeLog 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/LayoutTests/ChangeLog 2017-11-28 23:45:01 UTC (rev 225244)
@@ -1,3 +1,15 @@
+2017-11-28 Joseph Pecoraro <[email protected]>
+
+ ServiceWorker Inspector: Frontend changes to support Network tab and sub resources
+ https://bugs.webkit.org/show_bug.cgi?id=179642
+ <rdar://problem/35517704>
+
+ Reviewed by Brian Burg.
+
+ * inspector/unit-tests/target-manager-expected.txt:
+ * inspector/unit-tests/target-manager.html:
+ Generalize.
+
2017-11-28 Ryan Haddad <[email protected]>
Rebaseline fast/forms/alternative-presentation-button/replacement.html for El Capitan.
Modified: trunk/LayoutTests/inspector/unit-tests/target-manager-expected.txt (225243 => 225244)
--- trunk/LayoutTests/inspector/unit-tests/target-manager-expected.txt 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/LayoutTests/inspector/unit-tests/target-manager-expected.txt 2017-11-28 23:45:01 UTC (rev 225244)
@@ -7,7 +7,7 @@
PASS: Target list should always contain the main target.
PASS: Main target should have an ExecutionContext.
PASS: Main target should have the global RuntimeAgent.
-Target - Main - Page
+Target - Symbol(page) - Page
-- Running test case: TargetManager.WorkerTarget.Create
PASS: Added Target should have Worker type.
@@ -14,10 +14,10 @@
PASS: Added Target should have an ExecutionContext.
PASS: Added Target should have a RuntimeAgent.
PASS: Added Target RuntimeAgent should not be the global RuntimeAgent.
-Target - Main - Page
-Target - Worker - worker-1.js
+Target - Symbol(page) - Page
+Target - Symbol(worker) - worker-1.js
-- Running test case: TargetManager.WorkerTarget.Remove
PASS: Removed Target should have Worker type.
-Target - Main - Page
+Target - Symbol(page) - Page
Modified: trunk/LayoutTests/inspector/unit-tests/target-manager.html (225243 => 225244)
--- trunk/LayoutTests/inspector/unit-tests/target-manager.html 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/LayoutTests/inspector/unit-tests/target-manager.html 2017-11-28 23:45:01 UTC (rev 225244)
@@ -15,23 +15,11 @@
function test()
{
- function typeString(type) {
- switch (type) {
- case WI.Target.Type.Main:
- return "Main";
- case WI.Target.Type.Worker:
- return "Worker";
- default:
- return "Unknown";
- }
- }
-
function dumpTargets() {
for (let target of WI.targets)
- InspectorTest.log(`Target - ${typeString(target.type)} - ${target.displayName}`);
+ InspectorTest.log(`Target - ${String(target.type)} - ${target.displayName}`);
}
-
let suite = InspectorTest.createAsyncSuite("TargetManager");
suite.addTestCase({
Modified: trunk/Source/_javascript_Core/ChangeLog (225243 => 225244)
--- trunk/Source/_javascript_Core/ChangeLog 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/_javascript_Core/ChangeLog 2017-11-28 23:45:01 UTC (rev 225244)
@@ -1,3 +1,14 @@
+2017-11-28 Joseph Pecoraro <[email protected]>
+
+ ServiceWorker Inspector: Frontend changes to support Network tab and sub resources
+ https://bugs.webkit.org/show_bug.cgi?id=179642
+ <rdar://problem/35517704>
+
+ Reviewed by Brian Burg.
+
+ * inspector/protocol/Network.json:
+ Expose the NetworkAgent for a Service Worker inspector.
+
2017-11-28 Brian Burg <[email protected]>
[Cocoa] Clean up names of conversion methods after renaming InspectorValue to JSON::Value
Modified: trunk/Source/_javascript_Core/inspector/protocol/Network.json (225243 => 225244)
--- trunk/Source/_javascript_Core/inspector/protocol/Network.json 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/_javascript_Core/inspector/protocol/Network.json 2017-11-28 23:45:01 UTC (rev 225244)
@@ -1,7 +1,7 @@
{
"domain": "Network",
"description": "Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc.",
- "availability": ["web"],
+ "availability": ["web", "service-worker"],
"types": [
{
"id": "LoaderId",
Modified: trunk/Source/WebInspectorUI/ChangeLog (225243 => 225244)
--- trunk/Source/WebInspectorUI/ChangeLog 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/ChangeLog 2017-11-28 23:45:01 UTC (rev 225244)
@@ -1,3 +1,117 @@
+2017-11-28 Joseph Pecoraro <[email protected]>
+
+ ServiceWorker Inspector: Frontend changes to support Network tab and sub resources
+ https://bugs.webkit.org/show_bug.cgi?id=179642
+ <rdar://problem/35517704>
+
+ Reviewed by Brian Burg.
+
+ This patch makes use of the NetworkAgent and ServiceWorker agents in the frontend
+ for a ServiceWorker inspection target. It also makes changes to ensure that the
+ subresources requested by a ServiceWorker appear as expected in both the Resources
+ and Network Tabs.
+
+ The backends of ServiceWorkers and DedicatedWorkers for network requests are
+ different, but we want the presentation to be very similiar. Ultimately we'd like
+ to move to more similiar backends if possible.
+
+ The first (after Inspector.enable) message a ServiceWorker inspector sends to the
+ backend is ServiceWorker.getInitializationInfo. This parallels a Page inspector
+ sending Page.getResourceTree. From the response we get enough information to
+ setup the MainTarget with enough information (targetId, URL) to know what its main
+ resource URL will be. Like DedicatedWorkers, the target's main resource will be
+ filled in with the first WI.Script matching the URL. With this initialization
+ message alone the ServiceWorker Target behaves almost identically to a Worker
+ target and Network loads associated with the target (by targetId) are added as
+ sub-resources as expected.
+
+ The biggest tension in this patch is within FrameResourceManager. The class, as
+ its name indicates, assumes page resources with Frames, navigation, and loader
+ semantics. It takes a few modifications to make it better handle resources not
+ associated with a Page. A follow-up will rename this to just ResourceManager as
+ the class' main task is now to associate Resources with Targets.
+
+ * UserInterface/Base/Main.js:
+ (WI.loaded):
+ There are assumptions in a few places that the main target is a Page. Those
+ places can now be reached when the main target is a ServiceWorker. Add a
+ convenience WI.pageTarget that can be used in these places.
+
+ * UserInterface/Test/Test.js:
+ (WI.loaded):
+ Add pageTarget.
+
+ * UserInterface/Controllers/DebuggerManager.js:
+ (WI.DebuggerManager.prototype.scriptDidParse):
+ Generalize the condition so the main target can have its main resource populated.
+ This will be the case when a ServiceWorker is the main target and its main resource
+ needs to be populated from a Script.
+
+ * UserInterface/Controllers/FrameResourceManager.js:
+ (WI.FrameResourceManager):
+ (WI.FrameResourceManager.prototype._processServiceWorkerInitializationInfo):
+ Handle ServiceWorker Resource initialization which is different from Page initialization.
+
+ (WI.FrameResourceManager.prototype._addNewResourceToFrameOrTarget):
+ (WI.FrameResourceManager.prototype._addResourceToTarget):
+ (WI.FrameResourceManager.prototype._addFrameTreeFromFrameResourceTreePayload):
+ Eliminate PageAgent, which might not be available in some targets.
+ Use pageTarget instead of mainTarget where appropriate.
+
+ * UserInterface/Controllers/TargetManager.js:
+ (WI.TargetManager.prototype.targetForIdentifier):
+ A ServiceWorker is the first time that the main target has an identifier,
+ so let TargetManager find it by target id.
+
+ * UserInterface/Models/Resource.js:
+ (WI.Resource):
+ (WI.Resource.resolvedType):
+ (WI.Resource.prototype.updateForResponse):
+ For Resource.Type.Other resources include a better type inferred from the MIME type.
+ ServiceWorker loads currently don't have type information and this provides a great
+ type for such loads. This should also provide nice types for CacheStorage.add*
+ populated resources which are otherwise type-less fetches.
+
+ * UserInterface/Protocol/Connection.js:
+ Rename the class since this may no longer be a "Page".
+
+ * UserInterface/Protocol/MainTarget.js:
+ (WI.MainTarget):
+ (WI.MainTarget.mainConnectionInfo):
+ (WI.MainTarget.prototype.get mainResource):
+ (WI.MainTarget.prototype.set mainResource):
+ (WI.MainTarget.prototype.get displayName): Deleted.
+ * UserInterface/Protocol/Target.js:
+ (WI.Target.prototype.set identifier):
+ (WI.Target.prototype.set name):
+ (WI.Target.prototype.get mainResource):
+ (WI.Target.prototype.set mainResource):
+ (WI.Target.prototype.get displayName):
+ Give richer types for the main target. And allow a few things to be initialized
+ lazily, which will be necessary from an initialization message.
+
+ * UserInterface/Views/NetworkTabContentView.js:
+ (WI.NetworkTabContentView.isTabAllowed):
+ Remove a PageAgent requirement for the Network tab. A ServiceWorker will not
+ have a PageAgent, but it will have a NetworkAgent, which should be good enough.
+
+ * UserInterface/Views/NetworkTableContentView.js:
+ (WI.NetworkTableContentView.prototype._populateWithInitialResourcesIfNeeded):
+ Initial populate should populate all subresources of all targets.
+
+ * UserInterface/Views/ResourceContentView.js:
+ (WI.ResourceContentView.prototype.contentAvailable):
+ This was getting used by ResourceType.Other without warning. Make it warn.
+
+ * UserInterface/Views/ResourceSidebarPanel.js:
+ (WI.ResourceSidebarPanel.prototype._addScript):
+ (WI.ResourceSidebarPanel.prototype._addTargetWithMainResource):
+ * UserInterface/Views/ScriptTreeElement.js:
+ (WI.ScriptTreeElement):
+ Allow WorkerTreeElements for ServiceWorker targets which may also be the main target.
+ Also when adding such a tree element, promote the resource sidebar to a full tree
+ outline, and stop hiding disclosure buttons.
+
2017-11-27 Nikita Vasilyev <[email protected]>
Web Inspector: Styles Redesign: selector's field shadow is clipped at the bottom
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -571,7 +571,6 @@
localizedStrings["MIME Type"] = "MIME Type";
localizedStrings["MIME Type:"] = "MIME Type:";
localizedStrings["Main"] = "Main";
-localizedStrings["Main Frame"] = "Main Frame";
localizedStrings["Manifest URL"] = "Manifest URL";
localizedStrings["Margin"] = "Margin";
localizedStrings["Mass"] = "Mass";
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -90,9 +90,11 @@
// Main backend target.
WI.mainTarget = new WI.MainTarget;
+ WI.pageTarget = WI.sharedApp.debuggableType === WI.DebuggableType.Web ? WI.mainTarget : null;
// Enable agents.
- InspectorAgent.enable();
+ if (window.InspectorAgent)
+ InspectorAgent.enable();
// Perform one-time tasks.
WI.CSSCompletions.requestCSSCompletions();
@@ -135,7 +137,7 @@
// Tell the backend we are initialized after all our initialization messages have been sent.
setTimeout(function() {
// COMPATIBILITY (iOS 8): Inspector.initialized did not exist yet.
- if (InspectorAgent.initialized)
+ if (window.InspectorAgent && InspectorAgent.initialized)
InspectorAgent.initialized();
}, 0);
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -710,7 +710,7 @@
targetData.addScript(script);
- if (target !== WI.mainTarget && !target.mainResource) {
+ if (!target.mainResource && (target !== WI.mainResource || WI.sharedApp.debuggableType === WI.DebuggableType.ServiceWorker)) {
// FIXME: <https://webkit.org/b/164427> Web Inspector: WorkerTarget's mainResource should be a Resource not a Script
// We make the main resource of a WorkerTarget the Script instead of the Resource
// because the frontend may not be informed of the Resource. We should guarantee
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -42,6 +42,9 @@
PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this));
}
+ if (window.ServiceWorkerAgent)
+ ServiceWorkerAgent.getInitializationInfo(this._processServiceWorkerInitializationInfo.bind(this));
+
if (window.NetworkAgent)
NetworkAgent.enable();
@@ -504,16 +507,25 @@
let resource = null;
+ if (!frameIdentifier && targetId) {
+ // This is a new resource for a ServiceWorker target.
+ console.assert(WI.sharedApp.debuggableType === WI.DebuggableType.ServiceWorker);
+ console.assert(targetId === WI.mainTarget.identifier);
+ resource = new WI.Resource(url, null, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, walltime, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);
+ resource.target.addResource(resource);
+ return resource;
+ }
+
let frame = this.frameForIdentifier(frameIdentifier);
if (frame) {
// This is a new request for an existing frame, which might be the main resource or a new resource.
- if (type === PageAgent.ResourceType.Document && frame.mainResource.url ="" url && frame.loaderIdentifier === loaderIdentifier)
+ if (type === "Document" && frame.mainResource.url ="" url && frame.loaderIdentifier === loaderIdentifier)
resource = frame.mainResource;
- else if (type === PageAgent.ResourceType.Document && frame.provisionalMainResource && frame.provisionalMainResource.url ="" url && frame.provisionalLoaderIdentifier === loaderIdentifier)
+ else if (type === "Document" && frame.provisionalMainResource && frame.provisionalMainResource.url ="" url && frame.provisionalLoaderIdentifier === loaderIdentifier)
resource = frame.provisionalMainResource;
else {
resource = new WI.Resource(url, null, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, walltime, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);
- if (resource.target === WI.mainTarget)
+ if (resource.target === WI.pageTarget)
this._addResourceToFrame(frame, resource);
else if (resource.target)
resource.target.addResource(resource);
@@ -565,7 +577,7 @@
_addResourceToTarget(target, resource)
{
- console.assert(target !== WI.mainTarget);
+ console.assert(target !== WI.pageTarget);
console.assert(resource);
target.addResource(resource);
@@ -616,10 +628,26 @@
return sourceCode.createSourceCodeLocation(lineNumber, columnNumber);
}
+ _processServiceWorkerInitializationInfo(error, initializationPayload)
+ {
+ console.assert(this._waitingForMainFrameResourceTreePayload);
+ this._waitingForMainFrameResourceTreePayload = false;
+
+ if (error) {
+ console.error(JSON.stringify(error));
+ return;
+ }
+
+ console.assert(initializationPayload.targetId.startsWith("serviceworker:"));
+
+ WI.mainTarget.identifier = initializationPayload.targetId;
+ WI.mainTarget.name = initializationPayload.url;
+ }
+
_processMainFrameResourceTreePayload(error, mainFramePayload)
{
console.assert(this._waitingForMainFrameResourceTreePayload);
- delete this._waitingForMainFrameResourceTreePayload;
+ this._waitingForMainFrameResourceTreePayload = false;
if (error) {
console.error(JSON.stringify(error));
@@ -679,11 +707,11 @@
// The main resource is included as a resource. We can skip it since we already created
// a main resource when we created the Frame. The resource payload does not include anything
// didn't already get from the frame payload.
- if (resourcePayload.type === PageAgent.ResourceType.Document && resourcePayload.url ="" payload.frame.url)
+ if (resourcePayload.type === "Document" && resourcePayload.url ="" payload.frame.url)
continue;
var resource = this._createResource(resourcePayload, payload);
- if (resource.target === WI.mainTarget)
+ if (resource.target === WI.pageTarget)
frame.addResource(resource);
else if (resource.target)
resource.target.addResource(resource);
Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -46,6 +46,9 @@
if (!targetId)
return null;
+ if (targetId === WI.mainTarget.identifier)
+ return WI.mainTarget;
+
for (let target of this._targets) {
if (target.identifier === targetId)
return target;
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -39,7 +39,7 @@
this._urlComponents = null;
this._mimeType = mimeType;
this._mimeTypeComponents = null;
- this._type = type || WI.Resource.typeFromMIMEType(mimeType);
+ this._type = Resource.resolvedType(type, mimeType);
this._loaderIdentifier = loaderIdentifier || null;
this._requestIdentifier = requestIdentifier || null;
this._queryStringParameters = undefined;
@@ -95,6 +95,14 @@
// Static
+ static resolvedType(type, mimeType)
+ {
+ if (type && type !== WI.Resource.Type.Other)
+ return type;
+
+ return Resource.typeFromMIMEType(mimeType);
+ }
+
static typeFromMIMEType(mimeType)
{
if (!mimeType)
@@ -710,7 +718,7 @@
this._url = url;
this._mimeType = mimeType;
- this._type = type || WI.Resource.typeFromMIMEType(mimeType);
+ this._type = Resource.resolvedType(type, mimeType);
this._statusCode = statusCode;
this._statusText = statusText;
this._responseHeaders = responseHeaders || {};
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/Connection.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/Connection.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/Connection.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -272,7 +272,7 @@
}
};
-InspectorBackend.MainConnection = class InspectorBackendPageConnection extends InspectorBackend.Connection
+InspectorBackend.MainConnection = class InspectorBackendMainConnection extends InspectorBackend.Connection
{
constructor()
{
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -27,32 +27,56 @@
{
constructor(connection)
{
- super("main", "", WI.Target.Type.Main, InspectorBackend.mainConnection);
+ let {type, displayName} = MainTarget.mainConnectionInfo();
- let displayName = WI.sharedApp.debuggableType === WI.DebuggableType.Web ? WI.UIString("Main Frame") : this.displayName;
+ super("main", displayName, type, InspectorBackend.mainConnection);
+
this._executionContext = new WI.ExecutionContext(this, WI.RuntimeManager.TopLevelContextExecutionIdentifier, displayName, true, null);
+ this._mainResource = null;
}
- // Protected (Target)
+ // Static
- get displayName()
+ static mainConnectionInfo()
{
switch (WI.sharedApp.debuggableType) {
case WI.DebuggableType._javascript_:
- return WI.UIString("_javascript_ Context");
+ return {
+ type: WI.Target.Type.JSContext,
+ displayName: WI.UIString("_javascript_ Context"),
+ };
case WI.DebuggableType.ServiceWorker:
- return WI.UIString("ServiceWorker");
+ return {
+ type: WI.Target.Type.ServiceWorker,
+ displayName: WI.UIString("ServiceWorker"),
+ };
case WI.DebuggableType.Web:
- return WI.UIString("Page");
+ return {
+ type: WI.Target.Type.Page,
+ displayName: WI.UIString("Page"),
+ };
default:
console.error("Unexpected debuggable type: ", WI.sharedApp.debuggableType);
- return WI.UIString("Main");
+ return {
+ type: WI.Target.Type.Page,
+ displayName: WI.UIString("Main"),
+ };
}
}
+ // Protected (Target)
+
get mainResource()
{
+ if (this._mainResource)
+ return this._mainResource;
+
let mainFrame = WI.frameResourceManager.mainFrame;
return mainFrame ? mainFrame.mainResource : null;
}
+
+ set mainResource(resource)
+ {
+ this._mainResource = resource;
+ }
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -51,7 +51,14 @@
// Public
get identifier() { return this._identifier; }
+ set identifier(identifier) { this._identifier = identifier; }
+
get name() { return this._name; }
+ set name(name) { this._name = name; }
+
+ get mainResource() { return this._mainResource; }
+ set mainResource(resource) { this._mainResource = resource; }
+
get type() { return this._type; }
get connection() { return this._connection; }
get executionContext() { return this._executionContext; }
@@ -59,8 +66,7 @@
get resourceCollection() { return this._resourceCollection; }
get extraScriptCollection() { return this._extraScriptCollection; }
- get mainResource() { return this._mainResource; }
- set mainResource(resource) { this._mainResource = resource; }
+ get displayName() { return this._name; }
addResource(resource)
{
@@ -85,7 +91,9 @@
};
WI.Target.Type = {
- Main: Symbol("main"),
+ Page: Symbol("page"),
+ JSContext: Symbol("jscontext"),
+ ServiceWorker: Symbol("service-worker"),
Worker: Symbol("worker"),
};
Modified: trunk/Source/WebInspectorUI/UserInterface/Test/Test.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Test/Test.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/Test.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -45,6 +45,7 @@
InspectorBackend.registerCanvasDispatcher(new WI.CanvasObserver);
WI.mainTarget = new WI.MainTarget;
+ WI.pageTarget = WI.sharedApp.debuggableType === WI.DebuggableType.Web ? WI.mainTarget : null;
// Instantiate controllers used by tests.
this.targetManager = new WI.TargetManager;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -58,7 +58,7 @@
static isTabAllowed()
{
- return !!window.NetworkAgent && !!window.PageAgent;
+ return !!window.NetworkAgent;
}
// Protected
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -273,7 +273,7 @@
this._hideResourceDetailView();
return;
}
-
+
this._table.selectRow(rowIndex);
}
@@ -860,9 +860,7 @@
this._needsInitialPopulate = false;
- console.assert(WI.frameResourceManager.mainFrame);
-
- let populateFrameResources = (frame) => {
+ let populateResourcesForFrame = (frame) => {
if (frame.provisionalMainResource)
this._pendingInsertions.push(frame.provisionalMainResource);
else if (frame.mainResource)
@@ -872,11 +870,23 @@
this._pendingInsertions.push(resource);
for (let childFrame of frame.childFrameCollection.items)
- populateFrameResources(childFrame);
+ populateResourcesForFrame(childFrame);
};
- populateFrameResources(WI.frameResourceManager.mainFrame);
+ let populateResourcesForTarget = (target) => {
+ if (target.mainResource instanceof WI.Resource)
+ this._pendingInsertions.push(target.mainResource);
+ for (let resource of target.resourceCollection.items)
+ this._pendingInsertions.push(resource);
+ };
+ for (let target of WI.targets) {
+ if (target === WI.pageTarget)
+ populateResourcesForFrame(WI.frameResourceManager.mainFrame);
+ else
+ populateResourcesForTarget(target);
+ }
+
this.needsLayout();
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -78,7 +78,7 @@
contentAvailable(content, base64Encoded)
{
- // Implemented by subclasses.
+ throw WI.NotImplementedError.subclassMustOverride();
}
showGenericErrorMessage()
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -310,10 +310,11 @@
if (!script.url && !script.sourceURL)
return;
- // Worker script.
- if (script.target !== WI.mainTarget) {
+ // Target main resource.
+ if (script.target !== WI.pageTarget) {
if (script.isMainResource())
this._addTargetWithMainResource(script.target);
+ this.contentTreeOutline.disclosureButtons = true;
return;
}
@@ -431,7 +432,7 @@
_addTargetWithMainResource(target)
{
- console.assert(target.type === WI.Target.Type.Worker);
+ console.assert(target.type === WI.Target.Type.Worker || target.type === WI.Target.Type.ServiceWorker);
let targetTreeElement = new WI.WorkerTreeElement(target);
this._targetTreeElementMap.set(target, targetTreeElement);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -48,7 +48,7 @@
this.addClassName(WI.ScriptTreeElement.AnonymousScriptIconStyleClassName);
if (script.isMainResource()) {
- console.assert(script.target.type === WI.Target.Type.Worker);
+ console.assert(script.target.type === WI.Target.Type.Worker || script.target.type === WI.Target.Type.ServiceWorker, script.target.type);
this.addClassName("worker-icon");
}
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js (225243 => 225244)
--- trunk/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js 2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js 2017-11-28 23:45:01 UTC (rev 225244)
@@ -33,7 +33,7 @@
super(target.mainResource);
console.assert(target instanceof WI.Target);
- console.assert(target.type === WI.Target.Type.Worker);
+ console.assert(target.type === WI.Target.Type.Worker || target.type === WI.Target.Type.ServiceWorker);
console.assert(target.mainResource instanceof WI.Script);
this._target = target;