Web Inspector: small memory leak in scripts panel.
[WebKit-https.git] / Source / WebCore / inspector / front-end / ScriptsPanel.js
index 637079dbe8f525157e5d75159136d2fe028ca380..8a0a0fec793fd9387231149236eb3ffbc879ba0d 100644 (file)
@@ -171,6 +171,7 @@ WebInspector.ScriptsPanel = function(presentationModel)
 
     this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeAdded, this._uiSourceCodeAdded, this)
     this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeReplaced, this._uiSourceCodeReplaced, this);
+    this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.UISourceCodeRemoved, this._uiSourceCodeRemoved, this);
     this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.ConsoleMessageAdded, this._consoleMessageAdded, this);
     this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.ConsoleMessagesCleared, this._consoleMessagesCleared, this);
     this._presentationModel.addEventListener(WebInspector.DebuggerPresentationModel.Events.BreakpointAdded, this._breakpointAdded, this);
@@ -253,6 +254,13 @@ WebInspector.ScriptsPanel.prototype = {
             this._showSourceFrameAndAddToHistory(uiSourceCode);
     },
 
+    _uiSourceCodeRemoved: function(event)
+    {
+        var uiSourceCode = event.data;
+        if (uiSourceCode._sourceFrame)
+            this.removeChildView(uiSourceCode._sourceFrame);
+    },
+
     _showScriptFoldersSettingChanged: function()
     {
         var selectedOption = this._filesSelectElement[this._filesSelectElement.selectedIndex];