Title: [184411] trunk/Source/WebInspectorUI
Revision
184411
Author
[email protected]
Date
2015-05-15 13:47:08 -0700 (Fri, 15 May 2015)

Log Message

Web Inspector: Fix some possible event listener leakers in content views
https://bugs.webkit.org/show_bug.cgi?id=145068

Patch by Joseph Pecoraro <[email protected]> on 2015-05-15
Reviewed by Timothy Hatcher.

Now that some content views can be closed that weren't closable before, ensure
we clean up after global event listeners that may strongly reference "this".

* UserInterface/Views/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView.prototype.closed):
* UserInterface/Views/DOMTreeOutline.js:
(WebInspector.DOMTreeOutline.prototype.close):
* UserInterface/Views/LayoutTimelineView.js:
(WebInspector.LayoutTimelineView.prototype.closed):
* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView.prototype.closed):
* UserInterface/Views/RenderingFrameTimelineView.js:
(WebInspector.RenderingFrameTimelineView.prototype.closed):
* UserInterface/Views/ScriptContentView.js:
(WebInspector.ScriptContentView.prototype.closed):
* UserInterface/Views/ScriptTimelineView.js:
(WebInspector.ScriptTimelineView.prototype.closed):
* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.close):
* UserInterface/Views/TextResourceContentView.js:
(WebInspector.TextResourceContentView.prototype.closed):
* UserInterface/Views/TimelineDataGrid.js:
(WebInspector.TimelineDataGrid.prototype.closed):
(WebInspector.TimelineDataGrid.prototype.handleEvent):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (184410 => 184411)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-05-15 20:47:08 UTC (rev 184411)
@@ -1,5 +1,37 @@
 2015-05-15  Joseph Pecoraro  <[email protected]>
 
