- Revision
- 224508
- Author
- joep...@webkit.org
- Date
- 2017-11-06 13:08:01 -0800 (Mon, 06 Nov 2017)
Log Message
Web Inspector: no way to navigate from Resource tree element to its entry in Network Tab
https://bugs.webkit.org/show_bug.cgi?id=179328
<rdar://problem/35367294>
Reviewed by Brian Burg.
* Localizations/en.lproj/localizedStrings.js:
New reveal in network tab string.
* UserInterface/Base/Main.js:
(WI.isShowingNetworkTab):
Utility to know if the network tab is showing.
* UserInterface/Views/ContextMenuUtilities.js:
(WI.appendContextMenuItemsForSourceCode):
(showResourceWithOptions):
(WI.appendContextMenuItemsForURL):
Generalize context menus for just a URL.
* UserInterface/Views/TabBrowser.js:
(WI.TabBrowser.prototype.bestTabContentViewForRepresentedObject):
Support more tab ignore options, this is starting to get icky. We may want to
move to just a preferredTab approach, since that is what some of these want.
* UserInterface/Views/DOMTreeElement.js:
(WI.DOMTreeElement.prototype._populateTagContextMenu):
Make use of new ContextMenu utility to add menu items for a URL.
* UserInterface/Views/NetworkTabContentView.js:
(WI.NetworkTabContentView.prototype.showRepresentedObject):
* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype.showRepresentedObject):
Handle showing a Resource in the NetworkTab. We immediately show
the details view for it, otherwise we fallback to the list view.
Modified Paths
Diff
Modified: trunk/Source/WebInspectorUI/ChangeLog (224507 => 224508)
--- trunk/Source/WebInspectorUI/ChangeLog 2017-11-06 20:32:06 UTC (rev 224507)
+++ trunk/Source/WebInspectorUI/ChangeLog 2017-11-06 21:08:01 UTC (rev 224508)
@@ -1,5 +1,42 @@
2017-11-06 Joseph Pecoraro <pecor...@apple.com>
+ Web Inspector: no way to navigate from Resource tree element to its entry in Network Tab
+ https://bugs.webkit.org/show_bug.cgi?id=179328
+ <rdar://problem/35367294>
+
+ Reviewed by Brian Burg.
+
+ * Localizations/en.lproj/localizedStrings.js:
+ New reveal in network tab string.
+
+ * UserInterface/Base/Main.js:
+ (WI.isShowingNetworkTab):
+ Utility to know if the network tab is showing.
+
+ * UserInterface/Views/ContextMenuUtilities.js:
+ (WI.appendContextMenuItemsForSourceCode):
+ (showResourceWithOptions):
+ (WI.appendContextMenuItemsForURL):
+ Generalize context menus for just a URL.
+
+ * UserInterface/Views/TabBrowser.js:
+ (WI.TabBrowser.prototype.bestTabContentViewForRepresentedObject):
+ Support more tab ignore options, this is starting to get icky. We may want to
+ move to just a preferredTab approach, since that is what some of these want.
+
+ * UserInterface/Views/DOMTreeElement.js:
+ (WI.DOMTreeElement.prototype._populateTagContextMenu):
+ Make use of new ContextMenu utility to add menu items for a URL.
+
+ * UserInterface/Views/NetworkTabContentView.js:
+ (WI.NetworkTabContentView.prototype.showRepresentedObject):
+ * UserInterface/Views/NetworkTableContentView.js:
+ (WI.NetworkTableContentView.prototype.showRepresentedObject):
+ Handle showing a Resource in the NetworkTab. We immediately show
+ the details view for it, otherwise we fallback to the list view.
+
+2017-11-06 Joseph Pecoraro <pecor...@apple.com>
+
Uncaught Exception: TypeError: null is not an object (evaluating 'mimeType.endsWith')
https://bugs.webkit.org/show_bug.cgi?id=179325
<rdar://problem/35366896>
Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (224507 => 224508)
--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2017-11-06 20:32:06 UTC (rev 224507)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js 2017-11-06 21:08:01 UTC (rev 224508)
@@ -779,6 +779,7 @@
localizedStrings["Reveal in DOM Tree"] = "Reveal in DOM Tree";
localizedStrings["Reveal in Debugger Tab"] = "Reveal in Debugger Tab";
localizedStrings["Reveal in Elements Tab"] = "Reveal in Elements Tab";
+localizedStrings["Reveal in Network Tab"] = "Reveal in Network Tab";
localizedStrings["Reveal in Original Resource"] = "Reveal in Original Resource";
localizedStrings["Reveal in Resources Tab"] = "Reveal in Resources Tab";
localizedStrings["Right"] = "Right";
Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (224507 => 224508)
--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2017-11-06 20:32:06 UTC (rev 224507)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js 2017-11-06 21:08:01 UTC (rev 224508)
@@ -993,6 +993,11 @@
this.tabBrowser.showTabForContentView(tabContentView);
};
+WI.isShowingNetworkTab = function()
+{
+ return this.tabBrowser.selectedTabContentView instanceof WI.NetworkTabContentView;
+};
+
WI.showTimelineTab = function()
{
var tabContentView = this.tabBrowser.bestTabContentViewForClass(WI.TimelineTabContentView);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js (224507 => 224508)
--- trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js 2017-11-06 20:32:06 UTC (rev 224507)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js 2017-11-06 21:08:01 UTC (rev 224508)
@@ -42,27 +42,8 @@
contextMenu.appendSeparator();
- if (sourceCode.url) {
- contextMenu.appendItem(WI.UIString("Open in New Tab"), () => {
- const frame = null;
- WI.openURL(sourceCode.url, frame, {alwaysOpenExternally: true});
- });
+ WI.appendContextMenuItemsForURL(contextMenu, sourceCode.url, {sourceCode, location});
- if (WI.frameResourceManager.resourceForURL(sourceCode.url) && !WI.isShowingResourcesTab()) {
- contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
- const options = {ignoreNetworkTab: true};
- if (location)
- WI.showSourceCodeLocation(location, options);
- else
- WI.showSourceCode(sourceCode, options);
- });
- }
-
- contextMenu.appendItem(WI.UIString("Copy Link Address"), () => {
- InspectorFrontendHost.copyText(sourceCode.url);
- });
- }
-
if (sourceCode instanceof WI.Resource) {
if (sourceCode.urlComponents.scheme !== "data") {
contextMenu.appendItem(WI.UIString("Copy as cURL"), () => {
@@ -99,6 +80,44 @@
}
};
+WI.appendContextMenuItemsForURL = function(contextMenu, url, options)
+{
+ if (!url)
+ return;
+
+ let {sourceCode, location, frame} = options;
+ function showResourceWithOptions(options) {
+ if (location)
+ WI.showSourceCodeLocation(location, options);
+ else if (sourceCode)
+ WI.showSourceCode(sourceCode, options);
+ else
+ WI.openURL(url, frame, options);
+ }
+
+ contextMenu.appendItem(WI.UIString("Open in New Tab"), () => {
+ const frame = null;
+ WI.openURL(url, frame, {alwaysOpenExternally: true});
+ });
+
+ if (WI.frameResourceManager.resourceForURL(url)) {
+ if (!WI.isShowingResourcesTab()) {
+ contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
+ showResourceWithOptions({ignoreNetworkTab: true, ignoreSearchTab: true});
+ });
+ }
+ if (!WI.isShowingNetworkTab()) {
+ contextMenu.appendItem(WI.UIString("Reveal in Network Tab"), () => {
+ showResourceWithOptions({ignoreResourcesTab: true, ignoreDebuggerTab: true, ignoreSearchTab: true});
+ });
+ }
+ }
+
+ contextMenu.appendItem(WI.UIString("Copy Link Address"), () => {
+ InspectorFrontendHost.copyText(sourceCode.url);
+ });
+};
+
WI.appendContextMenuItemsForDOMNode = function(contextMenu, domNode, options = {})
{
console.assert(contextMenu instanceof WI.ContextMenu);
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js (224507 => 224508)
--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js 2017-11-06 20:32:06 UTC (rev 224507)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js 2017-11-06 21:08:01 UTC (rev 224508)
@@ -739,27 +739,8 @@
if (event.target && event.target.tagName === "A") {
let url = ""
-
- contextMenu.appendItem(WI.UIString("Open in New Tab"), () => {
- const frame = null;
- WI.openURL(url, frame, {alwaysOpenExternally: true});
- });
-
- if (WI.frameResourceManager.resourceForURL(url)) {
- contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
- let frame = WI.frameResourceManager.frameForIdentifier(node.frameIdentifier);
-
- const options = {
- ignoreNetworkTab: true,
- ignoreSearchTab: true,
- };
- WI.openURL(url, frame, options);
- });
- }
-
- contextMenu.appendItem(WI.UIString("Copy Link Address"), () => {
- InspectorFrontendHost.copyText(url);
- });
+ let frame = WI.frameResourceManager.frameForIdentifier(node.frameIdentifier);
+ WI.appendContextMenuItemsForURL(contextMenu, url, {frame});
}
contextMenu.appendSeparator();
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js (224507 => 224508)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js 2017-11-06 20:32:06 UTC (rev 224507)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js 2017-11-06 21:08:01 UTC (rev 224508)
@@ -98,6 +98,12 @@
return representedObject instanceof WI.Resource;
}
+ showRepresentedObject(representedObject, cookie)
+ {
+ console.assert(this._contentBrowser.currentContentView === this._networkTableContentView);
+ this._networkTableContentView.showRepresentedObject(representedObject, cookie);
+ }
+
get supportsSplitContentBrowser()
{
return true;
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js (224507 => 224508)
--- trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js 2017-11-06 20:32:06 UTC (rev 224507)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js 2017-11-06 21:08:01 UTC (rev 224508)
@@ -256,6 +256,21 @@
}
}
+ showRepresentedObject(representedObject, cookie)
+ {
+ console.assert(representedObject instanceof WI.Resource);
+
+ let rowIndex = this._rowIndexForResource(representedObject);
+ if (rowIndex === -1) {
+ this._selectedResource = null;
+ this._table.clearSelectedRow();
+ this._hideResourceDetailView();
+ return;
+ }
+
+ this._table.selectRow(rowIndex);
+ }
+
// NetworkResourceDetailView delegate
networkResourceDetailViewClose(resourceDetailView)
Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js (224507 => 224508)
--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js 2017-11-06 20:32:06 UTC (rev 224507)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js 2017-11-06 21:08:01 UTC (rev 224508)
@@ -129,6 +129,12 @@
if (options.ignoreNetworkTab && tabContentView instanceof WI.NetworkTabContentView)
continue;
+ if (options.ignoreResourcesTab && tabContentView instanceof WI.ResourcesTabContentView)
+ continue;
+
+ if (options.ignoreDebuggerTab && tabContentView instanceof WI.DebuggerTabContentView)
+ continue;
+
if (tabContentView.canShowRepresentedObject(representedObject))
return tabContentView;
}