<!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>[201138] branches/safari-602.1.32-branch/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/201138">201138</a></dd>
<dt>Author</dt> <dd>bshafiei@apple.com</dd>
<dt>Date</dt> <dd>2016-05-19 01:40:14 -0700 (Thu, 19 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/200873">r200873</a>. rdar://problem/26228605</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari602132branchSourceWebInspectorUIChangeLog">branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsDataGridjs">branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/DataGrid.js</a></li>
<li><a href="#branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsProfileDataGridNodejs">branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridNode.js</a></li>
<li><a href="#branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsProfileDataGridTreejs">branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js</a></li>
<li><a href="#branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsProfileViewjs">branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileView.js</a></li>
<li><a href="#branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsScriptClusterTimelineViewjs">branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js</a></li>
<li><a href="#branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsScriptProfileTimelineViewjs">branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.js</a></li>
<li><a href="#branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsTimelineViewjs">branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TimelineView.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari602132branchSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog (201137 => 201138)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog        2016-05-19 08:40:09 UTC (rev 201137)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/ChangeLog        2016-05-19 08:40:14 UTC (rev 201138)
</span><span class="lines">@@ -1,5 +1,63 @@
</span><span class="cx"> 2016-05-19  Babak Shafiei  &lt;bshafiei@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r200873. rdar://problem/26228605
+
+    2016-05-13  Matt Baker  &lt;mattbaker@apple.com&gt;
+
+            Web Inspector: Script ProfileViews should be searchable
+            https://bugs.webkit.org/show_bug.cgi?id=157581
+            &lt;rdar://problem/26228530&gt;
+
+            Reviewed by Joseph Pecoraro.
+
+            * UserInterface/Views/DataGrid.js:
+            (WebInspector.DataGrid.prototype.get filterText):
+            Make filterText readable.
+
+            * UserInterface/Views/ProfileDataGridNode.js:
+            (WebInspector.ProfileDataGridNode.prototype.get callingContextTreeNode):
+            (WebInspector.ProfileDataGridNode.prototype.filterableDataForColumn):
+            Add filterable data for the &quot;function&quot; column.
+            (WebInspector.ProfileDataGridNode.prototype._updateChildrenForModifiers):
+            (WebInspector.ProfileDataGridNode.prototype.get node): Deleted.
+            Renamed callingContextTreeNode to be less ambiguous.
+
+            * UserInterface/Views/ProfileDataGridTree.js:
+            (WebInspector.ProfileDataGridTree.prototype._updateCurrentFocusDetails):
+
+            * UserInterface/Views/ProfileView.js:
+            (WebInspector.ProfileView.prototype.get dataGrid):
+            Expose data grid for use in parent view.
+
+            * UserInterface/Views/ScriptClusterTimelineView.js:
+            (WebInspector.ScriptClusterTimelineView.prototype.selectRecord):
+            Drive-by fix: forward property to current child TimelineView.
+
+            * UserInterface/Views/ScriptProfileTimelineView.js:
+            (WebInspector.ScriptProfileTimelineView):
+            (WebInspector.ScriptProfileTimelineView.prototype._scopeBarSelectionDidChange):
+            (WebInspector.ScriptProfileTimelineView.prototype._showProfileViewForOrientation):
+            Helper function to switch profile views. Persist filter text when
+            switching to the new profile view.
+
+            (WebInspector.ScriptProfileTimelineView.prototype.get showsFilterBar): Deleted.
+            Remove FIXME and show filter bar.
+
+            * UserInterface/Views/TimelineView.js:
+            (WebInspector.TimelineView.prototype.setupDataGrid):
+            Support switching to a new data grid.
+            (WebInspector.TimelineView.prototype.dataGridMatchNodeAgainstCustomFilters):
+            Hooking up filtering causes data grid nodes to be filtered based on the
+            ruler selection. Although ScriptProfileTimelineView performs its own
+            time-based filtering, this is necessary to prevent an assert.
+
+            (WebInspector.TimelineView.prototype._timelineDataGridSelectedNodeChanged):
+            (WebInspector.TimelineView.prototype._timelineDataGridNodeWasFiltered):
+            Converted arrow functions to member functions to allow unregistering
+            event listeners on outgoing data grid when swapping grids.
+
+2016-05-19  Babak Shafiei  &lt;bshafiei@apple.com&gt;
+
</ins><span class="cx">         Merge r200809. rdar://problem/26260709
</span><span class="cx"> 
</span><span class="cx">     2016-05-12  Matt Baker  &lt;mattbaker@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsDataGridjs"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/DataGrid.js (201137 => 201138)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/DataGrid.js        2016-05-19 08:40:09 UTC (rev 201137)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/DataGrid.js        2016-05-19 08:40:14 UTC (rev 201138)
</span><span class="lines">@@ -278,6 +278,8 @@
</span><span class="cx">         this._updateScrollListeners();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    get filterText() { return this._filterText; }
+
</ins><span class="cx">     set filterText(x)
</span><span class="cx">     {
</span><span class="cx">         if (this._filterText === x)
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsProfileDataGridNodejs"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridNode.js (201137 => 201138)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridNode.js        2016-05-19 08:40:09 UTC (rev 201137)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridNode.js        2016-05-19 08:40:14 UTC (rev 201138)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Public
</span><span class="cx"> 
</span><del>-    get node() { return this._node; }
</del><ins>+    get callingContextTreeNode() { return this._node; }
</ins><span class="cx"> 
</span><span class="cx">     displayName()
</span><span class="cx">     {
</span><span class="lines">@@ -124,6 +124,21 @@
</span><span class="cx">         contextMenu.appendSeparator();
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // Protected
+
+    filterableDataForColumn(columnIdentifier)
+    {
+        if (columnIdentifier === &quot;function&quot;) {
+            let filterableData = [this.displayName()];
+            let script = WebInspector.debuggerManager.scriptForIdentifier(this._node.sourceID);
+            if (script &amp;&amp; script.url &amp;&amp; this._node.line &gt;= 0 &amp;&amp; this._node.column &gt;= 0)
+                filterableData.push(script.url);
+            return filterableData;
+        }
+
+        return super.filterableDataForColumn(columnIdentifier);
+    }
+
</ins><span class="cx">     // Private
</span><span class="cx"> 
</span><span class="cx">     _updateChildrenForModifiers()
</span><span class="lines">@@ -174,7 +189,7 @@
</span><span class="cx">         // Remove child data grid nodes that have been charged to us.
</span><span class="cx">         if (!this.shouldRefreshChildren &amp;&amp; this._childrenToChargeToSelf.size) {
</span><span class="cx">             for (let childDataGridNode of this.children) {
</span><del>-                if (this._childrenToChargeToSelf.has(childDataGridNode.node))
</del><ins>+                if (this._childrenToChargeToSelf.has(childDataGridNode.callingContextTreeNode))
</ins><span class="cx">                     this.removeChild(childDataGridNode);
</span><span class="cx">             }
</span><span class="cx">         }
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsProfileDataGridTreejs"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js (201137 => 201138)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js        2016-05-19 08:40:09 UTC (rev 201137)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileDataGridTree.js        2016-05-19 08:40:14 UTC (rev 201138)
</span><span class="lines">@@ -239,7 +239,7 @@
</span><span class="cx"> 
</span><span class="cx">     _updateCurrentFocusDetails(focusDataGridNode)
</span><span class="cx">     {
</span><del>-        let cctNode = focusDataGridNode.node;
</del><ins>+        let cctNode = focusDataGridNode.callingContextTreeNode;
</ins><span class="cx">         let {timestamps, duration} = cctNode.filteredTimestampsAndDuration(this._startTime, this._endTime);
</span><span class="cx"> 
</span><span class="cx">         this._currentFocusStartTime = timestamps[0];
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsProfileViewjs"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileView.js (201137 => 201138)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileView.js        2016-05-19 08:40:09 UTC (rev 201137)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ProfileView.js        2016-05-19 08:40:14 UTC (rev 201138)
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx">     get callingContextTree() { return this._callingContextTree; }
</span><span class="cx">     get startTime() { return this._startTime; }
</span><span class="cx">     get endTime() { return this._endTime; }
</span><ins>+    get dataGrid() { return this._dataGrid; }
</ins><span class="cx"> 
</span><span class="cx">     setStartAndEndTime(startTime, endTime)
</span><span class="cx">     {
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsScriptClusterTimelineViewjs"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js (201137 => 201138)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js        2016-05-19 08:40:09 UTC (rev 201137)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js        2016-05-19 08:40:14 UTC (rev 201138)
</span><span class="lines">@@ -71,6 +71,8 @@
</span><span class="cx">     set endTime(x) { this._contentViewContainer.currentContentView.endTime = x; }
</span><span class="cx">     get currentTime() { return this._contentViewContainer.currentContentView.currentTime; }
</span><span class="cx">     set currentTime(x) { this._contentViewContainer.currentContentView.currentTime = x; }
</span><ins>+
+    selectRecord(record) { this._contentViewContainer.currentContentView.selectRecord(record); }
</ins><span class="cx">     updateFilter(filters) { return this._contentViewContainer.currentContentView.updateFilter(filters); }
</span><span class="cx">     filterDidChange() { return this._contentViewContainer.currentContentView.filterDidChange(); }
</span><span class="cx">     matchDataGridNodeAgainstCustomFilters(node) { return this._contentViewContainer.currentContentView.matchDataGridNodeAgainstCustomFilters(node); }
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsScriptProfileTimelineViewjs"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.js (201137 => 201138)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.js        2016-05-19 08:40:09 UTC (rev 201137)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/ScriptProfileTimelineView.js        2016-05-19 08:40:14 UTC (rev 201138)
</span><span class="lines">@@ -42,10 +42,7 @@
</span><span class="cx">         if (!WebInspector.ScriptProfileTimelineView.profileOrientationSetting)
</span><span class="cx">             WebInspector.ScriptProfileTimelineView.profileOrientationSetting = new WebInspector.Setting(&quot;script-profile-timeline-view-profile-orientation-setting&quot;, WebInspector.ScriptProfileTimelineView.ProfileOrientation.TopDown);
</span><span class="cx"> 
</span><del>-        let callingContextTree = this._callingContextTreeForOrientation(WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value);
-        this._profileView = new WebInspector.ProfileView(callingContextTree);
-        this._profileView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._profileViewSelectionPathComponentsDidChange, this);
-        this.addSubview(this._profileView);
</del><ins>+        this._showProfileViewForOrientation(WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value);
</ins><span class="cx"> 
</span><span class="cx">         let scopeBarItems = [
</span><span class="cx">             new WebInspector.ScopeBarItem(WebInspector.ScriptProfileTimelineView.ProfileOrientation.TopDown, WebInspector.UIString(&quot;Top Down&quot;), true),
</span><span class="lines">@@ -61,17 +58,12 @@
</span><span class="cx">         this._updateClearFocusNodesButtonItem();
</span><span class="cx"> 
</span><span class="cx">         timeline.addEventListener(WebInspector.Timeline.Event.Refreshed, this._scriptTimelineRecordRefreshed, this);
</span><del>-
-        // FIXME: Support filtering the ProfileView.
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Public
</span><span class="cx"> 
</span><span class="cx">     get showsLiveRecordingData() { return false; }
</span><span class="cx"> 
</span><del>-    // FIXME: &lt;https://webkit.org/b/157581&gt; Web Inspector: Script ProfileViews should be searchable
-    get showsFilterBar() { return false; }
-
</del><span class="cx">     // Protected
</span><span class="cx"> 
</span><span class="cx">     closed()
</span><span class="lines">@@ -130,22 +122,34 @@
</span><span class="cx">     {
</span><span class="cx">         let currentOrientation = WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value;
</span><span class="cx">         let newOrientation = this._profileOrientationScopeBar.selectedItems[0].id;
</span><del>-        let callingContextTree = this._callingContextTreeForOrientation(newOrientation);
</del><span class="cx"> 
</span><span class="cx">         WebInspector.ScriptProfileTimelineView.profileOrientationSetting.value = newOrientation;
</span><ins>+        this._showProfileViewForOrientation(newOrientation);
</ins><span class="cx"> 
</span><del>-        this.removeSubview(this._profileView);
-        this._profileView.removeEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._profileViewSelectionPathComponentsDidChange, this);
</del><ins>+        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
</ins><span class="cx"> 
</span><ins>+        this._forceNextLayout = true;
+        this.needsLayout();
+    }
+
+    _showProfileViewForOrientation(orientation)
+    {
+        let filterText;
+        if (this._profileView) {
+            this._profileView.removeEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._profileViewSelectionPathComponentsDidChange, this);
+            this.removeSubview(this._profileView);
+            filterText = this._profileView.dataGrid.filterText;
+        }
+
+        let callingContextTree = this._callingContextTreeForOrientation(orientation);
</ins><span class="cx">         this._profileView = new WebInspector.ProfileView(callingContextTree);
</span><ins>+        this._profileView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._profileViewSelectionPathComponentsDidChange, this);
</ins><span class="cx"> 
</span><del>-        this._profileView.addEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._profileViewSelectionPathComponentsDidChange, this);
</del><span class="cx">         this.addSubview(this._profileView);
</span><ins>+        this.setupDataGrid(this._profileView.dataGrid);
</ins><span class="cx"> 
</span><del>-        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
-
-        this._forceNextLayout = true;
-        this.needsLayout();
</del><ins>+        if (filterText)
+            this._profileView.dataGrid.filterText = filterText;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     _updateClearFocusNodesButtonItem()
</span></span></pre></div>
<a id="branchessafari602132branchSourceWebInspectorUIUserInterfaceViewsTimelineViewjs"></a>
<div class="modfile"><h4>Modified: branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TimelineView.js (201137 => 201138)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TimelineView.js        2016-05-19 08:40:09 UTC (rev 201137)
+++ branches/safari-602.1.32-branch/Source/WebInspectorUI/UserInterface/Views/TimelineView.js        2016-05-19 08:40:14 UTC (rev 201138)
</span><span class="lines">@@ -158,25 +158,18 @@
</span><span class="cx"> 
</span><span class="cx">     setupDataGrid(dataGrid)
</span><span class="cx">     {
</span><del>-        console.assert(!this._timelineDataGrid);
</del><ins>+        if (this._timelineDataGrid) {
+            this._timelineDataGrid.filterDelegate = null;
+            this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._timelineDataGridSelectedNodeChanged, this);
+            this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.NodeWasFiltered, this._timelineDataGridNodeWasFiltered, this);
+            this._timelineDataGrid.removeEventListener(WebInspector.DataGrid.Event.FilterDidChange, this.filterDidChange, this);
+        }
</ins><span class="cx"> 
</span><span class="cx">         this._timelineDataGrid = dataGrid;
</span><span class="cx">         this._timelineDataGrid.filterDelegate = this;
</span><del>-        this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, () =&gt; {
-            this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
-        });
-
-        this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.NodeWasFiltered, (event) =&gt; {
-            let node = event.data.node;
-            if (!(node instanceof WebInspector.TimelineDataGridNode))
-                return;
-
-            this.dispatchEventToListeners(WebInspector.TimelineView.Event.RecordWasFiltered, {record: node.record, filtered: node.hidden});
-        });
-
-        this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.FilterDidChange, (event) =&gt; {
-            this.filterDidChange();
-        });
</del><ins>+        this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._timelineDataGridSelectedNodeChanged, this);
+        this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.NodeWasFiltered, this._timelineDataGridNodeWasFiltered, this);
+        this._timelineDataGrid.addEventListener(WebInspector.DataGrid.Event.FilterDidChange, this.filterDidChange, this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     selectRecord(record)
</span><span class="lines">@@ -284,6 +277,9 @@
</span><span class="cx">             return checkTimeBounds(record.startTime, record.endTime);
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        if (node instanceof WebInspector.ProfileDataGridNode)
+            return node.callingContextTreeNode.hasStackTraceInTimeRange(startTime, endTime);
+
</ins><span class="cx">         console.error(&quot;Unknown DataGridNode, can't filter by time.&quot;);
</span><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="lines">@@ -302,6 +298,20 @@
</span><span class="cx"> 
</span><span class="cx">     // Private
</span><span class="cx"> 
</span><ins>+    _timelineDataGridSelectedNodeChanged(event)
+    {
+        this.dispatchEventToListeners(WebInspector.ContentView.Event.SelectionPathComponentsDidChange);
+    }
+
+    _timelineDataGridNodeWasFiltered(event)
+    {
+        let node = event.data.node;
+        if (!(node instanceof WebInspector.TimelineDataGridNode))
+            return;
+
+        this.dispatchEventToListeners(WebInspector.TimelineView.Event.RecordWasFiltered, {record: node.record, filtered: node.hidden});
+    }
+
</ins><span class="cx">     _timesDidChange()
</span><span class="cx">     {
</span><span class="cx">         if (!WebInspector.timelineManager.isCapturing() || this.showsLiveRecordingData)
</span></span></pre>
</div>
</div>

</body>
</html>