https://bugs.webkit.org/show_bug.cgi?id=168021
Patch by Devin Rousso <dcrousso+webkit@gmail.com> on 2017-02-21
Reviewed by Timothy Hatcher.
* UserInterface/Base/Main.js:
(WebInspector.handlePossibleLinkClick):
(WebInspector.openURL):
Add `options` parameter to provide greater customization.
* UserInterface/Views/TabBrowser.js:
(WebInspector.TabBrowser.prototype.bestTabContentViewForRepresentedObject):
Add logic for `ignoreNetworkTab` option that will ignore instances of NetworkTabContentView.
* UserInterface/Controllers/BreakpointPopoverController.js:
(WebInspector.BreakpointPopoverController.prototype.appendContextMenuItems):
* UserInterface/Protocol/InspectorFrontendAPI.js:
(InspectorFrontendAPI.showMainResourceForFrame):
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.tokenTrackingControllerHighlightedRangeWasClicked.showRangeInSourceCode):
* UserInterface/Views/ComputedStyleDetailsPanel.js:
(WebInspector.ComputedStyleDetailsPanel.prototype.cssStyleDeclarationTextEditorShowProperty):
* UserInterface/Views/ContextMenuUtilities.js:
(WebInspector.appendContextMenuItemsForSourceCode):
* UserInterface/Views/DOMTreeContentView.js:
(WebInspector.DOMTreeContentView.prototype._mouseWasClicked.followLink):
* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement.prototype._populateTagContextMenu):
(WebInspector.DOMTreeElement.prototype._showCustomElementDefinition):
* UserInterface/Views/DebuggerSidebarPanel.js:
(WebInspector.DebuggerSidebarPanel.prototype._treeSelectionDidChange):
* UserInterface/Views/NetworkTimelineView.js:
(WebInspector.NetworkTimelineView.prototype.showContentViewForTreeElement):
* UserInterface/Views/ObjectTreeBaseTreeElement.js:
(WebInspector.ObjectTreeBaseTreeElement.prototype._appendMenusItemsForObject):
* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange):
* UserInterface/Views/ResourceTimelineDataGridNode.js:
(WebInspector.ResourceTimelineDataGridNode.prototype._dataGridNodeGoToArrowClicked):
* UserInterface/Views/SearchSidebarPanel.js:
(WebInspector.SearchSidebarPanel.prototype._treeSelectionDidChange):
(WebInspector.SearchSidebarPanel.prototype._treeElementDoubleClick):
* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.tokenTrackingControllerHighlightedRangeWasClicked):
* UserInterface/Views/TimelineDataGrid.js:
(WebInspector.TimelineDataGrid.prototype._popoverCallStackTreeSelectionDidChange):
* UserInterface/Views/VisualStyleSelectorTreeItem.js:
(WebInspector.VisualStyleSelectorTreeItem.prototype.populateContextMenu):
Change arguments of functions to change content views to ignore the Network tab.
* UserInterface/Views/NetworkGridContentView.js:
(WebInspector.NetworkGridContentView.prototype.hasRepresentedObject):
* UserInterface/Views/NetworkSidebarPanel.js:
(WebInspector.NetworkSidebarPanel.prototype.hasRepresentedObject):
* UserInterface/Views/NetworkTabContentView.js:
(WebInspector.NetworkTabContentView.prototype.canShowRepresentedObject):
Ensure that the Network tab can only display resources that it has entries for in its view.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@212761
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2017-02-21 Devin Rousso <dcrousso+webkit@gmail.com>
+
+ Web Inspector: Prefer Resources tab over Network tab when showing files
+ https://bugs.webkit.org/show_bug.cgi?id=168021
+
+ Reviewed by Timothy Hatcher.
+
+ * UserInterface/Base/Main.js:
+ (WebInspector.handlePossibleLinkClick):
+ (WebInspector.openURL):
+ Add `options` parameter to provide greater customization.
+
+ * UserInterface/Views/TabBrowser.js:
+ (WebInspector.TabBrowser.prototype.bestTabContentViewForRepresentedObject):
+ Add logic for `ignoreNetworkTab` option that will ignore instances of NetworkTabContentView.
+
+ * UserInterface/Controllers/BreakpointPopoverController.js:
+ (WebInspector.BreakpointPopoverController.prototype.appendContextMenuItems):
+ * UserInterface/Protocol/InspectorFrontendAPI.js:
+ (InspectorFrontendAPI.showMainResourceForFrame):
+ * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+ (WebInspector.CSSStyleDeclarationTextEditor.tokenTrackingControllerHighlightedRangeWasClicked.showRangeInSourceCode):
+ * UserInterface/Views/ComputedStyleDetailsPanel.js:
+ (WebInspector.ComputedStyleDetailsPanel.prototype.cssStyleDeclarationTextEditorShowProperty):
+ * UserInterface/Views/ContextMenuUtilities.js:
+ (WebInspector.appendContextMenuItemsForSourceCode):
+ * UserInterface/Views/DOMTreeContentView.js:
+ (WebInspector.DOMTreeContentView.prototype._mouseWasClicked.followLink):
+ * UserInterface/Views/DOMTreeElement.js:
+ (WebInspector.DOMTreeElement.prototype._populateTagContextMenu):
+ (WebInspector.DOMTreeElement.prototype._showCustomElementDefinition):
+ * UserInterface/Views/DebuggerSidebarPanel.js:
+ (WebInspector.DebuggerSidebarPanel.prototype._treeSelectionDidChange):
+ * UserInterface/Views/NetworkTimelineView.js:
+ (WebInspector.NetworkTimelineView.prototype.showContentViewForTreeElement):
+ * UserInterface/Views/ObjectTreeBaseTreeElement.js:
+ (WebInspector.ObjectTreeBaseTreeElement.prototype._appendMenusItemsForObject):
+ * UserInterface/Views/ResourceSidebarPanel.js:
+ (WebInspector.ResourceSidebarPanel.prototype._treeSelectionDidChange):
+ * UserInterface/Views/ResourceTimelineDataGridNode.js:
+ (WebInspector.ResourceTimelineDataGridNode.prototype._dataGridNodeGoToArrowClicked):
+ * UserInterface/Views/SearchSidebarPanel.js:
+ (WebInspector.SearchSidebarPanel.prototype._treeSelectionDidChange):
+ (WebInspector.SearchSidebarPanel.prototype._treeElementDoubleClick):
+ * UserInterface/Views/SourceCodeTextEditor.js:
+ (WebInspector.SourceCodeTextEditor.prototype.tokenTrackingControllerHighlightedRangeWasClicked):
+ * UserInterface/Views/TimelineDataGrid.js:
+ (WebInspector.TimelineDataGrid.prototype._popoverCallStackTreeSelectionDidChange):
+ * UserInterface/Views/VisualStyleSelectorTreeItem.js:
+ (WebInspector.VisualStyleSelectorTreeItem.prototype.populateContextMenu):
+ Change arguments of functions to change content views to ignore the Network tab.
+
+ * UserInterface/Views/NetworkGridContentView.js:
+ (WebInspector.NetworkGridContentView.prototype.hasRepresentedObject):
+ * UserInterface/Views/NetworkSidebarPanel.js:
+ (WebInspector.NetworkSidebarPanel.prototype.hasRepresentedObject):
+ * UserInterface/Views/NetworkTabContentView.js:
+ (WebInspector.NetworkTabContentView.prototype.canShowRepresentedObject):
+ Ensure that the Network tab can only display resources that it has entries for in its view.
+
2017-02-21 Brian Burg <bburg@apple.com>
Web Inspector: RTL: console scope bar's unread message indicator is misaligned
event.preventDefault();
event.stopPropagation();
- this.openURL(anchorElement.href, frame, false, anchorElement.lineNumber);
+ this.openURL(anchorElement.href, frame, {lineNumber: anchorElement.lineNumber});
return true;
};
-WebInspector.openURL = function(url, frame, alwaysOpenExternally, lineNumber)
+WebInspector.openURL = function(url, frame, options = {})
{
console.assert(url);
if (!url)
return;
- console.assert(typeof lineNumber === "undefined" || typeof lineNumber === "number", "lineNumber should be a number.");
+ console.assert(typeof options.lineNumber === "undefined" || typeof options.lineNumber === "number", "lineNumber should be a number.");
// If alwaysOpenExternally is not defined, base it off the command/meta key for the current event.
- if (alwaysOpenExternally === undefined || alwaysOpenExternally === null)
- alwaysOpenExternally = window.event ? window.event.metaKey : false;
+ if (options.alwaysOpenExternally === undefined || options.alwaysOpenExternally === null)
+ options.alwaysOpenExternally = window.event ? window.event.metaKey : false;
- if (alwaysOpenExternally) {
+ if (options.alwaysOpenExternally) {
InspectorFrontendHost.openInNewTab(url);
return;
}
let simplifiedURL = removeURLFragment(url);
var resource = frame.url === simplifiedURL ? frame.mainResource : frame.resourceForURL(simplifiedURL, searchChildFrames);
if (resource) {
- var position = new WebInspector.SourceCodePosition(lineNumber, 0);
- this.showSourceCode(resource, position);
+ let positionToReveal = new WebInspector.SourceCodePosition(options.lineNumber, 0);
+ this.showSourceCode(resource, Object.shallowMerge(options, {positionToReveal}));
return;
}
};
const revealOriginalSourceCodeLocation = () => {
- WebInspector.showOriginalOrFormattedSourceCodeLocation(breakpoint.sourceCodeLocation);
+ WebInspector.showOriginalOrFormattedSourceCodeLocation(breakpoint.sourceCodeLocation, {ignoreNetworkTab: true});
};
if (WebInspector.debuggerManager.isBreakpointEditable(breakpoint))
showMainResourceForFrame: function(frameIdentifier)
{
- WebInspector.showSourceCodeForFrame(frameIdentifier);
+ WebInspector.showSourceCodeForFrame(frameIdentifier, {ignoreNetworkTab: true});
},
contextMenuItemSelected: function(id)
if (!sourceCode || !range)
return false;
- WebInspector.showSourceCodeLocation(sourceCode.createSourceCodeLocation(range.startLine, range.startColumn));
+ WebInspector.showSourceCodeLocation(sourceCode.createSourceCodeLocation(range.startLine, range.startColumn), {ignoreNetworkTab: true});
return true;
}
let sourceCode = ownerRule.sourceCodeLocation.sourceCode;
let {startLine, startColumn} = effectiveProperty.styleSheetTextRange;
let sourceCodeLocation = sourceCode.createSourceCodeLocation(startLine, startColumn);
- WebInspector.showSourceCodeLocation(sourceCodeLocation);
+ WebInspector.showSourceCodeLocation(sourceCodeLocation, {ignoreNetworkTab: true});
}
refresh(significantChange)
if (sourceCode.url) {
contextMenu.appendItem(WebInspector.UIString("Open in New Tab"), () => {
const frame = null;
- const alwaysOpenExternally = true;
- WebInspector.openURL(sourceCode.url, frame, alwaysOpenExternally);
+ WebInspector.openURL(sourceCode.url, frame, {alwaysOpenExternally: true});
});
contextMenu.appendItem(WebInspector.UIString("Copy Link Address"), () => {
// to see if the command key is down like it normally would. So we need to do that check
// before calling WebInspector.openURL.
var alwaysOpenExternally = event ? event.metaKey : false;
- WebInspector.openURL(anchorElement.href, this._frame, alwaysOpenExternally, anchorElement.lineNumber);
+ WebInspector.openURL(anchorElement.href, this._frame, {alwaysOpenExternally, lineNumber: anchorElement.lineNumber});
}
// Start a timeout since this is a single click, if the timeout is canceled before it fires,
contextMenu.appendItem(WebInspector.UIString("Open in New Tab"), () => {
const frame = null;
- const alwaysOpenExternally = true;
- WebInspector.openURL(url, frame, alwaysOpenExternally);
+ WebInspector.openURL(url, frame, {alwaysOpenExternally: true});
});
if (WebInspector.frameResourceManager.resourceForURL(url)) {
contextMenu.appendItem(WebInspector.UIString("Reveal in Resources Tab"), () => {
let frame = WebInspector.frameResourceManager.frameForIdentifier(node.frameIdentifier);
- WebInspector.openURL(url, frame);
+ WebInspector.openURL(url, frame, {ignoreNetworkTab: true});
});
}
return;
let sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber || 0);
- WebInspector.showSourceCodeLocation(sourceCodeLocation);
+ WebInspector.showSourceCodeLocation(sourceCodeLocation, {ignoreNetworkTab: true});
});
result.release();
});
return;
if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
- WebInspector.showSourceCode(treeElement.representedObject);
+ WebInspector.showSourceCode(treeElement.representedObject, {ignoreNetworkTab: true});
return;
}
WebInspector.debuggerManager.activeCallFrame = callFrame;
if (callFrame.sourceCodeLocation)
- WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation);
+ WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation, {ignoreNetworkTab: true});
return;
}
if (treeElement instanceof WebInspector.IssueTreeElement) {
- WebInspector.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation);
+ WebInspector.showSourceCodeLocation(treeElement.issueMessage.sourceCodeLocation, {ignoreNetworkTab: true});
return;
}
let breakpoint = treeElement.breakpoint;
if (treeElement.treeOutline === this._pauseReasonTreeOutline) {
- WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation);
+ WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation, {ignoreNetworkTab: true});
return;
}
if (!(treeElement.parent.representedObject instanceof WebInspector.SourceCode))
return;
- WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation);
+ WebInspector.showSourceCodeLocation(breakpoint.sourceCodeLocation, {ignoreNetworkTab: true});
}
_compareTopLevelTreeElements(a, b)
this.reset();
}
+ hasRepresentedObject(representedObject)
+ {
+ const comparator = (dataGridNode) => dataGridNode.resource === representedObject;
+ const skipHidden = true;
+ const stayWithin = false;
+ const dontPopulate = true;
+ return this._dataGrid.findNode(comparator, skipHidden, stayWithin, dontPopulate);
+ }
+
// Private
_processPendingRecords()
return !this.restoringState || !this._restoredShowingNetworkGridContentView;
}
+ hasRepresentedObject(representedObject)
+ {
+ return this._networkGridView.hasRepresentedObject(representedObject);
+ }
+
// Protected
saveStateToCookie(cookie)
canShowRepresentedObject(representedObject)
{
- return representedObject instanceof WebInspector.Resource;
+ if (!(representedObject instanceof WebInspector.Resource))
+ return false;
+
+ return this._navigationSidebarPanel.hasRepresentedObject(representedObject);
}
get supportsSplitContentBrowser()
showContentViewForTreeElement(treeElement)
{
if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
- WebInspector.showSourceCode(treeElement.representedObject);
+ WebInspector.showSourceCode(treeElement.representedObject, {ignoreNetworkTab: true});
return;
}
return;
let sourceCodeLocation = sourceCode.createSourceCodeLocation(location.lineNumber, location.columnNumber || 0);
- WebInspector.showSourceCodeLocation(sourceCodeLocation);
+ WebInspector.showSourceCodeLocation(sourceCodeLocation, {ignoreNetworkTab: true});
});
});
}
|| treeElement instanceof WebInspector.ResourceTreeElement
|| treeElement instanceof WebInspector.ScriptTreeElement
|| treeElement instanceof WebInspector.ContentFlowTreeElement) {
- WebInspector.showRepresentedObject(treeElement.representedObject);
+ WebInspector.showRepresentedObject(treeElement.representedObject, null, {ignoreNetworkTab: true});
return;
}
_dataGridNodeGoToArrowClicked()
{
- WebInspector.showSourceCode(this._resource);
+ WebInspector.showSourceCode(this._resource, {ignoreNetworkTab: true});
}
_updateStatus(cell)
return;
if (treeElement instanceof WebInspector.ResourceTreeElement || treeElement instanceof WebInspector.ScriptTreeElement) {
- WebInspector.showRepresentedObject(treeElement.representedObject);
+ WebInspector.showRepresentedObject(treeElement.representedObject, null, {ignoreNetworkTab: true});
return;
}
if (treeElement.representedObject instanceof WebInspector.DOMSearchMatchObject)
WebInspector.showMainFrameDOMTree(treeElement.representedObject.domNode);
else if (treeElement.representedObject instanceof WebInspector.SourceCodeSearchMatchObject)
- WebInspector.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange);
+ WebInspector.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange, {ignoreNetworkTab: true});
}
_treeElementDoubleClick(event)
if (!treeElement)
return;
- const options = {ignoreSearchTab: true};
if (treeElement.representedObject instanceof WebInspector.DOMSearchMatchObject)
- WebInspector.showMainFrameDOMTree(treeElement.representedObject.domNode, options);
+ WebInspector.showMainFrameDOMTree(treeElement.representedObject.domNode, {ignoreSearchTab: true});
else if (treeElement.representedObject instanceof WebInspector.SourceCodeSearchMatchObject)
- WebInspector.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange, options);
+ WebInspector.showOriginalOrFormattedSourceCodeTextRange(treeElement.representedObject.sourceCodeTextRange, {ignoreNetworkTab: true, ignoreSearchTab: true});
}
};
var sourceCodeLocation = this._sourceCodeLocationForEditorPosition(this.tokenTrackingController.candidate.hoveredTokenRange.start);
if (this.sourceCode instanceof WebInspector.SourceMapResource)
- WebInspector.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation);
+ WebInspector.showOriginalOrFormattedSourceCodeLocation(sourceCodeLocation, {ignoreNetworkTab: true});
else
- WebInspector.showSourceCodeLocation(sourceCodeLocation);
+ WebInspector.showSourceCodeLocation(sourceCodeLocation, {ignoreNetworkTab: true});
}
tokenTrackingControllerNewHighlightCandidate(tokenTrackingController, candidate)
if (options.ignoreSearchTab && tabContentView instanceof WebInspector.SearchTabContentView)
continue;
+ if (options.ignoreNetworkTab && tabContentView instanceof WebInspector.NetworkTabContentView)
+ continue;
+
if (tabContentView.canShowRepresentedObject(representedObject))
return tabContentView;
}
if (!callFrame.sourceCodeLocation)
return;
- WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation);
+ WebInspector.showSourceCodeLocation(callFrame.sourceCodeLocation, {ignoreNetworkTab: true});
}
};
contextMenu.appendItem(WebInspector.UIString("Show Source"), () => {
if (event.metaKey)
- WebInspector.showOriginalUnformattedSourceCodeLocation(this.representedObject.ownerRule.sourceCodeLocation);
+ WebInspector.showOriginalUnformattedSourceCodeLocation(this.representedObject.ownerRule.sourceCodeLocation, {ignoreNetworkTab: true});
else
- WebInspector.showSourceCodeLocation(this.representedObject.ownerRule.sourceCodeLocation);
+ WebInspector.showSourceCodeLocation(this.representedObject.ownerRule.sourceCodeLocation, {ignoreNetworkTab: true});
});
// Only used one colon temporarily since single-colon pseudo elements are valid CSS.