Bug 32610

Summary: Web Inspector: Links to source in CPU profiles should open Scripts (debugger) panel
Product: WebKit Reporter: Mikhail Naganov <mnaganov>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: bweinstein, commit-queue, joepeck, keishi, pfeldman, pmuellr, rik, timothy, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Proposed fix
pfeldman: review-
proposed change, comments addressed
pfeldman: review-
Proposed fix, comments addressed
pfeldman: review-
fixed 'line' argument loss for resources panel none

Description Mikhail Naganov 2009-12-16 06:57:32 PST
It is more convenient to explore performance issues using debugger, not resources panel.
Comment 1 Mikhail Naganov 2009-12-16 07:05:12 PST
Created attachment 44973 [details]
Proposed fix
Comment 2 WebKit Review Bot 2009-12-16 07:07:52 PST
style-queue ran check-webkit-style on attachment 44973 [details] without any errors.
Comment 3 Pavel Feldman 2009-12-16 09:11:32 PST
Comment on attachment 44973 [details]
Proposed fix

>  WebInspector.canShowResourceForURL = function(url, preferredPanel)
>  WebInspector.showResourceForURL = function(url, line, preferredPanel)

It would be much more clear if you made Panel's canShowResource and showResource accept URL instead of resource. That way you would be able to make canShowResourceForURL and showResourceForURL here panel-agnostic.
Comment 4 Mikhail Naganov 2009-12-16 13:55:56 PST
Created attachment 45012 [details]
proposed change, comments addressed
Comment 5 WebKit Review Bot 2009-12-16 14:00:20 PST
style-queue ran check-webkit-style on attachment 45012 [details] without any errors.
Comment 6 Pavel Feldman 2009-12-16 14:24:47 PST
Comment on attachment 45012 [details]
proposed change, comments addressed

> +WebInspector._choosePanelToShowResourceForURL = function(url, preferredPanel)
>  {
> -    var resource = this.resourceForURL(url);
> -    if (!resource)
> -        return false;
> -
> +    var panel = null;
>      if (preferredPanel && preferredPanel in WebInspector.panels) {
> -        var panel = this.panels[preferredPanel];
> -        if (!("showResource" in panel))
> +        panel = this.panels[preferredPanel];
> +        if (!("showResourceForURL" in panel))
>              panel = null;
> -        else if ("canShowResource" in panel && !panel.canShowResource(resource))
> +        else if ("canShowResourceForURL" in panel && !panel.canShowResourceForURL(url))
>              panel = null;
>      }
> +    if (!panel && preferredPanel != "resources")
> +        return this._choosePanelToShowResourceForURL(url, "resources");
> +    return panel;
> +}

Can we implement this a bit more simple?
- Require that any preferredPanel has necessary canShow and show methods
- first check against preferredPanel, in case of failure explicitly check against resources. No need to reenter method.

> +
> +WebInspector.showResourceForURL = function(url, line, preferredPanel)
> +{

This name no longer applies. WebInspector.showScriptOrResourceForURL ?

r- for confusing logic in _choosePanelToShowResourceForURL and name of the method.
Comment 7 Mikhail Naganov 2009-12-17 06:28:38 PST
Created attachment 45060 [details]
Proposed fix, comments addressed
Comment 8 WebKit Review Bot 2009-12-17 06:30:28 PST
style-queue ran check-webkit-style on attachment 45060 [details] without any errors.
Comment 9 Pavel Feldman 2009-12-17 07:20:08 PST
Comment on attachment 45060 [details]
Proposed fix, comments addressed

> +    showSourceLineForURL: function(url, line)
> +    {
> +        this.showResource(WebInspector.resourceForURL(url));

You lose line information here. Rest is Ok.
Comment 10 Mikhail Naganov 2009-12-17 07:21:00 PST
Created attachment 45064 [details]
fixed 'line' argument loss for resources panel
Comment 11 WebKit Review Bot 2009-12-17 07:22:17 PST
style-queue ran check-webkit-style on attachment 45064 [details] without any errors.
Comment 12 WebKit Commit Bot 2009-12-17 07:34:42 PST
Comment on attachment 45064 [details]
fixed 'line' argument loss for resources panel

Clearing flags on attachment: 45064

Committed r52253: <http://trac.webkit.org/changeset/52253>
Comment 13 WebKit Commit Bot 2009-12-17 07:34:48 PST
All reviewed patches have been landed.  Closing bug.