+        Web Inspector: Fix some possible event listener leakers in content views
+        https://bugs.webkit.org/show_bug.cgi?id=145068
+
+        Reviewed by Timothy Hatcher.
+
+        Now that some content views can be closed that weren't closable before, ensure
+        we clean up after global event listeners that may strongly reference "this".
+
+        * UserInterface/Views/DOMTreeContentView.js:
+        (WebInspector.DOMTreeContentView.prototype.closed):
+        * UserInterface/Views/DOMTreeOutline.js:
+        (WebInspector.DOMTreeOutline.prototype.close):
+        * UserInterface/Views/LayoutTimelineView.js:
+        (WebInspector.LayoutTimelineView.prototype.closed):
+        * UserInterface/Views/NetworkTimelineView.js:
+        (WebInspector.NetworkTimelineView.prototype.closed):
+        * UserInterface/Views/RenderingFrameTimelineView.js:
+        (WebInspector.RenderingFrameTimelineView.prototype.closed):
+        * UserInterface/Views/ScriptContentView.js:
+        (WebInspector.ScriptContentView.prototype.closed):
+        * UserInterface/Views/ScriptTimelineView.js:
+        (WebInspector.ScriptTimelineView.prototype.closed):
+        * UserInterface/Views/SourceCodeTextEditor.js:
+        (WebInspector.SourceCodeTextEditor.prototype.close):
+        * UserInterface/Views/TextResourceContentView.js:
+        (WebInspector.TextResourceContentView.prototype.closed):
+        * UserInterface/Views/TimelineDataGrid.js:
+        (WebInspector.TimelineDataGrid.prototype.closed):
+        (WebInspector.TimelineDataGrid.prototype.handleEvent):
+
+2015-05-15  Joseph Pecoraro  <[email protected]>
+
         Web Inspector: Initiator Popovers no longer work in Layout Timeline
         https://bugs.webkit.org/show_bug.cgi?id=145067
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js (184410 => 184411)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeContentView.js	2015-05-15 20:47:08 UTC (rev 184411)
@@ -105,6 +105,8 @@
 
     closed: function()
     {
+        WebInspector.showPaintRectsSetting.removeEventListener(null, null, this);
+        WebInspector.showShadowDOMSetting.removeEventListener(null, null, this);
         WebInspector.domTreeManager.removeEventListener(null, null, this);
 
         this._domTreeOutline.close();

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js (184410 => 184411)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeOutline.js	2015-05-15 20:47:08 UTC (rev 184411)
@@ -74,6 +74,8 @@
 
     close()
     {
+        WebInspector.showShadowDOMSetting.removeEventListener(null, null, this);
+
         if (this._elementsTreeUpdater) {
             this._elementsTreeUpdater.close();
             this._elementsTreeUpdater = null;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js (184410 => 184411)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineView.js	2015-05-15 20:47:08 UTC (rev 184411)
@@ -127,6 +127,8 @@
     {
         console.assert(this.representedObject instanceof WebInspector.Timeline);
         this.representedObject.removeEventListener(null, null, this);
+
+        this._dataGrid.closed();
     },
 
     filterDidChange: function()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js (184410 => 184411)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTimelineView.js	2015-05-15 20:47:08 UTC (rev 184411)
@@ -129,6 +129,8 @@
     {
         console.assert(this.representedObject instanceof WebInspector.Timeline);
         this.representedObject.removeEventListener(null, null, this);
+
+        this._dataGrid.closed();
     },
 
     updateLayout: function()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js (184410 => 184411)


--- trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js	2015-05-15 20:47:08 UTC (rev 184411)
@@ -100,6 +100,8 @@
     {
         console.assert(this.representedObject instanceof WebInspector.Timeline);
         this.representedObject.removeEventListener(null, null, this);
+
+        this._dataGrid.closed();
     },
 
     updateLayout: function()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js (184410 => 184411)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptContentView.js	2015-05-15 20:47:08 UTC (rev 184411)
@@ -112,6 +112,8 @@
 
     closed: function()
     {
+        WebInspector.showJavaScriptTypeInformationSetting.removeEventListener(null, null, this);
+
         this._textEditor.close();
     },
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js (184410 => 184411)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTimelineView.js	2015-05-15 20:47:08 UTC (rev 184411)
@@ -105,6 +105,8 @@
     {
         console.assert(this.representedObject instanceof WebInspector.Timeline);
         this.representedObject.removeEventListener(null, null, this);
+
+        this._dataGrid.closed();
     },
 
     updateLayout: function()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (184410 => 184411)


--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js	2015-05-15 20:47:08 UTC (rev 184411)
@@ -128,16 +128,9 @@
     close()
     {
         if (this._supportsDebugging) {
-            WebInspector.Breakpoint.removeEventListener(WebInspector.Breakpoint.Event.DisabledStateDidChange, this._breakpointStatusDidChange, this);
-            WebInspector.Breakpoint.removeEventListener(WebInspector.Breakpoint.Event.AutoContinueDidChange, this._breakpointStatusDidChange, this);
-            WebInspector.Breakpoint.removeEventListener(WebInspector.Breakpoint.Event.ResolvedStateDidChange, this._breakpointStatusDidChange, this);
-            WebInspector.Breakpoint.removeEventListener(WebInspector.Breakpoint.Event.LocationDidChange, this._updateBreakpointLocation, this);
+            WebInspector.Breakpoint.removeEventListener(null, null, this);
+            WebInspector.debuggerManager.removeEventListener(null, null, this);
 
-            WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.BreakpointsEnabledDidChange, this._breakpointsEnabledDidChange, this);
-            WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.BreakpointAdded, this._breakpointAdded, this);
-            WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.BreakpointRemoved, this._breakpointRemoved, this);
-            WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ActiveCallFrameDidChange, this._activeCallFrameDidChange, this);
-
             if (this._activeCallFrameSourceCodeLocation) {
                 this._activeCallFrameSourceCodeLocation.removeEventListener(WebInspector.SourceCodeLocation.Event.LocationChanged, this._activeCallFrameSourceCodeLocationChanged, this);
                 delete this._activeCallFrameSourceCodeLocation;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js (184410 => 184411)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js	2015-05-15 20:47:08 UTC (rev 184411)
@@ -116,6 +116,8 @@
         WebInspector.ResourceContentView.prototype.closed.call(this);
 
         this.resource.removeEventListener(null, null, this);
+        WebInspector.probeManager.removeEventListener(null, null, this);
+        WebInspector.showJavaScriptTypeInformationSetting.removeEventListener(null, null, this);
 
         this._textEditor.close();
     },

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js (184410 => 184411)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js	2015-05-15 20:45:58 UTC (rev 184410)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineDataGrid.js	2015-05-15 20:47:08 UTC (rev 184411)
@@ -61,7 +61,7 @@
     this.addEventListener(WebInspector.DataGrid.Event.SelectedNodeChanged, this._dataGridSelectedNodeChanged, this);
     this.addEventListener(WebInspector.DataGrid.Event.SortChanged, this._sort, this);
 
-    window.addEventListener("resize", this._windowResized.bind(this));
+    window.addEventListener("resize", this);
 };
 
 WebInspector.TimelineDataGrid.StyleClassName = "timeline";
@@ -117,6 +117,11 @@
         this._hidePopover();
     },
 
+    closed: function()
+    {
+        window.removeEventListener("resize", this);
+    },
+
     treeElementForDataGridNode: function(dataGridNode)
     {
         return this._treeOutlineDataGridSynchronizer.treeElementForDataGridNode(dataGridNode);
@@ -190,6 +195,13 @@
 
     // Protected
 
+    handleEvent: function(event)
+    {
+        console.assert(event.type === "resize");
+
+        this._windowResized(event);
+    },
+
     dataGridNodeNeedsRefresh: function(dataGridNode)
     {
         if (!this._dirtyDataGridNodes)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to