[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
pfeldman at chromium.org
pfeldman at chromium.org
Wed Dec 22 14:51:38 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit d8b9f78d825238b95a5eb83a9ac506ce2101388c
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Oct 22 13:33:14 2010 +0000
2010-10-22 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
Web Inspector: update resources tree in storage panel upon network events.
https://bugs.webkit.org/show_bug.cgi?id=48121
* inspector/Inspector.idl:
* inspector/InspectorResourceAgent.cpp:
(WebCore::buildObjectForDocumentLoader):
(WebCore::buildObjectForFrameTree):
(WebCore::InspectorResourceAgent::didCommitLoad):
(WebCore::InspectorResourceAgent::frameDetachedFromParent):
* inspector/front-end/ResourceManager.js:
(WebInspector.ResourceManager):
(WebInspector.ResourceManager.prototype._createResource):
(WebInspector.ResourceManager.prototype.didReceiveResponse):
(WebInspector.ResourceManager.prototype.didLoadResourceFromMemoryCache):
(WebInspector.ResourceManager.prototype.didCommitLoadForFrame):
(WebInspector.ResourceManager.prototype._addResourceToStorageFrame):
(WebInspector.ResourceManager.prototype.frameDetachedFromParent):
(WebInspector.ResourceManager.prototype._clearResources):
(WebInspector.ResourceManager.prototype._processCachedResources):
(WebInspector.ResourceManager.prototype._addFramesRecursively):
(WebInspector.ResourceManager.getContents):
* inspector/front-end/StoragePanel.js:
(WebInspector.StoragePanel.prototype.addOrUpdateFrame):
(WebInspector.StoragePanel.prototype.removeFrame):
(WebInspector.StoragePanel.prototype.addResourceToFrame):
(WebInspector.StoragePanel.prototype.removeResourcesFromFrame):
(WebInspector.BaseStorageTreeElement.prototype.onattach):
(WebInspector.BaseStorageTreeElement.prototype.onreveal):
(WebInspector.BaseStorageTreeElement.prototype.set titleText):
(WebInspector.FrameTreeElement):
(WebInspector.FrameTreeElement.prototype.onselect):
(WebInspector.FrameTreeElement.prototype.get displayName):
(WebInspector.FrameTreeElement.prototype.set displayName):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d8b8158..515d2f0 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,41 @@
+2010-10-22 Pavel Feldman <pfeldman at chromium.org>
+
+ Reviewed by Yury Semikhatsky.
+
+ Web Inspector: update resources tree in storage panel upon network events.
+ https://bugs.webkit.org/show_bug.cgi?id=48121
+
+ * inspector/Inspector.idl:
+ * inspector/InspectorResourceAgent.cpp:
+ (WebCore::buildObjectForDocumentLoader):
+ (WebCore::buildObjectForFrameTree):
+ (WebCore::InspectorResourceAgent::didCommitLoad):
+ (WebCore::InspectorResourceAgent::frameDetachedFromParent):
+ * inspector/front-end/ResourceManager.js:
+ (WebInspector.ResourceManager):
+ (WebInspector.ResourceManager.prototype._createResource):
+ (WebInspector.ResourceManager.prototype.didReceiveResponse):
+ (WebInspector.ResourceManager.prototype.didLoadResourceFromMemoryCache):
+ (WebInspector.ResourceManager.prototype.didCommitLoadForFrame):
+ (WebInspector.ResourceManager.prototype._addResourceToStorageFrame):
+ (WebInspector.ResourceManager.prototype.frameDetachedFromParent):
+ (WebInspector.ResourceManager.prototype._clearResources):
+ (WebInspector.ResourceManager.prototype._processCachedResources):
+ (WebInspector.ResourceManager.prototype._addFramesRecursively):
+ (WebInspector.ResourceManager.getContents):
+ * inspector/front-end/StoragePanel.js:
+ (WebInspector.StoragePanel.prototype.addOrUpdateFrame):
+ (WebInspector.StoragePanel.prototype.removeFrame):
+ (WebInspector.StoragePanel.prototype.addResourceToFrame):
+ (WebInspector.StoragePanel.prototype.removeResourcesFromFrame):
+ (WebInspector.BaseStorageTreeElement.prototype.onattach):
+ (WebInspector.BaseStorageTreeElement.prototype.onreveal):
+ (WebInspector.BaseStorageTreeElement.prototype.set titleText):
+ (WebInspector.FrameTreeElement):
+ (WebInspector.FrameTreeElement.prototype.onselect):
+ (WebInspector.FrameTreeElement.prototype.get displayName):
+ (WebInspector.FrameTreeElement.prototype.set displayName):
+
2010-10-22 François Sausset <sausset at gmail.com>
Reviewed by Kenneth Rohde Christiansen.
diff --git a/WebCore/inspector/Inspector.idl b/WebCore/inspector/Inspector.idl
index b5a4388..107f156 100644
--- a/WebCore/inspector/Inspector.idl
+++ b/WebCore/inspector/Inspector.idl
@@ -123,8 +123,8 @@ module core {
[notify] void didFailLoading(out long identifier, out double time, out String localizedDescription);
[notify] void didLoadResourceFromMemoryCache(out double time, out Object resource);
[notify] void setOverrideContent(out long identifier, out String sourceString, out String type);
- [notify] void didCommitLoadForFrame(out Object frameTree, out unsigned long loaderId);
- [notify] void frameDetachedFromParent(out Object frameTree);
+ [notify] void didCommitLoadForFrame(out unsigned long parentFrameId, out Object loader);
+ [notify] void frameDetachedFromParent(out unsigned long frameId);
[notify] void didCreateWebSocket(out unsigned long identifier, out String requestURL);
[notify] void willSendWebSocketHandshakeRequest(out unsigned long identifier, out double time, out Object request);
diff --git a/WebCore/inspector/InspectorResourceAgent.cpp b/WebCore/inspector/InspectorResourceAgent.cpp
index 0df3e87..ee7457b 100644
--- a/WebCore/inspector/InspectorResourceAgent.cpp
+++ b/WebCore/inspector/InspectorResourceAgent.cpp
@@ -204,6 +204,7 @@ static PassRefPtr<InspectorObject> buildObjectForDocumentLoader(DocumentLoader*
RefPtr<InspectorObject> documentLoaderObject = InspectorObject::create();
documentLoaderObject->setNumber("frameId", reinterpret_cast<uintptr_t>(loader->frame()));
documentLoaderObject->setNumber("loaderId", reinterpret_cast<uintptr_t>(loader));
+ documentLoaderObject->setString("url", loader->requestURL().string());
return documentLoaderObject;
}
@@ -350,6 +351,7 @@ void InspectorResourceAgent::setOverrideContent(unsigned long identifier, const
static PassRefPtr<InspectorObject> buildObjectForFrameTree(Frame* frame, bool dumpResources)
{
RefPtr<InspectorObject> frameObject = InspectorObject::create();
+ frameObject->setNumber("parentId", reinterpret_cast<uintptr_t>(frame->tree()->parent()));
frameObject->setNumber("id", reinterpret_cast<uintptr_t>(frame));
if (dumpResources)
populateObjectWithFrameResources(frame, frameObject);
@@ -366,14 +368,13 @@ static PassRefPtr<InspectorObject> buildObjectForFrameTree(Frame* frame, bool du
void InspectorResourceAgent::didCommitLoad(DocumentLoader* loader)
{
- RefPtr<InspectorObject> frameObject = buildObjectForFrameTree(loader->frame(), false);
- m_frontend->didCommitLoadForFrame(frameObject, reinterpret_cast<uintptr_t>(loader));
+ Frame* parentFrame = loader->frame()->tree()->parent();
+ m_frontend->didCommitLoadForFrame(reinterpret_cast<uintptr_t>(parentFrame), buildObjectForDocumentLoader(loader));
}
void InspectorResourceAgent::frameDetachedFromParent(Frame* frame)
{
- RefPtr<InspectorObject> frameObject = buildObjectForFrameTree(frame, false);
- m_frontend->frameDetachedFromParent(frameObject);
+ m_frontend->frameDetachedFromParent(reinterpret_cast<uintptr_t>(frame));
}
#if ENABLE(WEB_SOCKETS)
diff --git a/WebCore/inspector/front-end/ResourceManager.js b/WebCore/inspector/front-end/ResourceManager.js
index 67479e2..2d8dda1 100644
--- a/WebCore/inspector/front-end/ResourceManager.js
+++ b/WebCore/inspector/front-end/ResourceManager.js
@@ -48,7 +48,7 @@ WebInspector.ResourceManager = function()
"didCloseWebSocket");
this._resourcesById = {};
- this._resourcesByFrame = {};
+ this._resourcesByFrameId = {};
this._lastCachedId = 0;
InspectorBackend.cachedResources(this._processCachedResources.bind(this));
}
@@ -75,12 +75,12 @@ WebInspector.ResourceManager.prototype = {
this._resourcesById[identifier] = resource;
resource.loader = loader;
- var resourcesForFrame = this._resourcesByFrame[loader.frameId];
+ var resourcesForFrame = this._resourcesByFrameId[loader.frameId];
if (!resourcesForFrame) {
- resourcesForFrame = {};
- this._resourcesByFrame[loader.frameId] = resourcesForFrame;
+ resourcesForFrame = [];
+ this._resourcesByFrameId[loader.frameId] = resourcesForFrame;
}
- resourcesForFrame[resource.identifier] = resource;
+ resourcesForFrame.push(resource);
return resource;
},
@@ -146,6 +146,7 @@ WebInspector.ResourceManager.prototype = {
resource.responseReceivedTime = time;
WebInspector.panels.network.refreshResource(resource);
+ this._addResourceToStorageFrame(resource.loader.frameId, resource);
},
_updateResourceWithResponse: function(resource, response)
@@ -217,6 +218,7 @@ WebInspector.ResourceManager.prototype = {
resource.startTime = resource.responseReceivedTime = resource.endTime = time;
WebInspector.panels.network.addResource(resource);
+ WebInspector.panels.storage.addResourceToFrame(resource.loader.frameId, resource);
},
_updateResourceWithCachedResource: function(resource, cachedResource)
@@ -238,33 +240,50 @@ WebInspector.ResourceManager.prototype = {
WebInspector.panels.network.addResource(resource);
},
- didCommitLoadForFrame: function(frameTree, loaderId)
+ didCommitLoadForFrame: function(parentFrameId, loader)
{
- this._clearResources(frameTree.id, loaderId);
- for (var i = 0; frameTree.children && frameTree.children.length; ++i)
- this.didCommitLoadForFrame(frameTree.children[i], loaderId);
+ this._clearResources(loader.frameId, loader.loaderId);
+ WebInspector.panels.storage.removeResourcesFromFrame(loader.frameId);
+
+ var tmpResource = new WebInspector.Resource(null, loader.url);
+ WebInspector.panels.storage.addOrUpdateFrame(parentFrameId, loader.frameId, tmpResource.displayName);
+
+ var resourcesForFrame = this._resourcesByFrameId[loader.frameId];
+ for (var i = 0; i < resourcesForFrame.length; ++i)
+ this._addResourceToStorageFrame(loader.frameId, resourcesForFrame[i]);
+ },
+
+ _addResourceToStorageFrame: function(frameId, resource)
+ {
+ // Do not show redirects in resource browser.
+ if (resource.statusCode < 300 || resource.statusCode > 303)
+ WebInspector.panels.storage.addResourceToFrame(frameId, resource);
},
- frameDetachedFromParent: function(frameTree)
+ frameDetachedFromParent: function(frameId)
{
- this.didCommitLoadForFrame(frameTree, 0);
+ this._clearResources(frameId, 0);
+ WebInspector.panels.storage.removeFrame(frameId);
},
_clearResources: function(frameId, loaderToPreserveId)
{
- var resourcesForFrame = this._resourcesByFrame[frameId];
- if (resourcesForFrame)
+ var resourcesForFrame = this._resourcesByFrameId[frameId];
+ if (!resourcesForFrame)
return;
- for (var id in resourcesForFrame) {
- var resource = this._resourcesById[id];
- if (resource.loaderId === loaderToPreserveId)
+ var preservedResourcesForFrame = [];
+ for (var i = 0; i < resourcesForFrame.length; ++i) {
+ var resource = resourcesForFrame[i];
+ if (resource.loader.loaderId === loaderToPreserveId) {
+ preservedResourcesForFrame.push(resource);
continue;
+ }
delete this._resourcesById[id];
- delete resourcesForFrame[id];
}
- if (!Object.keys(resourcesForFrame).length)
- delete this._resourcesByFrame[frameId];
+ delete this._resourcesByFrameId[frameId];
+ if (preservedResourcesForFrame.length)
+ this._resourcesByFrameId[frameId] = preservedResourcesForFrame;
},
didCreateWebSocket: function(identifier, requestURL)
@@ -317,37 +336,28 @@ WebInspector.ResourceManager.prototype = {
_processCachedResources: function(mainFramePayload)
{
- this._appendFramesRecursively(null, mainFramePayload);
+ this._addFramesRecursively(null, mainFramePayload);
},
- _appendFramesRecursively: function(parentFrameId, framePayload)
+ _addFramesRecursively: function(parentFrameId, framePayload)
{
var frameResource = this._createResource(null, framePayload.resource.url, framePayload.resource.loader);
frameResource.type = WebInspector.Resource.Type["Document"];
- WebInspector.panels.storage.addFrame(parentFrameId, framePayload.id, frameResource);
+ WebInspector.panels.storage.addOrUpdateFrame(parentFrameId, framePayload.id, frameResource.displayName);
+ WebInspector.panels.storage.addResourceToFrame(framePayload.id, frameResource);
for (var i = 0; framePayload.children && i < framePayload.children.length; ++i)
- this._appendFramesRecursively(framePayload.id, framePayload.children[i]);
+ this._addFramesRecursively(framePayload.id, framePayload.children[i]);
if (!framePayload.subresources)
return;
- var resources = [];
for (var i = 0; i < framePayload.subresources.length; ++i) {
var cachedResource = framePayload.subresources[i];
var resource = this._createResource(null, cachedResource.url, cachedResource.loader);
this._updateResourceWithCachedResource(resource, cachedResource);
- resources.push(resource);
+ WebInspector.panels.storage.addResourceToFrame(framePayload.id, resource);
}
-
- function comparator(a, b)
- {
- return a.displayName.localeCompare(b.displayName);
- }
- resources.sort(comparator);
-
- for (var i = 0; i < resources.length; ++i)
- WebInspector.panels.storage.addFrameResource(framePayload.id, resources[i]);
}
}
@@ -396,6 +406,11 @@ WebInspector.ResourceManager.resourceViewForResource = function(resource)
WebInspector.ResourceManager.getContents = function(resource, callback)
{
+ if ("overridenContent" in resource) {
+ callback(resource.overridenContent);
+ return;
+ }
+
// FIXME: eventually, cached resources will have no identifiers.
if (resource.loader)
InspectorBackend.resourceContent(resource.loader.frameId, resource.url, callback);
diff --git a/WebCore/inspector/front-end/StoragePanel.js b/WebCore/inspector/front-end/StoragePanel.js
index 2d22713..0d80082 100644
--- a/WebCore/inspector/front-end/StoragePanel.js
+++ b/WebCore/inspector/front-end/StoragePanel.js
@@ -119,51 +119,84 @@ WebInspector.StoragePanel.prototype = {
this.sidebarTree.selectedTreeElement.deselect();
},
- addFrame: function(parentFrameId, frameId, frameResource)
+ addOrUpdateFrame: function(parentFrameId, frameId, displayName)
{
+ var frameTreeElement = this._treeElementForFrameId[frameId];
+ if (frameTreeElement) {
+ frameTreeElement.displayName = displayName;
+ return;
+ }
+
var parentTreeElement = parentFrameId ? this._treeElementForFrameId[parentFrameId] : this.resourcesListTreeElement;
if (!parentTreeElement) {
console.error("No frame with id:" + parentFrameId + " to route " + displayName + " to.")
return;
}
- var frameTreeElement = new WebInspector.FrameTreeElement(this, frameId, frameResource);
+ var frameTreeElement = new WebInspector.FrameTreeElement(this, frameId, displayName);
this._treeElementForFrameId[frameId] = frameTreeElement;
+
+ // Insert in the alphabetical order, first frames, then resources.
+ var children = parentTreeElement.children;
+ for (var i = 0; i < children.length; ++i) {
+ var child = children[i];
+ if (!(child instanceof WebInspector.FrameTreeElement)) {
+ parentTreeElement.insertChild(frameTreeElement, i);
+ return;
+ }
+ if (child.displayName.localeCompare(frameTreeElement.displayName) > 0) {
+ parentTreeElement.insertChild(frameTreeElement, i);
+ return;
+ }
+ }
parentTreeElement.appendChild(frameTreeElement);
},
removeFrame: function(frameId)
{
var frameTreeElement = this._treeElementForFrameId[frameId];
- if (!frameTreeElement) {
- console.error("No frame with id:" + frameId + " to remove.");
+ if (!frameTreeElement)
return;
- }
+
+ var children = frameTreeElement.children.slice();
+ for (var i = 0; i < children.length; ++i)
+ this.removeFrame(children[i]._frameId);
delete this._treeElementForFrameId[frameId];
frameTreeElement.parent.removeChild(frameTreeElement);
},
- addFrameResource: function(frameId, resource)
+ addResourceToFrame: function(frameId, resource)
{
var frameTreeElement = this._treeElementForFrameId[frameId];
if (!frameTreeElement) {
- console.error("No frame with id:" + frameId + " to add resource to.");
+ console.error("No frame to add resource to");
return;
}
var resourceTreeElement = new WebInspector.FrameResourceTreeElement(this, resource);
+
+ // Insert in the alphabetical order, first frames, then resources. Document resource goes first.
+ var children = frameTreeElement.children;
+ for (var i = 0; i < children.length; ++i) {
+ var child = children[i];
+ if (!(child instanceof WebInspector.FrameResourceTreeElement))
+ continue;
+
+ if (resource.type === WebInspector.Resource.Type.Document ||
+ (child._resource.type !== WebInspector.Resource.Type.Document && child._resource.displayName.localeCompare(resource.displayName) > 0)) {
+ frameTreeElement.insertChild(resourceTreeElement, i);
+ return;
+ }
+ }
frameTreeElement.appendChild(resourceTreeElement);
},
- removeFrameResources: function(frameId)
+ removeResourcesFromFrame: function(frameId)
{
var frameTreeElement = this._treeElementForFrameId[frameId];
- if (!frameTreeElement) {
- console.error("No frame with id:" + frameId + " to remove resources from.");
- return;
- }
- frameTreeElement.removeChildren();
+ if (frameTreeElement)
+ frameTreeElement.removeChildren();
},
addDatabase: function(database)
@@ -493,10 +526,10 @@ WebInspector.BaseStorageTreeElement.prototype = {
this.imageElement.className = "icon";
this.listItemElement.appendChild(this.imageElement);
- var titleElement = document.createElement("span");
- titleElement.textContent = this._titleText;
- titleElement.className = "storage-base-tree-element-title";
- this.listItemElement.appendChild(titleElement);
+ this.titleElement = document.createElement("span");
+ this.titleElement.textContent = this._titleText;
+ this.titleElement.className = "storage-base-tree-element-title";
+ this.listItemElement.appendChild(this.titleElement);
var selectionElement = document.createElement("div");
selectionElement.className = "selection";
@@ -507,6 +540,12 @@ WebInspector.BaseStorageTreeElement.prototype = {
{
if (this.listItemElement)
this.listItemElement.scrollIntoViewIfNeeded(false);
+ },
+
+ set titleText(titleText)
+ {
+ this._titleText = titleText;
+ this.titleElement.textContent = this._titleText;
}
}
@@ -526,17 +565,28 @@ WebInspector.StorageCategoryTreeElement.prototype = {
}
WebInspector.StorageCategoryTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
-WebInspector.FrameTreeElement = function(storagePanel, frameId, frameResource)
+WebInspector.FrameTreeElement = function(storagePanel, frameId, displayName)
{
- WebInspector.BaseStorageTreeElement.call(this, storagePanel, frameResource.displayName, "frame-storage-tree-item");
+ WebInspector.BaseStorageTreeElement.call(this, storagePanel, displayName, "frame-storage-tree-item");
this._frameId = frameId;
- this._resource = frameResource;
+ this._displayName = displayName;
}
WebInspector.FrameTreeElement.prototype = {
onselect: function()
{
- this._storagePanel.showResource(this._resource);
+ this._storagePanel.showCategoryView(this._displayName);
+ },
+
+ get displayName()
+ {
+ return this._displayName;
+ },
+
+ set displayName(displayName)
+ {
+ this._displayName = displayName;
+ this.titleText = displayName;
}
}
WebInspector.FrameTreeElement.prototype.__proto__ = WebInspector.BaseStorageTreeElement.prototype;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list