Commit 71584c44 authored by timothy@apple.com's avatar timothy@apple.com

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@31918 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 6d4ec89b
2008-04-15 Timothy Hatcher <timothy@apple.com>
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.
2008-04-15 Anders Carlsson <andersca@apple.com>
Reviewed by Adam.
......@@ -233,15 +233,31 @@ WebInspector.ResourcesPanel.prototype = {
reset: function()
{
this.closeVisibleResource();
if (this._calculator)
this._calculator.reset();
if (this._resources) {
var resourcesLength = this._resources.length;
for (var i = 0; i < resourcesLength; ++i) {
var resource = this._resources[i];
resource.warnings = 0;
resource.errors = 0;
delete resource._resourcesTreeElement;
delete resource._resourcesView;
}
}
this._resources = [];
this._staleResources = [];
this.resourcesTreeElement.removeChildren();
this.resourceViews.removeChildren();
this._updateGraphDividersIfNeeded();
this._updateGraphDividersIfNeeded(true);
this._drawSummaryGraph(); // draws an empty graph
},
......@@ -260,6 +276,28 @@ WebInspector.ResourcesPanel.prototype = {
this.refreshResource(resource);
},
removeResource: function(resource)
{
if (this.visibleResourceView === resource._resourcesView)
this.closeVisibleResource();
var resourcesLength = this._resources.length;
for (var i = 0; i < resourcesLength; ++i) {
if (this._resources[i] === resource) {
this._resources.splice(i, 1);
break;
}
}
this.resourcesTreeElement.removeChild(resource._resourcesTreeElement);
resource.warnings = 0;
resource.errors = 0;
delete resource._resourcesTreeElement;
delete resource._resourcesView;
},
addMessageToResource: function(resource, msg)
{
if (!resource)
......@@ -379,7 +417,8 @@ WebInspector.ResourcesPanel.prototype = {
this.visibleResource._resourcesView.hide();
delete this.visibleResource;
this.calculator._graphsTreeElement.select(true);
if (this._calculator && this._calculator._graphsTreeElement)
this._calculator._graphsTreeElement.select(true);
this._updateSidebarWidth();
},
......
......@@ -616,6 +616,8 @@ WebInspector.removeResource = function(resource)
break;
}
}
this.panels.resources.removeResource(resource);
}
WebInspector.addDatabase = function(database)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment