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 54f037100a7696ce56178c0993fe734e1171454b..673510b1080b5ec3a9672bb0e134653d527ba569 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 5d861398b39ec70ae7b0403658880038e9b95bde..08c32ea4f0c871162fb5f05ed9043c193f48be9b 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 ac9836a500e0bce7d48ee14a77baf1a0aaa9e9fb..6afbb66bb1f8b2630b0b15074f551d3ec73bd8ec 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 3dc0a6f7fc901ac103a4bc66c619824b4f157cf1..dc1568a652492533d31a024173dd5154a0759f9a 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 c8cec6ec38a15c28915a0b95d8c05ca3cf55b765..fa534743e2acebd16ba46c9d243b98575ce6d8f9 100644 (file)
@@ -55,6 +55,7 @@ WebInspector.FrameDOMTreeContentView.prototype = {
     closed: function()
     {
         this._domTree.removeEventListener(null, null, this);
+
         WebInspector.DOMTreeContentView.prototype.closed.call(this);
     },
 
index 4a4f60e443b3c1f573397f0f834af44e5e8bde48..0e147ffda221ae11a8ef9c4f4ac45171dfa97746 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 17287347926b5cf913f145504746cffb1fc2176c..774b0a0e523c5063a8de67998decb64aab438bcd 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 2d343d51a859371f47502623b63d6a25485ef58b..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()