Web Inspector: Allow closing and reopening the Debugger tab
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 May 2015 20:36:31 +0000 (20:36 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 4 May 2015 20:36:31 +0000 (20:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144536

Reviewed by Joseph Pecoraro.

* UserInterface/Base/Main.js:
(WebInspector._updateNewTabButtonState):
* UserInterface/Views/DebuggerSidebarPanel.js:
(WebInspector.DebuggerSidebarPanel):
(WebInspector.DebuggerSidebarPanel.prototype.closed):
(WebInspector.DebuggerSidebarPanel.prototype._addIssuesForSourceCode):
(WebInspector.DebuggerSidebarPanel.prototype._addResourcesRecursivelyForFrame):
(WebInspector.DebuggerSidebarPanel.prototype._resourceAdded):
(WebInspector.DebuggerSidebarPanel.prototype._addResource):
(WebInspector.DebuggerSidebarPanel.prototype._mainResourceChanged):
(WebInspector.DebuggerSidebarPanel.prototype._scriptAdded):
(WebInspector.DebuggerSidebarPanel.prototype._addScript):
* UserInterface/Views/DebuggerTabContentView.js:
(WebInspector.DebuggerTabContentView):
* UserInterface/Views/NewTabContentView.js:
(WebInspector.NewTabContentView):

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

Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/UserInterface/Base/Main.js
Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/DebuggerTabContentView.js
Source/WebInspectorUI/UserInterface/Views/NewTabContentView.js

index a6cf153..002cc4b 100644 (file)
@@ -1,5 +1,29 @@
 2015-05-04  Timothy Hatcher  <timothy@apple.com>
 
+        Web Inspector: Allow closing and reopening the Debugger tab
+        https://bugs.webkit.org/show_bug.cgi?id=144536
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector._updateNewTabButtonState):
+        * UserInterface/Views/DebuggerSidebarPanel.js:
+        (WebInspector.DebuggerSidebarPanel):
+        (WebInspector.DebuggerSidebarPanel.prototype.closed):
+        (WebInspector.DebuggerSidebarPanel.prototype._addIssuesForSourceCode):
+        (WebInspector.DebuggerSidebarPanel.prototype._addResourcesRecursivelyForFrame):
+        (WebInspector.DebuggerSidebarPanel.prototype._resourceAdded):
+        (WebInspector.DebuggerSidebarPanel.prototype._addResource):
+        (WebInspector.DebuggerSidebarPanel.prototype._mainResourceChanged):
+        (WebInspector.DebuggerSidebarPanel.prototype._scriptAdded):
+        (WebInspector.DebuggerSidebarPanel.prototype._addScript):
+        * UserInterface/Views/DebuggerTabContentView.js:
+        (WebInspector.DebuggerTabContentView):
+        * UserInterface/Views/NewTabContentView.js:
+        (WebInspector.NewTabContentView):
+
+2015-05-04  Timothy Hatcher  <timothy@apple.com>
+
         REGRESSION: Web Inspector: FrameTreeElement does not folders properly when loading a page
         https://bugs.webkit.org/show_bug.cgi?id=144535
 
index 6a40a32..62ffb07 100644 (file)
@@ -431,7 +431,7 @@ WebInspector._updateNewTabButtonState = function(event)
 {
     var newTabAllowed = this.isNewTabWithTypeAllowed(WebInspector.ConsoleTabContentView.Type) || this.isNewTabWithTypeAllowed(WebInspector.ElementsTabContentView.Type)
         || this.isNewTabWithTypeAllowed(WebInspector.ResourcesTabContentView.Type) || this.isNewTabWithTypeAllowed(WebInspector.StorageTabContentView.Type)
-        || this.isNewTabWithTypeAllowed(WebInspector.TimelineTabContentView.Type);
+        || this.isNewTabWithTypeAllowed(WebInspector.TimelineTabContentView.Type) || this.isNewTabWithTypeAllowed(WebInspector.DebuggerTabContentView.Type);
     this.tabBar.newTabItem.disabled = !newTabAllowed;
 };
 
index 84b67a5..cc05a67 100644 (file)
@@ -166,10 +166,26 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
         WebInspector.IssueMessage.addEventListener(WebInspector.IssueMessage.Event.DisplayLocationDidChange, this._handleDebuggerObjectDisplayLocationDidChange, this);
         WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.IssueWasAdded, this._handleIssueAdded, this);
         WebInspector.issueManager.addEventListener(WebInspector.IssueManager.Event.Cleared, this._handleIssuesCleared, this);
+
+        if (WebInspector.frameResourceManager.mainFrame)
+            this._addResourcesRecursivelyForFrame(WebInspector.frameResourceManager.mainFrame);
+
+        for (var script of WebInspector.debuggerManager.knownNonResourceScripts)
+            this._addScript(script);
     }
 
     // Public
 
