Bug 49088 - Web Inspector: _bindResourceURL in ResourceManager.js may not add resource to map
Summary: Web Inspector: _bindResourceURL in ResourceManager.js may not add resource to...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Jenn Braithwaite
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-05 13:14 PDT by Jenn Braithwaite
Modified: 2010-11-08 20:48 PST (History)
3 users (show)

See Also:


Attachments
patch (1.43 KB, patch)
2010-11-05 13:19 PDT, Jenn Braithwaite
pfeldman: review+
pfeldman: commit-queue-
Details | Formatted Diff | Diff
updated patch (1.25 KB, patch)
2010-11-08 09:56 PST, Jenn Braithwaite
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jenn Braithwaite 2010-11-05 13:14:45 PDT
In ResourceManager.js:

    _bindResourceURL: function(resource)
    {
        var resourceForURL = this._resourcesByURL[resource.url];
        if (!resourceForURL)
            this._resourcesByURL[resource.url] = resource;
        else if (resourceForURL instanceof Array)
            resourceForURL.push(resource);
        else
            this._resourcesByURL[resource.url] = [resourceForURL];   <====
    },

The last else clause converts a single element into an array, but it seems to have forgotten to put the resource into the newly formed array.
Comment 1 Jenn Braithwaite 2010-11-05 13:19:14 PDT
Created attachment 73105 [details]
patch
Comment 2 Pavel Feldman 2010-11-05 23:54:46 PDT
Comment on attachment 73105 [details]
patch

View in context: https://bugs.webkit.org/attachment.cgi?id=73105&action=review

Thanks for fixing this!
Fyi: there is a webkit.com/new-inspector-bug that has nice template for inspector bugs.

> WebCore/ChangeLog:5
> +        _bindResourceURL in ResourceManager.js may not add resource to map

You should use Web Inspector: prefix

> WebCore/inspector/front-end/ResourceManager.js:405
> +            var resourceForURLArray = [resourceForURL];

Nit: I would simply do

this._resourcesByURL[resource.url] = [resourceForURL, resource];
Comment 3 Jenn Braithwaite 2010-11-08 09:56:20 PST
Created attachment 73246 [details]
updated patch

I like your JS better. My JS-newbie-ness is showing...
Comment 4 WebKit Commit Bot 2010-11-08 20:48:14 PST
Comment on attachment 73246 [details]
updated patch

Clearing flags on attachment: 73246

Committed r71603: <http://trac.webkit.org/changeset/71603>
Comment 5 WebKit Commit Bot 2010-11-08 20:48:19 PST
All reviewed patches have been landed.  Closing bug.