Changeset 31918 in webkit


Ignore:
Timestamp:
Apr 15, 2008 1:56:43 PM (16 years ago)
Author:
timothy@apple.com
Message:

Fixes the bug where a resource view could still be shown after the inspected
page navigates to another page.

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

Reviewed by Adam Roben.

  • page/inspector/ResourcesPanel.js:

(WebInspector.ResourcesPanel.prototype.reset): Close the visible resource.
Iterate over all the resources and zero errors and warnings and delete the
resource view and tree element. Removes all children of resourceViews. Passes
true to _updateGraphDividersIfNeeded to force an immediate update.
(WebInspector.ResourcesPanel.prototype.removeResource): Added. Closes
the resource view if it is visible. Removes the resource from the _resources
array. Removes the tree element from the outline tree. Zeros out the errors
and warnings properties. Deletes the tree element and resource view properties.
(WebInspector.ResourcesPanel.prototype.closeVisibleResource): Null check
this._calculator for times when reset is called before the calculator is set.

  • page/inspector/inspector.js:

(WebInspector.removeResource): Call ResourcesPanel.removeResource.

Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r31917 r31918  
     12008-04-15  Timothy Hatcher  <timothy@apple.com>
     2
     3        Fixes the bug where a resource view could still be shown after the inspected
     4        page navigates to another page.
     5
     6        https://bugs.webkit.org/show_bug.cgi?id=18517
     7
     8        Reviewed by Adam Roben.
     9
     10        * page/inspector/ResourcesPanel.js:
     11        (WebInspector.ResourcesPanel.prototype.reset): Close the visible resource.
     12        Iterate over all the resources and zero errors and warnings and delete the
     13        resource view and tree element. Removes all children of resourceViews. Passes
     14        true to _updateGraphDividersIfNeeded to force an immediate update.
     15        (WebInspector.ResourcesPanel.prototype.removeResource): Added. Closes
     16        the resource view if it is visible. Removes the resource from the _resources
     17        array. Removes the tree element from the outline tree. Zeros out the errors
     18        and warnings properties. Deletes the tree element and resource view properties.
     19        (WebInspector.ResourcesPanel.prototype.closeVisibleResource): Null check
     20        this._calculator for times when reset is called before the calculator is set.
     21        * page/inspector/inspector.js:
     22        (WebInspector.removeResource): Call ResourcesPanel.removeResource.
     23
    1242008-04-15  Anders Carlsson  <andersca@apple.com>
    225
  • trunk/WebCore/page/inspector/ResourcesPanel.js

    r31910 r31918  
    234234    reset: function()
    235235    {
     236        this.closeVisibleResource();
     237
    236238        if (this._calculator)
    237239            this._calculator.reset();
    238240
     241        if (this._resources) {
     242            var resourcesLength = this._resources.length;
     243            for (var i = 0; i < resourcesLength; ++i) {
     244                var resource = this._resources[i];
     245
     246                resource.warnings = 0;
     247                resource.errors = 0;
     248
     249                delete resource._resourcesTreeElement;
     250                delete resource._resourcesView;
     251            }
     252        }
     253
    239254        this._resources = [];
    240255        this._staleResources = [];
    241256
    242257        this.resourcesTreeElement.removeChildren();
    243 
    244         this._updateGraphDividersIfNeeded();
     258        this.resourceViews.removeChildren();
     259
     260        this._updateGraphDividersIfNeeded(true);
    245261
    246262        this._drawSummaryGraph(); // draws an empty graph
     
    259275
    260276        this.refreshResource(resource);
     277    },
     278
     279    removeResource: function(resource)
     280    {
     281        if (this.visibleResourceView === resource._resourcesView)
     282            this.closeVisibleResource();
     283
     284        var resourcesLength = this._resources.length;
     285        for (var i = 0; i < resourcesLength; ++i) {
     286            if (this._resources[i] === resource) {
     287                this._resources.splice(i, 1);
     288                break;
     289            }
     290        }
     291
     292        this.resourcesTreeElement.removeChild(resource._resourcesTreeElement);
     293
     294        resource.warnings = 0;
     295        resource.errors = 0;
     296
     297        delete resource._resourcesTreeElement;
     298        delete resource._resourcesView;
    261299    },
    262300
     
    380418        delete this.visibleResource;
    381419
    382         this.calculator._graphsTreeElement.select(true);
     420        if (this._calculator && this._calculator._graphsTreeElement)
     421            this._calculator._graphsTreeElement.select(true);
    383422
    384423        this._updateSidebarWidth();
  • trunk/WebCore/page/inspector/inspector.js

    r31889 r31918  
    617617        }
    618618    }
     619
     620    this.panels.resources.removeResource(resource);
    619621}
    620622
Note: See TracChangeset for help on using the changeset viewer.