Web Inspector: Make closing ContentViews more leak proof
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 00:59:47 +0000 (00:59 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 26 Apr 2015 00:59:47 +0000 (00:59 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144200

Remove all listeners on the target objects in close that match the this object.
This makes things more foolproof when something changes or a new listener is
added to the same object. TimelineRecordingContentView also had a leak where
TimelineManager and DebuggerManager listeners were not being removed.

Reviewed by Darin Adler.

* UserInterface/Views/ApplicationCacheFrameContentView.js:
(WebInspector.ApplicationCacheFrameContentView.prototype.closed):
* UserInterface/Views/ClusterContentView.js:
(WebInspector.ClusterContentView.prototype.closed):
* UserInterface/Views/ContentFlowDOMTreeContentView.js:
(WebInspector.ContentFlowDOMTreeContentView.prototype.closed):
* UserInterface/Views/FrameDOMTreeContentView.js:
(WebInspector.FrameDOMTreeContentView.prototype.closed):
* UserInterface/Views/ResourceContentView.js:
(WebInspector.ResourceContentView.prototype.closed):
* UserInterface/Views/TextResourceContentView.js:
(WebInspector.TextResourceContentView.prototype.closed):
* UserInterface/Views/TimelineRecordingContentView.js:
(WebInspector.TimelineRecordingContentView.prototype.closed):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@183318 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Views/ApplicationCacheFrameContentView.js
Source/WebInspectorUI/UserInterface/Views/ClusterContentView.js
Source/WebInspectorUI/UserInterface/Views/ContentFlowDOMTreeContentView.js
Source/WebInspectorUI/UserInterface/Views/FrameDOMTreeContentView.js
Source/WebInspectorUI/UserInterface/Views/ResourceContentView.js
Source/WebInspectorUI/UserInterface/Views/TextResourceContentView.js
Source/WebInspectorUI/UserInterface/Views/TimelineRecordingContentView.js

index 54f0371..673510b 100644 (file)
@@ -1,3 +1,30 @@
+2015-04-25  Timothy Hatcher  <timothy@apple.com>
+
+        Web Inspector: Make closing ContentViews more leak proof
+        https://bugs.webkit.org/show_bug.cgi?id=144200
+
+        Remove all listeners on the target objects in close that match the this object.
+        This makes things more foolproof when something changes or a new listener is
+        added to the same object. TimelineRecordingContentView also had a leak where
+        TimelineManager and DebuggerManager listeners were not being removed.
+
+        Reviewed by Darin Adler.
+
+        * UserInterface/Views/ApplicationCacheFrameContentView.js:
+        (WebInspector.ApplicationCacheFrameContentView.prototype.closed):
+        * UserInterface/Views/ClusterContentView.js:
+        (WebInspector.ClusterContentView.prototype.closed):
+        * UserInterface/Views/ContentFlowDOMTreeContentView.js:
+        (WebInspector.ContentFlowDOMTreeContentView.prototype.closed):
+        * UserInterface/Views/FrameDOMTreeContentView.js:
+        (WebInspector.FrameDOMTreeContentView.prototype.closed):
+        * UserInterface/Views/ResourceContentView.js:
+        (WebInspector.ResourceContentView.prototype.closed):
+        * UserInterface/Views/TextResourceContentView.js:
+        (WebInspector.TextResourceContentView.prototype.closed):
+        * UserInterface/Views/TimelineRecordingContentView.js:
+        (WebInspector.TimelineRecordingContentView.prototype.closed):
+
 2015-04-25  Tobias Reiss  <tobi+webkit@basecode.de>
 
         Web Inspector: assertion failure when editing inline styles
index 5d86139..08c32ea 100644 (file)
@@ -65,7 +65,7 @@ WebInspector.ApplicationCacheFrameContentView.prototype = {
 
     closed: function()
     {
-        WebInspector.applicationCacheManager.removeEventListener(WebInspector.ApplicationCacheManager.Event.FrameManifestStatusChanged, this._updateStatus, this);
+        WebInspector.applicationCacheManager.removeEventListener(null, null, this);
     },
 
     updateLayout: function()
index ac9836a..6afbb66 100644 (file)
@@ -84,9 +84,7 @@ WebInspector.ClusterContentView.prototype = {
     {
         this._contentViewContainer.closeAllContentViews();
 
-        WebInspector.ContentView.removeEventListener(WebInspector.ContentView.Event.SelectionPathComponentsDidChange, this._contentViewSelectionPathComponentDidChange, this);
-        WebInspector.ContentView.removeEventListener(WebInspector.ContentView.Event.SupplementalRepresentedObjectsDidChange, this._contentViewSupplementalRepresentedObjectsDidChange, this);
-        WebInspector.ContentView.removeEventListener(WebInspector.ContentView.Event.NumberOfSearchResultsDidChange, this._contentViewNumberOfSearchResultsDidChange, this);
+        WebInspector.ContentView.removeEventListener(null, null, this);
     },
 
     canGoBack: function()
index 3dc0a6f..dc1568a 100644 (file)
@@ -47,8 +47,8 @@ WebInspector.ContentFlowDOMTreeContentView.prototype = {
 
     closed: function()
     {
-        this.representedObject.removeEventListener(WebInspector.ContentFlow.Event.ContentNodeWasAdded, this._contentNodeWasAdded, this);
-        this.representedObject.removeEventListener(WebInspector.ContentFlow.Event.ContentNodeWasRemoved, this._contentNodeWasRemoved, this);
+        this.representedObject.removeEventListener(null, null, this);
+
         WebInspector.DOMTreeContentView.prototype.closed.call(this);
     },
 
index c8cec6e..fa53474 100644 (file)
@@ -55,6 +55,7 @@ WebInspector.FrameDOMTreeContentView.prototype = {
     closed: function()
     {
         this._domTree.removeEventListener(null, null, this);
+
         WebInspector.DOMTreeContentView.prototype.closed.call(this);
     },
 
index 4a4f60e..0e147ff 100644 (file)
@@ -79,7 +79,7 @@ WebInspector.ResourceContentView.prototype = {
     closed: function()
     {
         if (!this.managesOwnIssues)
-            WebInspector.issueManager.removeEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._issueWasAdded, this);
+            WebInspector.issueManager.removeEventListener(null, null, this);
     },
 
     // Private
index 1728734..774b0a0 100644 (file)
@@ -121,7 +121,7 @@ WebInspector.TextResourceContentView.prototype = {
     {
         WebInspector.ResourceContentView.prototype.closed.call(this);
 
-        this.resource.removeEventListener(WebInspector.SourceCode.Event.ContentDidChange, this._sourceCodeContentDidChange, this);
+        this.resource.removeEventListener(null, null, this);
 
         this._textEditor.close();
     },
index 2d343d5..c00a5bb 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()