Web Inspector: Make closing ContentViews more leak proof
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Views / TimelineRecordingContentView.js
index 14197554d901857216fc2d29551aeda656382df2..c00a5bb8e310e500744555bce4288dc1c8da9fca 100644 (file)
@@ -188,8 +188,11 @@ WebInspector.TimelineRecordingContentView.prototype = {
     {
         this._contentViewContainer.closeAllContentViews();
 
-        WebInspector.ContentView.removeEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
-        WebInspector.ContentView.removeEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
+        this._recording.removeEventListener(null, null, this);
+
+        WebInspector.timelineManager.removeEventListener(null, null, this);
+        WebInspector.debuggerManager.removeEventListener(null, null, this);
+        WebInspector.ContentView.removeEventListener(null, null, this);
     },
 
     canGoBack: function()
@@ -494,6 +497,9 @@ WebInspector.TimelineRecordingContentView.prototype = {
             timeline = timelineOrEvent.data.timeline;
 
         console.assert(timeline instanceof WebInspector.Timeline, timeline);
+        if (!WebInspector.TimelineManager.shouldShowViewForTimeline(timeline))
+            return;
+
         console.assert(!this._timelineViewMap.has(timeline), timeline);
 
         this._timelineViewMap.set(timeline, new WebInspector.ContentView(timeline));
@@ -509,6 +515,9 @@ WebInspector.TimelineRecordingContentView.prototype = {
     {
         var timeline = event.data.timeline;
         console.assert(timeline instanceof WebInspector.Timeline, timeline);
+        if (!WebInspector.TimelineManager.shouldShowViewForTimeline(timeline))
+            return;
+
         console.assert(this._timelineViewMap.has(timeline), timeline);
 
         var timelineView = this._timelineViewMap.take(timeline);
@@ -532,7 +541,7 @@ WebInspector.TimelineRecordingContentView.prototype = {
             previousPathComponent = pathComponent;
         }
 
-        var timelineCount = this._recording.timelines.size;
+        var timelineCount = this._timelineViewMap.size;
         const timelineHeight = 36;
         const extraOffset = 22;
         this._timelineOverview.element.style.height = (timelineCount * timelineHeight + extraOffset) + "px";
@@ -574,6 +583,8 @@ WebInspector.TimelineRecordingContentView.prototype = {
         if (this.currentTimelineView) {
             this.currentTimelineView.startTime = this._timelineOverview.selectionStartTime;
             this.currentTimelineView.endTime = this._timelineOverview.selectionStartTime + this._timelineOverview.selectionDuration;
+
+            WebInspector.renderingFrameDetailsSidebarPanel.updateRangeSelection(this.currentTimelineView.startTime, this.currentTimelineView.endTime);
         }
 
         // Delay until the next frame to stay in sync with the current timeline view's time-based layout changes.