Changeset 52253 in webkit


Ignore:
Timestamp:
Dec 17, 2009 7:34:33 AM (14 years ago)
Author:
eric@webkit.org
Message:

2009-12-17 Mikhail Naganov <mnaganov@chromium.org>

Reviewed by Pavel Feldman.

Advice links to source code in CPU profiler to open in debugger,
not in resources tab.

Also work around the case when resources are disabled, but scripts are present.

https://bugs.webkit.org/show_bug.cgi?id=32610

  • inspector/front-end/Panel.js: (WebInspector.Panel.prototype.updateMainViewWidth): (WebInspector.Panel.prototype.canShowSourceLineForURL): (WebInspector.Panel.prototype.showSourceLineForURL):
  • inspector/front-end/ProfileDataGridTree.js: (WebInspector.ProfileDataGridNode.prototype.createCell):
  • inspector/front-end/ResourcesPanel.js: (WebInspector.ResourcesPanel.prototype.canShowSourceLineForURL): (WebInspector.ResourcesPanel.prototype.showSourceLineForURL):
  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype.scriptForURL): (WebInspector.ScriptsPanel.prototype.canShowSourceLineForURL): (WebInspector.ScriptsPanel.prototype.showSourceLineForURL): (WebInspector.ScriptsPanel.prototype._showScriptOrResource):
  • inspector/front-end/inspector.js: (WebInspector.documentClick.followLink): (WebInspector.documentClick): (WebInspector._choosePanelToShowSourceLineForURL): (WebInspector.canShowSourceLineForURL): (WebInspector.showSourceLineForURL):
