<!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>[194506] trunk/Source/WebInspectorUI</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/194506">194506</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-02 16:39:41 -0800 (Sat, 02 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: List all resources that are initiated by the selected resource in the Network tab
https://bugs.webkit.org/show_bug.cgi?id=152647

Patch by Devin Rousso &lt;dcrousso+webkit@gmail.com&gt; on 2016-01-02
Reviewed by Timothy Hatcher.

Selecting resources in the Network tab will now display a list of all resources
that the selected resource loaded, allowing for easier understanding of the
relationship between all the resources loaded on a page.

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Base/Main.js:
Added functions to generate link(s) to Resource instead of SourceCodeLocation.

* UserInterface/Models/Resource.js:
(WebInspector.Resource):
(WebInspector.Resource.prototype.get initiatedResources):
(WebInspector.Resource.prototype.addInitiatedResource):
Each time a resource is added, if it has an initiator, it adds itself to the
initiator's list of initiated resources.

* UserInterface/Views/Main.css:
(.resource-list &gt; .resource-link):
(.resource-list &gt; .resource-link::before):
(.resource-list &gt; .resource-link + .resource-link):
(.resource-link):

* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WebInspector.ResourceDetailsSidebarPanel):
(WebInspector.ResourceDetailsSidebarPanel.prototype._refreshURL):</pre>

