[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
caseq at chromium.org
caseq at chromium.org
Sun Feb 20 23:53:45 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit e78217f9ecf7f2a5943a5cd37decb734f45e197e
Author: caseq at chromium.org <caseq at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Jan 26 16:06:28 2011 +0000
2011-01-26 Andrey Kosyakov <caseq at chromium.org>
Reviewed by Pavel Feldman.
Web Inspector: summary bar is not resized properly with the rest of network panel
- Set the size for 304/not modified resources from cached resource.
- Add response headers size to resource transfer size.
https://bugs.webkit.org/show_bug.cgi?id=52886
* inspector/InspectorResourceAgent.cpp:
(WebCore::InspectorResourceAgent::didReceiveResponse):
* inspector/front-end/Resource.js:
(WebInspector.Resource):
(WebInspector.Resource.prototype.get transferSize):
(WebInspector.Resource.prototype.set responseHeaders):
(WebInspector.Resource.prototype._headersSize):
(WebInspector.Resource.prototype._mimeTypeIsConsistentWithType):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76690 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index eb39225..e4c586d 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,21 @@
+2011-01-26 Andrey Kosyakov <caseq at chromium.org>
+
+ Reviewed by Pavel Feldman.
+
+ Web Inspector: summary bar is not resized properly with the rest of network panel
+ - Set the size for 304/not modified resources from cached resource.
+ - Add response headers size to resource transfer size.
+ https://bugs.webkit.org/show_bug.cgi?id=52886
+
+ * inspector/InspectorResourceAgent.cpp:
+ (WebCore::InspectorResourceAgent::didReceiveResponse):
+ * inspector/front-end/Resource.js:
+ (WebInspector.Resource):
+ (WebInspector.Resource.prototype.get transferSize):
+ (WebInspector.Resource.prototype.set responseHeaders):
+ (WebInspector.Resource.prototype._headersSize):
+ (WebInspector.Resource.prototype._mimeTypeIsConsistentWithType):
+
2011-01-26 Carol Szabo <carol.szabo at nokia.com>
Reviewed by Simon Hausmann.
diff --git a/Source/WebCore/inspector/InspectorResourceAgent.cpp b/Source/WebCore/inspector/InspectorResourceAgent.cpp
index 16d2b66..f710f29 100644
--- a/Source/WebCore/inspector/InspectorResourceAgent.cpp
+++ b/Source/WebCore/inspector/InspectorResourceAgent.cpp
@@ -316,23 +316,27 @@ void InspectorResourceAgent::didReceiveResponse(unsigned long identifier, Docume
{
RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(response);
String type = "Other";
- if (loader) {
- if (equalIgnoringFragmentIdentifier(response.url(), loader->frameLoader()->iconURL()))
- type = "Image";
- else {
- CachedResource* cachedResource = InspectorResourceAgent::cachedResource(loader->frame(), response.url());
- if (cachedResource)
- type = cachedResourceTypeString(*cachedResource);
-
- if (equalIgnoringFragmentIdentifier(response.url(), loader->url()) && type == "Other")
- type = "Document";
+ long cachedResourceSize = 0;
+ if (loader) {
+ CachedResource* cachedResource = InspectorResourceAgent::cachedResource(loader->frame(), response.url());
+ if (cachedResource) {
+ type = cachedResourceTypeString(*cachedResource);
+ cachedResourceSize = cachedResource->encodedSize();
// Use mime type from cached resource in case the one in response is empty.
- if (response.mimeType().isEmpty() && cachedResource)
+ if (response.mimeType().isEmpty())
resourceResponse->setString("mimeType", cachedResource->response().mimeType());
}
+ if (equalIgnoringFragmentIdentifier(response.url(), loader->frameLoader()->iconURL()))
+ type = "Image";
+ else if (equalIgnoringFragmentIdentifier(response.url(), loader->url()) && type == "Other")
+ type = "Document";
}
m_frontend->didReceiveResponse(identifier, currentTime(), type, resourceResponse);
+ // If we revalidated the resource and got Not modified, send content length following didReceiveResponse
+ // as there will be no calls to didReceiveContentLength from the network stack.
+ if (cachedResourceSize && response.httpStatusCode() == 304)
+ didReceiveContentLength(identifier, cachedResourceSize);
}
void InspectorResourceAgent::didReceiveContentLength(unsigned long identifier, int lengthReceived)
diff --git a/Source/WebCore/inspector/front-end/Resource.js b/Source/WebCore/inspector/front-end/Resource.js
index 91476e9..3790fdd 100644
--- a/Source/WebCore/inspector/front-end/Resource.js
+++ b/Source/WebCore/inspector/front-end/Resource.js
@@ -34,6 +34,7 @@ WebInspector.Resource = function(identifier, url)
this._requestMethod = "";
this._category = WebInspector.resourceCategories.other;
this._pendingContentCallbacks = [];
+ this._responseHeadersSize = 0;
}
// Keep these in sync with WebCore::InspectorResource::Type
@@ -237,8 +238,21 @@ WebInspector.Resource.prototype = {
get transferSize()
{
- // FIXME: this is wrong for chunked-encoding resources.
- return this.cached ? 0 : Number(this.responseHeaders["Content-Length"] || this.resourceSize || 0);
+ if (this.cached)
+ return 0;
+ if (this.statusCode === 304) // Not modified
+ return this._responseHeadersSize;
+ // FIXME: We prefer using Content-Length over resourceSize as
+ // resourceSize may differ from actual transfer size if platform's
+ // network stack performed decoding (e.g. gzip decompression).
+ // The Content-Length, though, is expected to come from raw
+ // response headers and will reflect actual transfer length.
+ // This won't work for chunked content encoding, so fall back to
+ // resourceSize when we don't have Content-Length. This still won't
+ // work for chunks with non-trivial encodings. We need a way to
+ // get actaul transfer size from the network stack.
+ var bodySize = Number(this.responseHeaders["Content-Length"] || this.resourceSize);
+ return this._responseHeadersSize + bodySize;
},
get expectedContentLength()
@@ -303,7 +317,6 @@ WebInspector.Resource.prototype = {
delete this._timing;
},
-
get timing()
{
return this._timing;
@@ -431,6 +444,8 @@ WebInspector.Resource.prototype = {
set responseHeaders(x)
{
this._responseHeaders = x;
+ // FIXME: we should take actual headers size from network stack, when possible.
+ this._responseHeadersSize = this._headersSize(x);
delete this._sortedResponseHeaders;
delete this._responseCookies;
@@ -512,6 +527,14 @@ WebInspector.Resource.prototype = {
}
},
+ _headersSize: function(headers)
+ {
+ var size = 0;
+ for (var header in headers)
+ size += header.length + headers[header].length + 3; // _typical_ overhead per herader is ": ".length + "\n".length.
+ return size;
+ },
+
get errors()
{
return this._errors || 0;
@@ -550,9 +573,9 @@ WebInspector.Resource.prototype = {
return true;
if (typeof this.type === "undefined"
- || this.type === WebInspector.Resource.Type.Other
- || this.type === WebInspector.Resource.Type.XHR
- || this.type === WebInspector.Resource.Type.WebSocket)
+ || this.type === WebInspector.Resource.Type.Other
+ || this.type === WebInspector.Resource.Type.XHR
+ || this.type === WebInspector.Resource.Type.WebSocket)
return true;
if (!this.mimeType)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list