Changeset 224508 in webkit


Ignore:
Timestamp:
Nov 6, 2017 1:08:01 PM (6 years ago)
Author:
Joseph Pecoraro
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.

Location:
trunk/Source/WebInspectorUI
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r224507 r224508  
     12017-11-06  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: no way to navigate from Resource tree element to its entry in Network Tab
     4        https://bugs.webkit.org/show_bug.cgi?id=179328
     5        <rdar://problem/35367294>
     6
     7        Reviewed by Brian Burg.
     8
     9        * Localizations/en.lproj/localizedStrings.js:
     10        New reveal in network tab string.
     11
     12        * UserInterface/Base/Main.js:
     13        (WI.isShowingNetworkTab):
     14        Utility to know if the network tab is showing.
     15
     16        * UserInterface/Views/ContextMenuUtilities.js:
     17        (WI.appendContextMenuItemsForSourceCode):
     18        (showResourceWithOptions):
     19        (WI.appendContextMenuItemsForURL):
     20        Generalize context menus for just a URL.
     21
     22        * UserInterface/Views/TabBrowser.js:
     23        (WI.TabBrowser.prototype.bestTabContentViewForRepresentedObject):
     24        Support more tab ignore options, this is starting to get icky. We may want to
     25        move to just a preferredTab approach, since that is what some of these want.
     26
     27        * UserInterface/Views/DOMTreeElement.js:
     28        (WI.DOMTreeElement.prototype._populateTagContextMenu):
     29        Make use of new ContextMenu utility to add menu items for a URL.
     30
     31        * UserInterface/Views/NetworkTabContentView.js:
     32        (WI.NetworkTabContentView.prototype.showRepresentedObject):
     33        * UserInterface/Views/NetworkTableContentView.js:
     34        (WI.NetworkTableContentView.prototype.showRepresentedObject):
     35        Handle showing a Resource in the NetworkTab. We immediately show
     36        the details view for it, otherwise we fallback to the list view.
     37
    1382017-11-06  Joseph Pecoraro  <pecoraro@apple.com>
    239
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r224499 r224508  
    780780localizedStrings["Reveal in Debugger Tab"] = "Reveal in Debugger Tab";
    781781localizedStrings["Reveal in Elements Tab"] = "Reveal in Elements Tab";
     782localizedStrings["Reveal in Network Tab"] = "Reveal in Network Tab";
    782783localizedStrings["Reveal in Original Resource"] = "Reveal in Original Resource";
    783784localizedStrings["Reveal in Resources Tab"] = "Reveal in Resources Tab";
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r224499 r224508  
    994994};
    995995
     996WI.isShowingNetworkTab = function()
     997{
     998    return this.tabBrowser.selectedTabContentView instanceof WI.NetworkTabContentView;
     999};
     1000
    9961001WI.showTimelineTab = function()
    9971002{
  • trunk/Source/WebInspectorUI/UserInterface/Views/ContextMenuUtilities.js

    r224314 r224508  
    4343    contextMenu.appendSeparator();
    4444
    45     if (sourceCode.url) {
    46         contextMenu.appendItem(WI.UIString("Open in New Tab"), () => {
    47             const frame = null;
    48             WI.openURL(sourceCode.url, frame, {alwaysOpenExternally: true});
    49         });
    50 
    51         if (WI.frameResourceManager.resourceForURL(sourceCode.url) && !WI.isShowingResourcesTab()) {
    52             contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
    53                 const options = {ignoreNetworkTab: true};
    54                 if (location)
    55                     WI.showSourceCodeLocation(location, options);
    56                 else
    57                     WI.showSourceCode(sourceCode, options);
    58             });
    59         }
    60 
    61         contextMenu.appendItem(WI.UIString("Copy Link Address"), () => {
    62             InspectorFrontendHost.copyText(sourceCode.url);
    63         });
    64     }
     45    WI.appendContextMenuItemsForURL(contextMenu, sourceCode.url, {sourceCode, location});
    6546
    6647    if (sourceCode instanceof WI.Resource) {
     
    9879        contextMenu.appendSeparator();
    9980    }
     81};
     82
     83WI.appendContextMenuItemsForURL = function(contextMenu, url, options)
     84{
     85    if (!url)
     86        return;
     87
     88    let {sourceCode, location, frame} = options;
     89    function showResourceWithOptions(options) {
     90        if (location)
     91            WI.showSourceCodeLocation(location, options);
     92        else if (sourceCode)
     93            WI.showSourceCode(sourceCode, options);
     94        else
     95            WI.openURL(url, frame, options);
     96    }
     97
     98    contextMenu.appendItem(WI.UIString("Open in New Tab"), () => {
     99        const frame = null;
     100        WI.openURL(url, frame, {alwaysOpenExternally: true});
     101    });
     102
     103    if (WI.frameResourceManager.resourceForURL(url)) {
     104        if (!WI.isShowingResourcesTab()) {
     105            contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
     106                showResourceWithOptions({ignoreNetworkTab: true, ignoreSearchTab: true});
     107            });
     108        }
     109        if (!WI.isShowingNetworkTab()) {
     110            contextMenu.appendItem(WI.UIString("Reveal in Network Tab"), () => {
     111                showResourceWithOptions({ignoreResourcesTab: true, ignoreDebuggerTab: true, ignoreSearchTab: true});
     112            });
     113        }
     114    }
     115
     116    contextMenu.appendItem(WI.UIString("Copy Link Address"), () => {
     117        InspectorFrontendHost.copyText(sourceCode.url);
     118    });
    100119};
    101120
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js

    r224456 r224508  
    740740        if (event.target && event.target.tagName === "A") {
    741741            let url = event.target.href;
    742 
    743             contextMenu.appendItem(WI.UIString("Open in New Tab"), () => {
    744                 const frame = null;
    745                 WI.openURL(url, frame, {alwaysOpenExternally: true});
    746             });
    747 
    748             if (WI.frameResourceManager.resourceForURL(url)) {
    749                 contextMenu.appendItem(WI.UIString("Reveal in Resources Tab"), () => {
    750                     let frame = WI.frameResourceManager.frameForIdentifier(node.frameIdentifier);
    751 
    752                     const options = {
    753                         ignoreNetworkTab: true,
    754                         ignoreSearchTab: true,
    755                     };
    756                     WI.openURL(url, frame, options);
    757                 });
    758             }
    759 
    760             contextMenu.appendItem(WI.UIString("Copy Link Address"), () => {
    761                 InspectorFrontendHost.copyText(url);
    762             });
     742            let frame = WI.frameResourceManager.frameForIdentifier(node.frameIdentifier);
     743            WI.appendContextMenuItemsForURL(contextMenu, url, {frame});
    763744        }
    764745
  • trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTabContentView.js

    r223778 r224508  
    9999    }
    100100
     101    showRepresentedObject(representedObject, cookie)
     102    {
     103        console.assert(this._contentBrowser.currentContentView === this._networkTableContentView);
     104        this._networkTableContentView.showRepresentedObject(representedObject, cookie);
     105    }
     106
    101107    get supportsSplitContentBrowser()
    102108    {
  • trunk/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js

    r224391 r224508  
    257257    }
    258258
     259    showRepresentedObject(representedObject, cookie)
     260    {
     261        console.assert(representedObject instanceof WI.Resource);
     262
     263        let rowIndex = this._rowIndexForResource(representedObject);
     264        if (rowIndex === -1) {
     265            this._selectedResource = null;
     266            this._table.clearSelectedRow();
     267            this._hideResourceDetailView();
     268            return;
     269        }
     270   
     271        this._table.selectRow(rowIndex);
     272    }
     273
    259274    // NetworkResourceDetailView delegate
    260275
  • trunk/Source/WebInspectorUI/UserInterface/Views/TabBrowser.js

    r223778 r224508  
    130130                continue;
    131131
     132            if (options.ignoreResourcesTab && tabContentView instanceof WI.ResourcesTabContentView)
     133                continue;
     134
     135            if (options.ignoreDebuggerTab && tabContentView instanceof WI.DebuggerTabContentView)
     136                continue;
     137
    132138            if (tabContentView.canShowRepresentedObject(representedObject))
    133139                return tabContentView;
Note: See TracChangeset for help on using the changeset viewer.