<h3>Modified Paths</h3>
<ul>
<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="#trunkSourceWebInspectorUIUserInterfaceModelsResourcejs">trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsMaincss">trunk/Source/WebInspectorUI/UserInterface/Views/Main.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsResourceDetailsSidebarPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (194505 => 194506)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-01-03 00:04:22 UTC (rev 194505)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-01-03 00:39:41 UTC (rev 194506)
</span><span class="lines">@@ -1,5 +1,37 @@
</span><span class="cx"> 2016-01-02  Devin Rousso  &lt;dcrousso+webkit@gmail.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: List all resources that are initiated by the selected resource in the Network tab
+        https://bugs.webkit.org/show_bug.cgi?id=152647
+
+        Reviewed by Timothy Hatcher.
+
+        Selecting resources in the Network tab will now display a list of all resources
+        that the selected resource loaded, allowing for easier understanding of the
+        relationship between all the resources loaded on a page.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Base/Main.js:
+        Added functions to generate link(s) to Resource instead of SourceCodeLocation.
+
+        * UserInterface/Models/Resource.js:
+        (WebInspector.Resource):
+        (WebInspector.Resource.prototype.get initiatedResources):
+        (WebInspector.Resource.prototype.addInitiatedResource):
+        Each time a resource is added, if it has an initiator, it adds itself to the
+        initiator's list of initiated resources.
+
+        * UserInterface/Views/Main.css:
+        (.resource-list &gt; .resource-link):
+        (.resource-list &gt; .resource-link::before):
+        (.resource-list &gt; .resource-link + .resource-link):
+        (.resource-link):
+
+        * UserInterface/Views/ResourceDetailsSidebarPanel.js:
+        (WebInspector.ResourceDetailsSidebarPanel):
+        (WebInspector.ResourceDetailsSidebarPanel.prototype._refreshURL):
+
+2016-01-02  Devin Rousso  &lt;dcrousso+webkit@gmail.com&gt;
+
</ins><span class="cx">         Web Inspector: Add list-style properties to Visual Sidebar
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=152631
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (194505 => 194506)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2016-01-03 00:04:22 UTC (rev 194505)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2016-01-03 00:39:41 UTC (rev 194506)
</span><span class="lines">@@ -346,6 +346,7 @@
</span><span class="cx"> localizedStrings[&quot;Info: &quot;] = &quot;Info: &quot;;
</span><span class="cx"> localizedStrings[&quot;Inherited From: &quot;] = &quot;Inherited From: &quot;;
</span><span class="cx"> localizedStrings[&quot;Inherited from %s&quot;] = &quot;Inherited from %s&quot;;
</span><ins>+localizedStrings[&quot;Initiated&quot;] = &quot;Initiated&quot;;
</ins><span class="cx"> localizedStrings[&quot;Initiator&quot;] = &quot;Initiator&quot;;
</span><span class="cx"> localizedStrings[&quot;Input: &quot;] = &quot;Input: &quot;;
</span><span class="cx"> localizedStrings[&quot;Inset&quot;] = &quot;Inset&quot;;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseMainjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (194505 => 194506)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2016-01-03 00:04:22 UTC (rev 194505)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2016-01-03 00:39:41 UTC (rev 194506)
</span><span class="lines">@@ -2143,6 +2143,24 @@
</span><span class="cx">     return WebInspector.linkifyStringAsFragmentWithCustomLinkifier(string, linkifier);
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+WebInspector.createResourceLink = function(resource, className)
+{
+    function handleClick(event)
+    {
+        event.stopPropagation();
+        event.preventDefault();
+
+        WebInspector.showRepresentedObject(resource);
+    }
+
+    let linkNode = document.createElement(&quot;a&quot;);
+    linkNode.classList.add(&quot;resource-link&quot;, className);
+    linkNode.title = resource.url;
+    linkNode.textContent = (resource.urlComponents.lastPathComponent || resource.url).insertWordBreakCharacters();
+    linkNode.addEventListener(&quot;click&quot;, handleClick.bind(this));
+    return linkNode;
+}
+
</ins><span class="cx"> WebInspector._undoKeyboardShortcut = function(event)
</span><span class="cx"> {
</span><span class="cx">     if (!this.isEditingAnyField() &amp;&amp; !this.isEventTargetAnEditableField(event)) {
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsResourcejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (194505 => 194506)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js        2016-01-03 00:04:22 UTC (rev 194505)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js        2016-01-03 00:39:41 UTC (rev 194506)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx">         this._responseHeaders = {};
</span><span class="cx">         this._parentFrame = null;
</span><span class="cx">         this._initiatorSourceCodeLocation = initiatorSourceCodeLocation || null;
</span><ins>+        this._initiatedResources = [];
</ins><span class="cx">         this._originalRequestWillBeSentTimestamp = originalRequestWillBeSentTimestamp || null;
</span><span class="cx">         this._requestSentTimestamp = requestSentTimestamp || NaN;
</span><span class="cx">         this._responseReceivedTimestamp = NaN;
</span><span class="lines">@@ -57,6 +58,9 @@
</span><span class="cx">         this._size = NaN;
</span><span class="cx">         this._transferSize = NaN;
</span><span class="cx">         this._cached = false;
</span><ins>+
+        if (this._initiatorSourceCodeLocation)
+            this._initiatorSourceCodeLocation.sourceCode.addInitiatedResource(this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Static
</span><span class="lines">@@ -150,6 +154,11 @@
</span><span class="cx">         return this._initiatorSourceCodeLocation;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    get initiatedResources()
+    {
+        return this._initiatedResources;
+    }
+
</ins><span class="cx">     get originalRequestWillBeSentTimestamp()
</span><span class="cx">     {
</span><span class="cx">         return this._originalRequestWillBeSentTimestamp;
</span><span class="lines">@@ -215,6 +224,13 @@
</span><span class="cx">         return this._parentFrame ? this._parentFrame.mainResource === this : false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    addInitiatedResource(resource) {
+        if (!(resource instanceof WebInspector.Resource))
+            return;
+
+        this._initiatedResources.push(resource);
+    }
+
</ins><span class="cx">     get parentFrame()
</span><span class="cx">     {
</span><span class="cx">         return this._parentFrame;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsMaincss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Main.css (194505 => 194506)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/Main.css        2016-01-03 00:04:22 UTC (rev 194505)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Main.css        2016-01-03 00:39:41 UTC (rev 194506)
</span><span class="lines">@@ -243,6 +243,15 @@
</span><span class="cx">     content: &quot;&quot;;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.resource-link {
+    display: block;
+}
+
+.resource-link + .resource-link {
+    margin-top: 2px;
+}
+
+.resource-link,
</ins><span class="cx"> .go-to-link {
</span><span class="cx">     color: hsl(0, 0%, 33%);
</span><span class="cx">     text-decoration: underline;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsResourceDetailsSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js (194505 => 194506)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js        2016-01-03 00:04:22 UTC (rev 194505)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js        2016-01-03 00:39:41 UTC (rev 194506)
</span><span class="lines">@@ -48,17 +48,18 @@
</span><span class="cx">         this._locationFragmentRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString(&quot;Fragment&quot;));
</span><span class="cx">         this._locationFilenameRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString(&quot;Filename&quot;));
</span><span class="cx">         this._initiatorRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString(&quot;Initiator&quot;));
</span><ins>+        this._initiatedRow = new WebInspector.DetailsSectionSimpleRow(WebInspector.UIString(&quot;Initiated&quot;));
</ins><span class="cx"> 
</span><span class="cx">         var firstGroup = [this._locationFullURLRow];
</span><span class="cx">         var secondGroup = [this._locationSchemeRow, this._locationHostRow, this._locationPortRow, this._locationPathRow,
</span><span class="cx">             this._locationQueryStringRow, this._locationFragmentRow, this._locationFilenameRow];
</span><del>-        var thirdGroup = [this._initiatorRow];
</del><ins>+        var thirdGroup = [this._initiatorRow, this._initiatedRow];
</ins><span class="cx"> 
</span><span class="cx">         this._fullURLGroup = new WebInspector.DetailsSectionGroup(firstGroup);
</span><span class="cx">         this._locationURLComponentsGroup = new WebInspector.DetailsSectionGroup(secondGroup);
</span><del>-        this._initiatorGroup = new WebInspector.DetailsSectionGroup(thirdGroup);
</del><ins>+        this._relatedResourcesGroup = new WebInspector.DetailsSectionGroup(thirdGroup);
</ins><span class="cx"> 
</span><del>-        this._locationSection = new WebInspector.DetailsSection(&quot;resource-location&quot;, WebInspector.UIString(&quot;Location&quot;), [this._fullURLGroup, this._locationURLComponentsGroup, this._initiatorGroup]);
</del><ins>+        this._locationSection = new WebInspector.DetailsSection(&quot;resource-location&quot;, WebInspector.UIString(&quot;Location&quot;), [this._fullURLGroup, this._locationURLComponentsGroup, this._relatedResourcesGroup]);
</ins><span class="cx"> 
</span><span class="cx">         this._queryParametersRow = new WebInspector.DetailsSectionDataGridRow(null, WebInspector.UIString(&quot;No Query Parameters&quot;));
</span><span class="cx">         this._queryParametersSection = new WebInspector.DetailsSection(&quot;resource-query-parameters&quot;, WebInspector.UIString(&quot;Query Parameters&quot;));
</span><span class="lines">@@ -201,10 +202,7 @@
</span><span class="cx"> 
</span><span class="cx">         var urlComponents = this._resource.urlComponents;
</span><span class="cx">         if (urlComponents.scheme) {
</span><del>-            if (this._resource.initiatorSourceCodeLocation)
-                this._locationSection.groups = [this._fullURLGroup, this._locationURLComponentsGroup, this._initiatorGroup];
-            else
-                this._locationSection.groups = [this._fullURLGroup, this._locationURLComponentsGroup];
</del><ins>+            this._locationSection.groups = [this._fullURLGroup, this._locationURLComponentsGroup, this._relatedResourcesGroup];
</ins><span class="cx"> 
</span><span class="cx">             this._locationSchemeRow.value = urlComponents.scheme ? urlComponents.scheme : null;
</span><span class="cx">             this._locationHostRow.value = urlComponents.host ? urlComponents.host : null;
</span><span class="lines">@@ -214,15 +212,22 @@
</span><span class="cx">             this._locationFragmentRow.value = urlComponents.fragment ? urlComponents.fragment.insertWordBreakCharacters() : null;
</span><span class="cx">             this._locationFilenameRow.value = urlComponents.lastPathComponent ? urlComponents.lastPathComponent.insertWordBreakCharacters() : null;
</span><span class="cx">         } else {
</span><del>-            if (this._resource.initiatorSourceCodeLocation)
-                this._locationSection.groups = [this._fullURLGroup, this._initiatorGroup];
-            else
-                this._locationSection.groups = [this._fullURLGroup];
</del><ins>+            this._locationSection.groups = [this._fullURLGroup, this._relatedResourcesGroup];
</ins><span class="cx">         }
</span><span class="cx"> 
</span><del>-        if (this._resource.initiatorSourceCodeLocation)
-            this._initiatorRow.value = WebInspector.createSourceCodeLocationLink(this._resource.initiatorSourceCodeLocation, true);
</del><ins>+        let initiatorLocation = this._resource.initiatorSourceCodeLocation;
+        this._initiatorRow.value = initiatorLocation ? WebInspector.createSourceCodeLocationLink(initiatorLocation, true) : null;
</ins><span class="cx"> 
</span><ins>+        let initiatedResources = this._resource.initiatedResources;
+        if (initiatedResources.length) {
+            let resourceLinkContainer = document.createElement(&quot;div&quot;);
+            for (let resource of initiatedResources)
+                resourceLinkContainer.appendChild(WebInspector.createResourceLink(resource));
+
+            this._initiatedRow.value = resourceLinkContainer;
+        } else
+            this._initiatedRow.value = null;
+
</ins><span class="cx">         if (urlComponents.queryString) {
</span><span class="cx">             // Ensure the &quot;Query Parameters&quot; section is displayed, right after the &quot;Request &amp; Response&quot; section.
</span><span class="cx">             this.contentView.element.insertBefore(this._queryParametersSection.element, this._requestAndResponseSection.element.nextSibling);
</span></span></pre>
</div>
</div>

</body>
</html>