<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[225244] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/225244">225244</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2017-11-28 15:45:01 -0800 (Tue, 28 Nov 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>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.

Source/WebInspectorUI:

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.

Source/WebInspectorUI/../../LayoutTests:

* inspector/unit-tests/target-manager-expected.txt:
* inspector/unit-tests/target-manager.html:
Generalize.

Source/WebInspectorUI/../JavaScriptCore:

* inspector/protocol/Network.json:
Expose the NetworkAgent for a Service Worker inspector.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectorunitteststargetmanagerexpectedtxt">trunk/LayoutTests/inspector/unit-tests/target-manager-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorunitteststargetmanagerhtml">trunk/LayoutTests/inspector/unit-tests/target-manager.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolNetworkjson">trunk/Source/JavaScriptCore/inspector/protocol/Network.json</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseMainjs">trunk/Source/WebInspectorUI/UserInterface/Base/Main.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersDebuggerManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersFrameResourceManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersTargetManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsResourcejs">trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolConnectionjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/Connection.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolMainTargetjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolTargetjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTestTestjs">trunk/Source/WebInspectorUI/UserInterface/Test/Test.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsNetworkTabContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsNetworkTableContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsResourceContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsResourceSidebarPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsScriptTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsWorkerTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/LayoutTests/ChangeLog 2017-11-28 23:45:01 UTC (rev 225244)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2017-11-28  Joseph Pecoraro  <pecoraro@apple.com>
+
+        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.
+
</ins><span class="cx"> 2017-11-28  Ryan Haddad  <ryanhaddad@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Rebaseline fast/forms/alternative-presentation-button/replacement.html for El Capitan.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorunitteststargetmanagerexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/unit-tests/target-manager-expected.txt (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -7,7 +7,7 @@
</span><span class="cx"> PASS: Target list should always contain the main target.
</span><span class="cx"> PASS: Main target should have an ExecutionContext.
</span><span class="cx"> PASS: Main target should have the global RuntimeAgent.
</span><del>-Target - Main - Page
</del><ins>+Target - Symbol(page) - Page
</ins><span class="cx"> 
</span><span class="cx"> -- Running test case: TargetManager.WorkerTarget.Create
</span><span class="cx"> PASS: Added Target should have Worker type.
</span><span class="lines">@@ -14,10 +14,10 @@
</span><span class="cx"> PASS: Added Target should have an ExecutionContext.
</span><span class="cx"> PASS: Added Target should have a RuntimeAgent.
</span><span class="cx"> PASS: Added Target RuntimeAgent should not be the global RuntimeAgent.
</span><del>-Target - Main - Page
-Target - Worker - worker-1.js
</del><ins>+Target - Symbol(page) - Page
+Target - Symbol(worker) - worker-1.js
</ins><span class="cx"> 
</span><span class="cx"> -- Running test case: TargetManager.WorkerTarget.Remove
</span><span class="cx"> PASS: Removed Target should have Worker type.
</span><del>-Target - Main - Page
</del><ins>+Target - Symbol(page) - Page
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorunitteststargetmanagerhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/unit-tests/target-manager.html (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -15,23 +15,11 @@
</span><span class="cx"> 
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>-    function typeString(type) {
-        switch (type) {
-        case WI.Target.Type.Main:
-            return "Main";
-        case WI.Target.Type.Worker:
-            return "Worker";
-        default:
-            return "Unknown";
-        }
-    }
-
</del><span class="cx">     function dumpTargets() {
</span><span class="cx">         for (let target of WI.targets)
</span><del>-            InspectorTest.log(`Target - ${typeString(target.type)} - ${target.displayName}`);
</del><ins>+            InspectorTest.log(`Target - ${String(target.type)} - ${target.displayName}`);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-
</del><span class="cx">     let suite = InspectorTest.createAsyncSuite("TargetManager");
</span><span class="cx"> 
</span><span class="cx">     suite.addTestCase({
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/JavaScriptCore/ChangeLog       2017-11-28 23:45:01 UTC (rev 225244)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-11-28  Joseph Pecoraro  <pecoraro@apple.com>
+
+        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.
+
</ins><span class="cx">  2017-11-28  Brian Burg  <bburg@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [Cocoa] Clean up names of conversion methods after renaming InspectorValue to JSON::Value
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolNetworkjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Network.json (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Network.json      2017-11-28 23:34:07 UTC (rev 225243)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Network.json 2017-11-28 23:45:01 UTC (rev 225244)
</span><span class="lines">@@ -1,7 +1,7 @@
</span><span class="cx"> {
</span><span class="cx">     "domain": "Network",
</span><span class="cx">     "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.",
</span><del>-    "availability": ["web"],
</del><ins>+    "availability": ["web", "service-worker"],
</ins><span class="cx">     "types": [
</span><span class="cx">         {
</span><span class="cx">             "id": "LoaderId",
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,117 @@
</span><ins>+2017-11-28  Joseph Pecoraro  <pecoraro@apple.com>
+
+        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.
+
</ins><span class="cx"> 2017-11-27  Nikita Vasilyev  <nvasilyev@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Styles Redesign: selector's field shadow is clipped at the bottom
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -571,7 +571,6 @@
</span><span class="cx"> localizedStrings["MIME Type"] = "MIME Type";
</span><span class="cx"> localizedStrings["MIME Type:"] = "MIME Type:";
</span><span class="cx"> localizedStrings["Main"] = "Main";
</span><del>-localizedStrings["Main Frame"] = "Main Frame";
</del><span class="cx"> localizedStrings["Manifest URL"] = "Manifest URL";
</span><span class="cx"> localizedStrings["Margin"] = "Margin";
</span><span class="cx"> localizedStrings["Mass"] = "Mass";
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseMainjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -90,9 +90,11 @@
</span><span class="cx"> 
</span><span class="cx">     // Main backend target.
</span><span class="cx">     WI.mainTarget = new WI.MainTarget;
</span><ins>+    WI.pageTarget = WI.sharedApp.debuggableType === WI.DebuggableType.Web ? WI.mainTarget : null;
</ins><span class="cx"> 
</span><span class="cx">     // Enable agents.
</span><del>-    InspectorAgent.enable();
</del><ins>+    if (window.InspectorAgent)
+        InspectorAgent.enable();
</ins><span class="cx"> 
</span><span class="cx">     // Perform one-time tasks.
</span><span class="cx">     WI.CSSCompletions.requestCSSCompletions();
</span><span class="lines">@@ -135,7 +137,7 @@
</span><span class="cx">     // Tell the backend we are initialized after all our initialization messages have been sent.
</span><span class="cx">     setTimeout(function() {
</span><span class="cx">         // COMPATIBILITY (iOS 8): Inspector.initialized did not exist yet.
</span><del>-        if (InspectorAgent.initialized)
</del><ins>+        if (window.InspectorAgent && InspectorAgent.initialized)
</ins><span class="cx">             InspectorAgent.initialized();
</span><span class="cx">     }, 0);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersDebuggerManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -710,7 +710,7 @@
</span><span class="cx"> 
</span><span class="cx">         targetData.addScript(script);
</span><span class="cx"> 
</span><del>-        if (target !== WI.mainTarget && !target.mainResource) {
</del><ins>+        if (!target.mainResource && (target !== WI.mainResource || WI.sharedApp.debuggableType === WI.DebuggableType.ServiceWorker)) {
</ins><span class="cx">             // FIXME: <https://webkit.org/b/164427> Web Inspector: WorkerTarget's mainResource should be a Resource not a Script
</span><span class="cx">             // We make the main resource of a WorkerTarget the Script instead of the Resource
</span><span class="cx">             // because the frontend may not be informed of the Resource. We should guarantee
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersFrameResourceManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -42,6 +42,9 @@
</span><span class="cx">             PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this));
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        if (window.ServiceWorkerAgent)
+            ServiceWorkerAgent.getInitializationInfo(this._processServiceWorkerInitializationInfo.bind(this));
+
</ins><span class="cx">         if (window.NetworkAgent)
</span><span class="cx">             NetworkAgent.enable();
</span><span class="cx"> 
</span><span class="lines">@@ -504,16 +507,25 @@
</span><span class="cx"> 
</span><span class="cx">         let resource = null;
</span><span class="cx"> 
</span><ins>+        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;
+        }
+
</ins><span class="cx">         let frame = this.frameForIdentifier(frameIdentifier);
</span><span class="cx">         if (frame) {
</span><span class="cx">             // This is a new request for an existing frame, which might be the main resource or a new resource.
</span><del>-            if (type === PageAgent.ResourceType.Document && frame.mainResource.url === url && frame.loaderIdentifier === loaderIdentifier)
</del><ins>+            if (type === "Document" && frame.mainResource.url === url && frame.loaderIdentifier === loaderIdentifier)
</ins><span class="cx">                 resource = frame.mainResource;
</span><del>-            else if (type === PageAgent.ResourceType.Document && frame.provisionalMainResource && frame.provisionalMainResource.url === url && frame.provisionalLoaderIdentifier === loaderIdentifier)
</del><ins>+            else if (type === "Document" && frame.provisionalMainResource && frame.provisionalMainResource.url === url && frame.provisionalLoaderIdentifier === loaderIdentifier)
</ins><span class="cx">                 resource = frame.provisionalMainResource;
</span><span class="cx">             else {
</span><span class="cx">                 resource = new WI.Resource(url, null, type, loaderIdentifier, targetId, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, walltime, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);
</span><del>-                if (resource.target === WI.mainTarget)
</del><ins>+                if (resource.target === WI.pageTarget)
</ins><span class="cx">                     this._addResourceToFrame(frame, resource);
</span><span class="cx">                 else if (resource.target)
</span><span class="cx">                     resource.target.addResource(resource);
</span><span class="lines">@@ -565,7 +577,7 @@
</span><span class="cx"> 
</span><span class="cx">     _addResourceToTarget(target, resource)
</span><span class="cx">     {
</span><del>-        console.assert(target !== WI.mainTarget);
</del><ins>+        console.assert(target !== WI.pageTarget);
</ins><span class="cx">         console.assert(resource);
</span><span class="cx"> 
</span><span class="cx">         target.addResource(resource);
</span><span class="lines">@@ -616,10 +628,26 @@
</span><span class="cx">         return sourceCode.createSourceCodeLocation(lineNumber, columnNumber);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    _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;
+    }
+
</ins><span class="cx">     _processMainFrameResourceTreePayload(error, mainFramePayload)
</span><span class="cx">     {
</span><span class="cx">         console.assert(this._waitingForMainFrameResourceTreePayload);
</span><del>-        delete this._waitingForMainFrameResourceTreePayload;
</del><ins>+        this._waitingForMainFrameResourceTreePayload = false;
</ins><span class="cx"> 
</span><span class="cx">         if (error) {
</span><span class="cx">             console.error(JSON.stringify(error));
</span><span class="lines">@@ -679,11 +707,11 @@
</span><span class="cx">             // The main resource is included as a resource. We can skip it since we already created
</span><span class="cx">             // a main resource when we created the Frame. The resource payload does not include anything
</span><span class="cx">             // didn't already get from the frame payload.
</span><del>-            if (resourcePayload.type === PageAgent.ResourceType.Document && resourcePayload.url === payload.frame.url)
</del><ins>+            if (resourcePayload.type === "Document" && resourcePayload.url === payload.frame.url)
</ins><span class="cx">                 continue;
</span><span class="cx"> 
</span><span class="cx">             var resource = this._createResource(resourcePayload, payload);
</span><del>-            if (resource.target === WI.mainTarget)
</del><ins>+            if (resource.target === WI.pageTarget)
</ins><span class="cx">                 frame.addResource(resource);
</span><span class="cx">             else if (resource.target)
</span><span class="cx">                 resource.target.addResource(resource);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersTargetManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TargetManager.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -46,6 +46,9 @@
</span><span class="cx">         if (!targetId)
</span><span class="cx">             return null;
</span><span class="cx"> 
</span><ins>+        if (targetId === WI.mainTarget.identifier)
+            return WI.mainTarget;
+
</ins><span class="cx">         for (let target of this._targets) {
</span><span class="cx">             if (target.identifier === targetId)
</span><span class="cx">                 return target;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsResourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">         this._urlComponents = null;
</span><span class="cx">         this._mimeType = mimeType;
</span><span class="cx">         this._mimeTypeComponents = null;
</span><del>-        this._type = type || WI.Resource.typeFromMIMEType(mimeType);
</del><ins>+        this._type = Resource.resolvedType(type, mimeType);
</ins><span class="cx">         this._loaderIdentifier = loaderIdentifier || null;
</span><span class="cx">         this._requestIdentifier = requestIdentifier || null;
</span><span class="cx">         this._queryStringParameters = undefined;
</span><span class="lines">@@ -95,6 +95,14 @@
</span><span class="cx"> 
</span><span class="cx">     // Static
</span><span class="cx"> 
</span><ins>+    static resolvedType(type, mimeType)
+    {
+        if (type && type !== WI.Resource.Type.Other)
+            return type;
+
+        return Resource.typeFromMIMEType(mimeType);
+    }
+
</ins><span class="cx">     static typeFromMIMEType(mimeType)
</span><span class="cx">     {
</span><span class="cx">         if (!mimeType)
</span><span class="lines">@@ -710,7 +718,7 @@
</span><span class="cx">             this._url = url;
</span><span class="cx"> 
</span><span class="cx">         this._mimeType = mimeType;
</span><del>-        this._type = type || WI.Resource.typeFromMIMEType(mimeType);
</del><ins>+        this._type = Resource.resolvedType(type, mimeType);
</ins><span class="cx">         this._statusCode = statusCode;
</span><span class="cx">         this._statusText = statusText;
</span><span class="cx">         this._responseHeaders = responseHeaders || {};
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolConnectionjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/Connection.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -272,7 +272,7 @@
</span><span class="cx">     }
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-InspectorBackend.MainConnection = class InspectorBackendPageConnection extends InspectorBackend.Connection
</del><ins>+InspectorBackend.MainConnection = class InspectorBackendMainConnection extends InspectorBackend.Connection
</ins><span class="cx"> {
</span><span class="cx">     constructor()
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolMainTargetjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/MainTarget.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -27,32 +27,56 @@
</span><span class="cx"> {
</span><span class="cx">     constructor(connection)
</span><span class="cx">     {
</span><del>-        super("main", "", WI.Target.Type.Main, InspectorBackend.mainConnection);
</del><ins>+        let {type, displayName} = MainTarget.mainConnectionInfo();
</ins><span class="cx"> 
</span><del>-        let displayName = WI.sharedApp.debuggableType === WI.DebuggableType.Web ? WI.UIString("Main Frame") : this.displayName;
</del><ins>+        super("main", displayName, type, InspectorBackend.mainConnection);
+
</ins><span class="cx">         this._executionContext = new WI.ExecutionContext(this, WI.RuntimeManager.TopLevelContextExecutionIdentifier, displayName, true, null);
</span><ins>+        this._mainResource = null;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    // Protected (Target)
</del><ins>+    // Static
</ins><span class="cx"> 
</span><del>-    get displayName()
</del><ins>+    static mainConnectionInfo()
</ins><span class="cx">     {
</span><span class="cx">         switch (WI.sharedApp.debuggableType) {
</span><span class="cx">         case WI.DebuggableType.JavaScript:
</span><del>-            return WI.UIString("JavaScript Context");
</del><ins>+            return {
+                type: WI.Target.Type.JSContext,
+                displayName: WI.UIString("JavaScript Context"),
+            };
</ins><span class="cx">         case WI.DebuggableType.ServiceWorker:
</span><del>-            return WI.UIString("ServiceWorker");
</del><ins>+            return {
+                type: WI.Target.Type.ServiceWorker,
+                displayName: WI.UIString("ServiceWorker"),
+            };
</ins><span class="cx">         case WI.DebuggableType.Web:
</span><del>-            return WI.UIString("Page");
</del><ins>+            return {
+                type: WI.Target.Type.Page,
+                displayName: WI.UIString("Page"),
+            };
</ins><span class="cx">         default:
</span><span class="cx">             console.error("Unexpected debuggable type: ", WI.sharedApp.debuggableType);
</span><del>-            return WI.UIString("Main");
</del><ins>+            return {
+                type: WI.Target.Type.Page,
+                displayName: WI.UIString("Main"),
+            };
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // Protected (Target)
+
</ins><span class="cx">     get mainResource()
</span><span class="cx">     {
</span><ins>+        if (this._mainResource)
+            return this._mainResource;
+
</ins><span class="cx">         let mainFrame = WI.frameResourceManager.mainFrame;
</span><span class="cx">         return mainFrame ? mainFrame.mainResource : null;
</span><span class="cx">     }
</span><ins>+
+    set mainResource(resource)
+    {
+        this._mainResource = resource;
+    }
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolTargetjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/Target.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -51,7 +51,14 @@
</span><span class="cx">     // Public
</span><span class="cx"> 
</span><span class="cx">     get identifier() { return this._identifier; }
</span><ins>+    set identifier(identifier) { this._identifier = identifier; }
+
</ins><span class="cx">     get name() { return this._name; }
</span><ins>+    set name(name) { this._name = name; }
+
+    get mainResource() { return this._mainResource; }
+    set mainResource(resource) { this._mainResource = resource; }
+
</ins><span class="cx">     get type() { return this._type; }
</span><span class="cx">     get connection() { return this._connection; }
</span><span class="cx">     get executionContext() { return this._executionContext; }
</span><span class="lines">@@ -59,8 +66,7 @@
</span><span class="cx">     get resourceCollection() { return this._resourceCollection; }
</span><span class="cx">     get extraScriptCollection() { return this._extraScriptCollection; }
</span><span class="cx"> 
</span><del>-    get mainResource() { return this._mainResource; }
-    set mainResource(resource) { this._mainResource = resource; }
</del><ins>+    get displayName() { return this._name; }
</ins><span class="cx"> 
</span><span class="cx">     addResource(resource)
</span><span class="cx">     {
</span><span class="lines">@@ -85,7 +91,9 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WI.Target.Type = {
</span><del>-    Main: Symbol("main"),
</del><ins>+    Page: Symbol("page"),
+    JSContext: Symbol("jscontext"),
+    ServiceWorker: Symbol("service-worker"),
</ins><span class="cx">     Worker: Symbol("worker"),
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTestTestjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Test/Test.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx">     InspectorBackend.registerCanvasDispatcher(new WI.CanvasObserver);
</span><span class="cx"> 
</span><span class="cx">     WI.mainTarget = new WI.MainTarget;
</span><ins>+    WI.pageTarget = WI.sharedApp.debuggableType === WI.DebuggableType.Web ? WI.mainTarget : null;
</ins><span class="cx"> 
</span><span class="cx">     // Instantiate controllers used by tests.
</span><span class="cx">     this.targetManager = new WI.TargetManager;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsNetworkTabContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx"> 
</span><span class="cx">     static isTabAllowed()
</span><span class="cx">     {
</span><del>-        return !!window.NetworkAgent && !!window.PageAgent;
</del><ins>+        return !!window.NetworkAgent;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Protected
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsNetworkTableContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -273,7 +273,7 @@
</span><span class="cx">             this._hideResourceDetailView();
</span><span class="cx">             return;
</span><span class="cx">         }
</span><del>-   
</del><ins>+
</ins><span class="cx">         this._table.selectRow(rowIndex);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -860,9 +860,7 @@
</span><span class="cx"> 
</span><span class="cx">         this._needsInitialPopulate = false;
</span><span class="cx"> 
</span><del>-        console.assert(WI.frameResourceManager.mainFrame);
-
-        let populateFrameResources = (frame) => {
</del><ins>+        let populateResourcesForFrame = (frame) => {
</ins><span class="cx">             if (frame.provisionalMainResource)
</span><span class="cx">                 this._pendingInsertions.push(frame.provisionalMainResource);
</span><span class="cx">             else if (frame.mainResource)
</span><span class="lines">@@ -872,11 +870,23 @@
</span><span class="cx">                 this._pendingInsertions.push(resource);
</span><span class="cx"> 
</span><span class="cx">             for (let childFrame of frame.childFrameCollection.items)
</span><del>-                populateFrameResources(childFrame);
</del><ins>+                populateResourcesForFrame(childFrame);
</ins><span class="cx">         };
</span><span class="cx"> 
</span><del>-        populateFrameResources(WI.frameResourceManager.mainFrame);
</del><ins>+        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);
+        };
</ins><span class="cx"> 
</span><ins>+        for (let target of WI.targets) {
+            if (target === WI.pageTarget)
+                populateResourcesForFrame(WI.frameResourceManager.mainFrame);
+            else
+                populateResourcesForTarget(target);
+        }
+
</ins><span class="cx">         this.needsLayout();
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsResourceContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx"> 
</span><span class="cx">     contentAvailable(content, base64Encoded)
</span><span class="cx">     {
</span><del>-        // Implemented by subclasses.
</del><ins>+        throw WI.NotImplementedError.subclassMustOverride();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     showGenericErrorMessage()
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsResourceSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -310,10 +310,11 @@
</span><span class="cx">         if (!script.url && !script.sourceURL)
</span><span class="cx">             return;
</span><span class="cx"> 
</span><del>-        // Worker script.
-        if (script.target !== WI.mainTarget) {
</del><ins>+        // Target main resource.
+        if (script.target !== WI.pageTarget) {
</ins><span class="cx">             if (script.isMainResource())
</span><span class="cx">                 this._addTargetWithMainResource(script.target);
</span><ins>+            this.contentTreeOutline.disclosureButtons = true;
</ins><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="lines">@@ -431,7 +432,7 @@
</span><span class="cx"> 
</span><span class="cx">     _addTargetWithMainResource(target)
</span><span class="cx">     {
</span><del>-        console.assert(target.type === WI.Target.Type.Worker);
</del><ins>+        console.assert(target.type === WI.Target.Type.Worker || target.type === WI.Target.Type.ServiceWorker);
</ins><span class="cx"> 
</span><span class="cx">         let targetTreeElement = new WI.WorkerTreeElement(target);
</span><span class="cx">         this._targetTreeElementMap.set(target, targetTreeElement);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsScriptTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx">             this.addClassName(WI.ScriptTreeElement.AnonymousScriptIconStyleClassName);
</span><span class="cx"> 
</span><span class="cx">         if (script.isMainResource()) {
</span><del>-            console.assert(script.target.type === WI.Target.Type.Worker);
</del><ins>+            console.assert(script.target.type === WI.Target.Type.Worker || script.target.type === WI.Target.Type.ServiceWorker, script.target.type);
</ins><span class="cx">             this.addClassName("worker-icon");
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsWorkerTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/WorkerTreeElement.js (225243 => 225244)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx">         super(target.mainResource);
</span><span class="cx"> 
</span><span class="cx">         console.assert(target instanceof WI.Target);
</span><del>-        console.assert(target.type === WI.Target.Type.Worker);
</del><ins>+        console.assert(target.type === WI.Target.Type.Worker || target.type === WI.Target.Type.ServiceWorker);
</ins><span class="cx">         console.assert(target.mainResource instanceof WI.Script);
</span><span class="cx"> 
</span><span class="cx">         this._target = target;
</span></span></pre>
</div>
</div>

</body>
</html>