+    closed()
+    {
+        super.closed();
+
+        WebInspector.Frame.removeEventListener(null, null, this);
+        WebInspector.debuggerManager.removeEventListener(null, null, this);
+        WebInspector.Breakpoint.removeEventListener(null, null, this);
+        WebInspector.IssueMessage.removeEventListener(null, null, this);
+    }
+
     get hasSelectedElement()
     {
         return !!this._breakpointsContentTreeOutline.selectedTreeElement
@@ -302,6 +318,13 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
             this._addBreakpoint(breakpoints[i], sourceCode);
     }
 
+    _addIssuesForSourceCode(sourceCode)
+    {
+        var issues = WebInspector.issueManager.issuesForSourceCode(sourceCode);
+        for (var issue of issues)
+            this._addIssue(issue);
+    }
+
     _addTreeElementForSourceCodeToContentTreeOutline(sourceCode)
     {
         var treeElement = this._breakpointsContentTreeOutline.getCachedTreeElement(sourceCode);
@@ -329,15 +352,30 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
         return treeElement;
     }
 
+    _addResourcesRecursivelyForFrame(frame)
+    {
+        this._addResource(frame.mainResource);
+
+        for (var resource of frame.resources)
+            this._addResource(resource);
+
+        for (var childFrame of frame.childFrames)
+            this._addResourcesRecursivelyForFrame(childFrame);
+    }
+
     _resourceAdded(event)
     {
-        var resource = event.data.resource;
+        this._addResource(event.data.resource);
+    }
 
+    _addResource(resource)
+    {
         if (![WebInspector.Resource.Type.Document, WebInspector.Resource.Type.Script].includes(resource.type))
             return;
 
         this._addTreeElementForSourceCodeToContentTreeOutline(resource);
         this._addBreakpointsForSourceCode(resource);
+        this._addIssuesForSourceCode(resource);
     }
 
     _mainResourceChanged(event)
@@ -345,12 +383,16 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
         var resource = event.target.mainResource;
         this._addTreeElementForSourceCodeToContentTreeOutline(resource);
         this._addBreakpointsForSourceCode(resource);
+        this._addIssuesForSourceCode(resource);
     }
 
     _scriptAdded(event)
     {
-        var script = event.data.script;
+        this._addScript(event.data.script);
+    }
 
+    _addScript(script)
+    {
         // FIXME: Allow for scripts generated by eval statements to appear, but filter out JSC internals
         // and other WebInspector internals lacking __WebInspector in the url attribute.
         if (!script.url)
@@ -367,6 +409,7 @@ WebInspector.DebuggerSidebarPanel = class DebuggerSidebarPanel extends WebInspec
 
         this._addTreeElementForSourceCodeToContentTreeOutline(script);
         this._addBreakpointsForSourceCode(script);
+        this._addIssuesForSourceCode(script);
     }
 
     _scriptsCleared(event)
index 433118f..2e1a1fc 100644 (file)
@@ -28,9 +28,6 @@ WebInspector.DebuggerTabContentView = function(identifier)
     var tabBarItem = new WebInspector.TabBarItem("Images/Debugger.svg", WebInspector.UIString("Debugger"));
     var detailsSidebarPanels = [WebInspector.resourceDetailsSidebarPanel, WebInspector.scopeChainDetailsSidebarPanel, WebInspector.probeDetailsSidebarPanel];
 
-    // FIME: Until DebuggerSidebarPanel supports instantiating after inspector launch, disable closing.
-    tabBarItem.hideCloseButton = true;
-
     WebInspector.ContentBrowserTabContentView.call(this, identifier || "debugger", "debugger", tabBarItem, WebInspector.DebuggerSidebarPanel, detailsSidebarPanels);
 };
 
index 992731d..1798a67 100644 (file)
@@ -33,6 +33,7 @@ WebInspector.NewTabContentView = function(identifier)
         {image: "Images/Elements.svg", title: WebInspector.UIString("Elements"), type: WebInspector.ElementsTabContentView.Type},
         {image: "Images/Resources.svg", title: WebInspector.UIString("Resources"), type: WebInspector.ResourcesTabContentView.Type},
         {image: "Images/Timeline.svg", title: WebInspector.UIString("Timelines"), type: WebInspector.TimelineTabContentView.Type},
+        {image: "Images/Debugger.svg", title: WebInspector.UIString("Debugger"), type: WebInspector.DebuggerTabContentView.Type},
         {image: "Images/Storage.svg", title: WebInspector.UIString("Storage"), type: WebInspector.StorageTabContentView.Type},
         {image: "Images/Console.svg", title: WebInspector.UIString("Console"), type: WebInspector.ConsoleTabContentView.Type}
     ];