Changeset 76690 in webkit
- Timestamp:
- Jan 26, 2011 8:06:28 AM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r76689 r76690 1 2011-01-26 Andrey Kosyakov <caseq@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: summary bar is not resized properly with the rest of network panel 6 - Set the size for 304/not modified resources from cached resource. 7 - Add response headers size to resource transfer size. 8 https://bugs.webkit.org/show_bug.cgi?id=52886 9 10 * inspector/InspectorResourceAgent.cpp: 11 (WebCore::InspectorResourceAgent::didReceiveResponse): 12 * inspector/front-end/Resource.js: 13 (WebInspector.Resource): 14 (WebInspector.Resource.prototype.get transferSize): 15 (WebInspector.Resource.prototype.set responseHeaders): 16 (WebInspector.Resource.prototype._headersSize): 17 (WebInspector.Resource.prototype._mimeTypeIsConsistentWithType): 18 1 19 2011-01-26 Carol Szabo <carol.szabo@nokia.com> 2 20 -
trunk/Source/WebCore/inspector/InspectorResourceAgent.cpp
r76472 r76690 317 317 RefPtr<InspectorObject> resourceResponse = buildObjectForResourceResponse(response); 318 318 String type = "Other"; 319 long cachedResourceSize = 0; 320 319 321 if (loader) { 322 CachedResource* cachedResource = InspectorResourceAgent::cachedResource(loader->frame(), response.url()); 323 if (cachedResource) { 324 type = cachedResourceTypeString(*cachedResource); 325 cachedResourceSize = cachedResource->encodedSize(); 326 // Use mime type from cached resource in case the one in response is empty. 327 if (response.mimeType().isEmpty()) 328 resourceResponse->setString("mimeType", cachedResource->response().mimeType()); 329 } 320 330 if (equalIgnoringFragmentIdentifier(response.url(), loader->frameLoader()->iconURL())) 321 331 type = "Image"; 322 else { 323 CachedResource* cachedResource = InspectorResourceAgent::cachedResource(loader->frame(), response.url()); 324 if (cachedResource) 325 type = cachedResourceTypeString(*cachedResource); 326 327 if (equalIgnoringFragmentIdentifier(response.url(), loader->url()) && type == "Other") 328 type = "Document"; 329 330 // Use mime type from cached resource in case the one in response is empty. 331 if (response.mimeType().isEmpty() && cachedResource) 332 resourceResponse->setString("mimeType", cachedResource->response().mimeType()); 333 } 332 else if (equalIgnoringFragmentIdentifier(response.url(), loader->url()) && type == "Other") 333 type = "Document"; 334 334 } 335 335 m_frontend->didReceiveResponse(identifier, currentTime(), type, resourceResponse); 336 // If we revalidated the resource and got Not modified, send content length following didReceiveResponse 337 // as there will be no calls to didReceiveContentLength from the network stack. 338 if (cachedResourceSize && response.httpStatusCode() == 304) 339 didReceiveContentLength(identifier, cachedResourceSize); 336 340 } 337 341 -
trunk/Source/WebCore/inspector/front-end/Resource.js
r76519 r76690 35 35 this._category = WebInspector.resourceCategories.other; 36 36 this._pendingContentCallbacks = []; 37 this._responseHeadersSize = 0; 37 38 } 38 39 … … 238 239 get transferSize() 239 240 { 240 // FIXME: this is wrong for chunked-encoding resources. 241 return this.cached ? 0 : Number(this.responseHeaders["Content-Length"] || this.resourceSize || 0); 241 if (this.cached) 242 return 0; 243 if (this.statusCode === 304) // Not modified 244 return this._responseHeadersSize; 245 // FIXME: We prefer using Content-Length over resourceSize as 246 // resourceSize may differ from actual transfer size if platform's 247 // network stack performed decoding (e.g. gzip decompression). 248 // The Content-Length, though, is expected to come from raw 249 // response headers and will reflect actual transfer length. 250 // This won't work for chunked content encoding, so fall back to 251 // resourceSize when we don't have Content-Length. This still won't 252 // work for chunks with non-trivial encodings. We need a way to 253 // get actaul transfer size from the network stack. 254 var bodySize = Number(this.responseHeaders["Content-Length"] || this.resourceSize); 255 return this._responseHeadersSize + bodySize; 242 256 }, 243 257 … … 304 318 }, 305 319 306 307 320 get timing() 308 321 { … … 432 445 { 433 446 this._responseHeaders = x; 447 // FIXME: we should take actual headers size from network stack, when possible. 448 this._responseHeadersSize = this._headersSize(x); 434 449 delete this._sortedResponseHeaders; 435 450 delete this._responseCookies; … … 513 528 }, 514 529 530 _headersSize: function(headers) 531 { 532 var size = 0; 533 for (var header in headers) 534 size += header.length + headers[header].length + 3; // _typical_ overhead per herader is ": ".length + "\n".length. 535 return size; 536 }, 537 515 538 get errors() 516 539 { … … 551 574 552 575 if (typeof this.type === "undefined" 553 || this.type === WebInspector.Resource.Type.Other554 || this.type === WebInspector.Resource.Type.XHR555 || this.type === WebInspector.Resource.Type.WebSocket)576 || this.type === WebInspector.Resource.Type.Other 577 || this.type === WebInspector.Resource.Type.XHR 578 || this.type === WebInspector.Resource.Type.WebSocket) 556 579 return true; 557 580
Note: See TracChangeset
for help on using the changeset viewer.