Modified: trunk/Source/WebInspectorUI/ChangeLog (181183 => 181184)
--- trunk/Source/WebInspectorUI/ChangeLog 2015-03-06 22:31:28 UTC (rev 181183)
+++ trunk/Source/WebInspectorUI/ChangeLog 2015-03-06 22:33:27 UTC (rev 181184)
@@ -1,3 +1,34 @@
+2015-03-06 Jono Wells <jonowe...@apple.com>
+
+ Web Inspector: Populate Debugger sidebar with all debuggable resources
+ https://bugs.webkit.org/show_bug.cgi?id=141232
+
+ Reviewed by Timothy Hatcher.
+
+ All debuggable resources now show in the debugger sidebar. The _resourceAdded handler now adds a script resource
+ to the sidebar regardless of whether it has any breakpoints set on it. The new function
+ _getTreeElementForSourceCodeAndAddToContentTreeOutline adds the element to the debugger sidebar before
+ _addBreakpointsForSourceCode is called. Removing all breakpoints from a resource no longer removes that
+ resource from the debugger sidebar. TreeOutline.prototype.removeChild has been updated so the disclosure
+ button will disappear and reappear correctly when removing/adding breakpoints.
+
+ * UserInterface/Views/DebuggerSidebarPanel.js:
+ (WebInspector.DebuggerSidebarPanel.prototype._addBreakpoint): Expand resource if first breakpoint is added.
+ (WebInspector.DebuggerSidebarPanel.prototype._getTreeElementForSourceCodeAndAddToContentTreeOutline): Created.
+ (WebInspector.DebuggerSidebarPanel.prototype._resourceAdded): Checks resource type and adds scripts to sidebar.
+ (WebInspector.DebuggerSidebarPanel.prototype._mainResourceChanged):
+ (WebInspector.DebuggerSidebarPanel.prototype._scriptAdded):
+ (WebInspector.DebuggerSidebarPanel.prototype._removeBreakpointTreeElement): No longer removes empty parent.
+ (WebInspector.DebuggerSidebarPanel.prototype._treeElementSelected): Displays scripts without breakpoints now.
+
+ * UserInterface/Views/GeneralTreeElement.js:
+ (WebInspector.GeneralTreeElement.prototype.get disclosureButton): Drive-by fix. Unused. Deleted.
+
+ * UserInterface/Views/TreeOutline.js:
+ (TreeOutline.prototype.removeChild):
+ Remove parent class and set hasChildren to false if necessary to properly hide and reveal disclosure button
+ for elements whose children have been removed.
+
2015-03-05 Joseph Pecoraro <pecor...@apple.com>
Web Inspector: Follow-up fixes to ObjectTreeBaseTreeElement
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js (181183 => 181184)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js 2015-03-06 22:31:28 UTC (rev 181183)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js 2015-03-06 22:33:27 UTC (rev 181184)
@@ -153,6 +153,7 @@
WebInspector.DebuggerSidebarPanel.prototype = {
constructor: WebInspector.DebuggerSidebarPanel,
+ __proto__: WebInspector.NavigationSidebarPanel.prototype,
// Public
@@ -278,23 +279,8 @@
if (!sourceCode)
return null;
- var parentTreeElement = this._breakpointsContentTreeOutline.getCachedTreeElement(sourceCode);
- if (!parentTreeElement) {
- if (sourceCode instanceof WebInspector.SourceMapResource)
- parentTreeElement = new WebInspector.SourceMapResourceTreeElement(sourceCode);
- else if (sourceCode instanceof WebInspector.Resource)
- parentTreeElement = new WebInspector.ResourceTreeElement(sourceCode);
- else if (sourceCode instanceof WebInspector.Script)
- parentTreeElement = new WebInspector.ScriptTreeElement(sourceCode);
- }
+ var parentTreeElement = this._addTreeElementForSourceCodeToContentTreeOutline(sourceCode);
- if (!parentTreeElement.parent) {
- parentTreeElement.hasChildren = true;
- parentTreeElement.expand();
-
- this._breakpointsContentTreeOutline.insertChild(parentTreeElement, insertionIndexForObjectInListSortedByFunction(parentTreeElement, this._breakpointsContentTreeOutline.children, this._compareTopLevelTreeElements.bind(this)));
- }
-
// Mark disabled breakpoints as resolved if there is source code loaded with that URL.
// This gives the illusion the breakpoint was resolved, but since we don't send disabled
// breakpoints to the backend we don't know for sure. If the user enables the breakpoint
@@ -304,6 +290,8 @@
var breakpointTreeElement = new WebInspector.BreakpointTreeElement(breakpoint);
parentTreeElement.insertChild(breakpointTreeElement, insertionIndexForObjectInListSortedByFunction(breakpointTreeElement, parentTreeElement.children, this._compareBreakpointTreeElements));
+ if (parentTreeElement.children.length === 1)
+ parentTreeElement.expand();
return breakpointTreeElement;
},
@@ -314,15 +302,43 @@
this._addBreakpoint(breakpoints[i], sourceCode);
},
+ _addTreeElementForSourceCodeToContentTreeOutline: function(sourceCode)
+ {
+ var treeElement = this._breakpointsContentTreeOutline.getCachedTreeElement(sourceCode);
+ if (!treeElement) {
+ if (sourceCode instanceof WebInspector.SourceMapResource)
+ treeElement = new WebInspector.SourceMapResourceTreeElement(sourceCode);
+ else if (sourceCode instanceof WebInspector.Resource)
+ treeElement = new WebInspector.ResourceTreeElement(sourceCode);
+ else if (sourceCode instanceof WebInspector.Script)
+ treeElement = new WebInspector.ScriptTreeElement(sourceCode);
+ }
+
+ if (!treeElement.parent) {
+ treeElement.hasChildren = false;
+ treeElement.expand();
+
+ this._breakpointsContentTreeOutline.insertChild(treeElement, insertionIndexForObjectInListSortedByFunction(treeElement, this._breakpointsContentTreeOutline.children, this._compareTopLevelTreeElements.bind(this)));
+ }
+
+ return treeElement;
+ },
+
_resourceAdded: function(event)
{
var resource = event.data.resource;
+
+ if (![WebInspector.Resource.Type.Document, WebInspector.Resource.Type.Script].contains(resource.type))
+ return;
+
+ this._addTreeElementForSourceCodeToContentTreeOutline(resource);
this._addBreakpointsForSourceCode(resource);
},
_mainResourceChanged: function(event)
{
var resource = event.target.mainResource;
+ this._addTreeElementForSourceCodeToContentTreeOutline(resource);
this._addBreakpointsForSourceCode(resource);
},
@@ -330,11 +346,21 @@
{
var script = event.data.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)
+ return;
+
+ // Exclude inspector scripts.
+ if (script.url && script.url.indexOf("__WebInspector") === 0)
+ return;
+
// Don't add breakpoints if the script is represented by a Resource. They were
// already added by _resourceAdded.
if (script.resource)
return;
+ this._addTreeElementForSourceCodeToContentTreeOutline(script);
this._addBreakpointsForSourceCode(script);
},
@@ -401,9 +427,6 @@
parentTreeElement.removeChild(breakpointTreeElement);
console.assert(parentTreeElement.parent === this._breakpointsContentTreeOutline);
-
- if (!parentTreeElement.children.length)
- this._breakpointsContentTreeOutline.removeChild(parentTreeElement);
},
_debuggerCallFramesDidChange: function()
@@ -560,9 +583,6 @@
}
if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
- // If the resource is being selected when it has no children it is in the process of being deleted, don't do anything.
- if (!treeElement.children.length)
- return;
deselectCallStackContentTreeElements.call(this);
deselectPauseReasonContentTreeElements.call(this);
WebInspector.resourceSidebarPanel.showSourceCode(treeElement.representedObject);
@@ -645,7 +665,7 @@
_updatePauseReasonSection: function()
{
var pauseData = WebInspector.debuggerManager.pauseData;
-
+
switch (WebInspector.debuggerManager.pauseReason) {
case WebInspector.DebuggerManager.PauseReason.Assertion:
// FIXME: We should include the assertion condition string.
@@ -653,7 +673,7 @@
if (pauseData && pauseData.message) {
this._pauseReasonTextRow.text = WebInspector.UIString("Assertion with message: %s").format(pauseData.message);
return true;
- }
+ }
this._pauseReasonTextRow.text = WebInspector.UIString("Assertion Failed");
this._pauseReasonGroup.rows = [this._pauseReasonTextRow];
@@ -731,5 +751,3 @@
this._pauseReasonLinkContainerElement.appendChild(linkElement);
}
};
-
-WebInspector.DebuggerSidebarPanel.prototype.__proto__ = WebInspector.NavigationSidebarPanel.prototype;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js (181183 => 181184)
--- trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js 2015-03-06 22:31:28 UTC (rev 181183)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js 2015-03-06 22:33:27 UTC (rev 181184)
@@ -61,12 +61,6 @@
return this._listItemNode;
},
- get disclosureButton()
- {
- this._createElementsIfNeeded();
- return this._disclosureButton;
- },
-
get iconElement()
{
this._createElementsIfNeeded();
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js (181183 => 181184)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js 2015-03-06 22:31:28 UTC (rev 181183)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js 2015-03-06 22:33:27 UTC (rev 181184)
@@ -192,6 +192,11 @@
throw "child not found in this node's children";
this.removeChildAtIndex(childIndex, suppressOnDeselect, suppressSelectSibling);
+
+ if (!this.children.length) {
+ this._listItemNode.classList.remove("parent");
+ this.hasChildren = false;
+ }
};
TreeOutline.prototype.removeChildren = function(suppressOnDeselect)