Location:
trunk/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r52251 r52253  
     12009-12-17  Mikhail Naganov  <mnaganov@chromium.org>
     2
     3        Reviewed by Pavel Feldman.
     4
     5        Advice links to source code in CPU profiler to open in debugger,
     6        not in resources tab.
     7
     8        Also work around the case when resources are disabled, but scripts are present.
     9
     10        https://bugs.webkit.org/show_bug.cgi?id=32610
     11
     12        * inspector/front-end/Panel.js:
     13        (WebInspector.Panel.prototype.updateMainViewWidth):
     14        (WebInspector.Panel.prototype.canShowSourceLineForURL):
     15        (WebInspector.Panel.prototype.showSourceLineForURL):
     16        * inspector/front-end/ProfileDataGridTree.js:
     17        (WebInspector.ProfileDataGridNode.prototype.createCell):
     18        * inspector/front-end/ResourcesPanel.js:
     19        (WebInspector.ResourcesPanel.prototype.canShowSourceLineForURL):
     20        (WebInspector.ResourcesPanel.prototype.showSourceLineForURL):
     21        * inspector/front-end/ScriptsPanel.js:
     22        (WebInspector.ScriptsPanel.prototype.scriptForURL):
     23        (WebInspector.ScriptsPanel.prototype.canShowSourceLineForURL):
     24        (WebInspector.ScriptsPanel.prototype.showSourceLineForURL):
     25        (WebInspector.ScriptsPanel.prototype._showScriptOrResource):
     26        * inspector/front-end/inspector.js:
     27        (WebInspector.documentClick.followLink):
     28        (WebInspector.documentClick):
     29        (WebInspector._choosePanelToShowSourceLineForURL):
     30        (WebInspector.canShowSourceLineForURL):
     31        (WebInspector.showSourceLineForURL):
     32
    1332009-12-15  Philippe Normand  <pnormand@igalia.com>
    234
  • trunk/WebCore/inspector/front-end/Panel.js

    r52099 r52253  
    364364    {
    365365        // Should be implemented by ancestors.
     366    },
     367
     368    canShowSourceLineForURL: function(url)
     369    {
     370        return false;
     371    },
     372
     373    showSourceLineForURL: function(url, line)
     374    {
     375        return false;
    366376    }
    367377}
  • trunk/WebCore/inspector/front-end/ProfileDataGridTree.js

    r49891 r52253  
    103103            urlElement.href = this.profileNode.url;
    104104            urlElement.lineNumber = this.profileNode.lineNumber;
     105            urlElement.preferredPanel = "scripts";
    105106
    106107            if (this.profileNode.lineNumber > 0)
  • trunk/WebCore/inspector/front-end/ResourcesPanel.js

    r51946 r52253  
    457457    },
    458458
     459    canShowSourceLineForURL: function(url)
     460    {
     461        return !!WebInspector.resourceForURL(url);
     462    },
     463
     464    showSourceLineForURL: function(url, line)
     465    {
     466        this.showResource(WebInspector.resourceForURL(url), line);
     467    },
     468
    459469    showResource: function(resource, line)
    460470    {
  • trunk/WebCore/inspector/front-end/ScriptsPanel.js

    r52099 r52253  
    311311    },
    312312
     313    scriptForURL: function(url)
     314    {
     315        return this._scriptsForURLsInFilesSelect[url];
     316    },
     317
    313318    addBreakpoint: function(breakpoint)
    314319    {
     
    498503    },
    499504
    500     canShowResource: function(resource)
    501     {
    502         return resource && resource.scripts.length && InspectorBackend.debuggerEnabled();
     505    canShowSourceLineForURL: function(url)
     506    {
     507        return InspectorBackend.debuggerEnabled() &&
     508            !!(WebInspector.resourceForURL(url) || this.scriptForURL(url));
     509    },
     510
     511    showSourceLineForURL: function(url, line)
     512    {
     513        var resource = WebInspector.resourceForURL(url);
     514        if (resource)
     515            this.showResource(resource, line);
     516        else
     517            this.showScript(this.scriptForURL(url), line);
    503518    },
    504519
     
    652667            console.assert(option);
    653668        } else {
    654             var script = this._scriptsForURLsInFilesSelect[url];
     669            var script = this.scriptForURL(url);
    655670            if (script)
    656671               option = script.filesSelectOption;
  • trunk/WebCore/inspector/front-end/inspector.js

    r52154 r52253  
    601601    {
    602602        // FIXME: support webkit-html-external-link links here.
    603         if (anchor.href in WebInspector.resourceURLMap) {
     603        if (WebInspector.canShowSourceLineForURL(anchor.href, anchor.preferredPanel)) {
    604604            if (anchor.hasStyleClass("webkit-html-external-link")) {
    605605                anchor.removeStyleClass("webkit-html-external-link");
     
    607607            }
    608608
    609             WebInspector.showResourceForURL(anchor.href, anchor.lineNumber, anchor.preferredPanel);
     609            WebInspector.showSourceLineForURL(anchor.href, anchor.lineNumber, anchor.preferredPanel);
    610610        } else {
    611611            var profileString = WebInspector.ProfileType.URLRegExp.exec(anchor.href);
     
    14101410}
    14111411
    1412 WebInspector.showResourceForURL = function(url, line, preferredPanel)
    1413 {
    1414     var resource = this.resourceForURL(url);
    1415     if (!resource)
    1416         return false;
    1417 
    1418     if (preferredPanel && preferredPanel in WebInspector.panels) {
    1419         var panel = this.panels[preferredPanel];
    1420         if (!("showResource" in panel))
    1421             panel = null;
    1422         else if ("canShowResource" in panel && !panel.canShowResource(resource))
    1423             panel = null;
    1424     }
    1425 
    1426     this.currentPanel = panel || this.panels.resources;
     1412WebInspector._choosePanelToShowSourceLineForURL = function(url, preferredPanel)
     1413{
     1414    preferredPanel = preferredPanel || "resources";
     1415    var panel = this.panels[preferredPanel];
     1416    if (panel && panel.canShowSourceLineForURL(url))
     1417        return panel;
     1418    panel = this.panels.resources;
     1419    return panel.canShowSourceLineForURL(url) ? panel : null;
     1420}
     1421
     1422WebInspector.canShowSourceLineForURL = function(url, preferredPanel)
     1423{
     1424    return !!this._choosePanelToShowSourceLineForURL(url, preferredPanel);
     1425}
     1426
     1427WebInspector.showSourceLineForURL = function(url, line, preferredPanel)
     1428{
     1429    this.currentPanel = this._choosePanelToShowSourceLineForURL(url, preferredPanel);
    14271430    if (!this.currentPanel)
    14281431        return false;
    1429     this.currentPanel.showResource(resource, line);
     1432    this.currentPanel.showSourceLineForURL(url, line);
    14301433    return true;
    14311434}
Note: See TracChangeset for help on using the changeset viewer.