Changeset 90010 in webkit
- Timestamp:
- Jun 29, 2011 5:43:45 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r90009 r90010 1 2011-06-29 Mike West <mkwst@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: Missing fields in HAR 6 https://bugs.webkit.org/show_bug.cgi?id=58127 7 8 Setting correct expectations for the following fields newly added to 9 the HAR implementation: 10 11 - entry.request.httpVersion 12 - entry.request.headersSize 13 - entry.request.bodySize 14 - entry.response.httpVersion 15 - entry.response.headersSize 16 - entry.response.bodySize 17 - entry.response.content.compression 18 19 * http/tests/inspector/network/network-size.html: 20 * http/tests/inspector/resource-har-conversion-expected.txt: 21 * http/tests/inspector/resource-har-conversion.html: 22 * http/tests/inspector/resource-har-headers-expected.txt: Added. 23 * http/tests/inspector/resource-har-headers.html: Added. 24 * http/tests/inspector/resource-parameters-expected.txt: 25 * http/tests/inspector/resources-test.js: 26 1 27 2011-06-29 Philippe Normand <pnormand@igalia.com> 2 28 -
trunk/LayoutTests/http/tests/inspector/network/network-size.html
r87073 r90010 37 37 InspectorTest.addResult(resource1.url); 38 38 InspectorTest.addResult("resourceSize: " + resource1.resourceSize); 39 InspectorTest.addResult("transferSize: " + (resource1.transferSize - resource1. _responseHeadersSize));39 InspectorTest.addResult("transferSize: " + (resource1.transferSize - resource1.responseHeadersSize)); 40 40 41 41 var resource2 = WebInspector.panels.network.resources[resourcesCount - 1]; 42 42 InspectorTest.addResult(resource2.url); 43 43 InspectorTest.addResult("resourceSize: " + resource2.resourceSize); 44 InspectorTest.addResult("transferSize: " + (resource2.transferSize - resource2. _responseHeadersSize));44 InspectorTest.addResult("transferSize: " + (resource2.transferSize - resource2.responseHeadersSize)); 45 45 46 46 InspectorTest.completeTest(); -
trunk/LayoutTests/http/tests/inspector/resource-har-conversion-expected.txt
r87073 r90010 27 27 method : "GET" 28 28 url : "http://127.0.0.1:8000/inspector/inspector-test.js" 29 httpVersion : "HTTP/1.1" 29 30 headers : <object> 30 31 queryString : [ … … 59 60 } 60 61 ] 61 headersSize : -162 headersSize : <number> 62 63 bodySize : <number> 63 64 } … … 65 66 status : 304 66 67 statusText : "Not Modified" 68 httpVersion : "HTTP/1.1" 67 69 headers : <object> 68 70 cookies : [ … … 97 99 content : { 98 100 size : <number> 101 compression : <number> 99 102 mimeType : "application/x-javascript" 100 103 } 101 104 redirectURL : "" 102 headersSize : -1105 headersSize : <number> 103 106 bodySize : <number> 104 107 } … … 114 117 method : "GET" 115 118 url : "http://127.0.0.1:8000/inspector/resource-har-conversion.html" 116 headers : <object> 117 queryString : [ 118 ] 119 cookies : [ 120 ] 121 headersSize : -1 119 httpVersion : "HTTP/1.1" 120 headers : <object> 121 queryString : [ 122 ] 123 cookies : [ 124 ] 125 headersSize : <number> 122 126 bodySize : <number> 123 127 } … … 125 129 status : 200 126 130 statusText : "OK" 127 headers : <object> 128 cookies : [ 129 ] 130 content : { 131 size : <number> 131 httpVersion : "HTTP/1.1" 132 headers : <object> 133 cookies : [ 134 ] 135 content : { 136 size : <number> 137 compression : <number> 132 138 mimeType : "text/html" 133 139 } 134 140 redirectURL : "" 135 headersSize : -1141 headersSize : <number> 136 142 bodySize : <number> 137 143 } … … 147 153 method : "GET" 148 154 url : "http://127.0.0.1:8000/inspector/resources-test.js" 149 headers : <object> 150 queryString : [ 151 ] 152 cookies : [ 153 ] 154 headersSize : -1 155 httpVersion : "HTTP/1.1" 156 headers : <object> 157 queryString : [ 158 ] 159 cookies : [ 160 ] 161 headersSize : <number> 155 162 bodySize : <number> 156 163 } … … 158 165 status : 304 159 166 statusText : "Not Modified" 160 headers : <object> 161 cookies : [ 162 ] 163 content : { 164 size : <number> 167 httpVersion : "HTTP/1.1" 168 headers : <object> 169 cookies : [ 170 ] 171 content : { 172 size : <number> 173 compression : <number> 165 174 mimeType : "application/x-javascript" 166 175 } 167 176 redirectURL : "" 168 headersSize : -1177 headersSize : <number> 169 178 bodySize : <number> 170 179 } … … 180 189 method : "POST" 181 190 url : "http://127.0.0.1:8000/inspector/resources/post-target.cgi" 182 headers : <object> 183 queryString : [ 184 ] 185 cookies : [ 186 ] 187 headersSize : -1 191 httpVersion : "HTTP/1.1" 192 headers : <object> 193 queryString : [ 194 ] 195 cookies : [ 196 ] 197 headersSize : <number> 188 198 bodySize : <number> 189 199 postData : { … … 195 205 status : 200 196 206 statusText : "OK" 197 headers : <object> 198 cookies : [ 199 ] 200 content : { 201 size : <number> 207 httpVersion : "HTTP/1.1" 208 headers : <object> 209 cookies : [ 210 ] 211 content : { 212 size : <number> 213 compression : <number> 202 214 mimeType : "application/xml" 203 215 } 204 216 redirectURL : "" 205 headersSize : -1217 headersSize : <number> 206 218 bodySize : <number> 207 219 } -
trunk/LayoutTests/http/tests/inspector/resource-har-conversion.html
r87073 r90010 1 <!doctype html> 1 2 <html> 2 3 <head> … … 38 39 "Cookie": "a=b; $Path=/path; $Domain=example.com; a1=b1\nc1=d1" 39 40 }; 41 40 42 resource.responseHeaders = { 41 43 "Set-Cookie": "x=y; Path=/path; Domain=example.com; Discard; httpOnly; Secure; Version=1\nx1=y1\nz2=y2" -
trunk/LayoutTests/http/tests/inspector/resource-parameters-expected.txt
r89049 r90010 10 10 method : "POST" 11 11 url : "http://localhost:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=" 12 httpVersion : "HTTP/1.1" 12 13 headers : <object> 13 14 queryString : [ … … 23 24 cookies : [ 24 25 ] 25 headersSize : -126 bodySize : -126 headersSize : <number> 27 bodySize : <number> 27 28 postData : { 28 29 mimeType : "application/x-www-form-urlencoded" … … 43 44 status : 200 44 45 statusText : "OK" 46 httpVersion : "HTTP/1.1" 45 47 headers : <object> 46 48 cookies : [ … … 48 50 content : { 49 51 size : 14 52 compression : <number> 50 53 mimeType : "application/xml" 51 54 } 52 55 redirectURL : "" 53 headersSize : -154 bodySize : 1456 headersSize : <number> 57 bodySize : <number> 55 58 } 56 59 cache : { -
trunk/LayoutTests/http/tests/inspector/resources-test.js
r87073 r90010 2 2 3 3 InspectorTest.HARNondeterministicProperties = { 4 bodySize: 1, 5 compression: 1, 6 headers: 1, 7 headersSize: 1, 8 id: 1, 9 onContentLoad: 1, 10 onLoad: 1, 11 receive: 1, 4 12 startedDateTime: 1, 5 13 time: 1, 6 wait: 1,7 receive: 1,8 headers: 1,9 14 timings: 1, 10 15 version: 1, 11 startedDateTime: 1, 12 id: 1, 13 onContentLoad: 1, 14 onLoad: 1 16 wait: 1, 15 17 }; 16 18 … … 19 21 InspectorTest.HARNondeterministicPropertiesWithSize = JSON.parse(JSON.stringify(InspectorTest.HARNondeterministicProperties)); 20 22 InspectorTest.HARNondeterministicPropertiesWithSize.size = 1; 21 InspectorTest.HARNondeterministicPropertiesWithSize.bodySize = 1; 23 22 24 23 25 InspectorTest.resourceURLComparer = function(r1, r2) -
trunk/Source/WebCore/ChangeLog
r90004 r90010 1 2011-06-29 Mike West <mkwst@chromium.org> 2 3 Reviewed by Pavel Feldman. 4 5 Web Inspector: Missing fields in HAR 6 https://bugs.webkit.org/show_bug.cgi?id=58127 7 8 Specifically, this patch adds: 9 - entry.request.httpVersion 10 - entry.request.headersSize 11 - entry.request.bodySize 12 - entry.response.httpVersion 13 - entry.response.headersSize 14 - entry.response.bodySize 15 - entry.response.content.compression 16 17 Tests: http/tests/inspector/resource-har-conversion.html 18 http/tests/inspector/resource-har-headers.html 19 http/tests/inspector/resource-parameters.html 20 http/tests/inspector/network/network-size.html 21 22 * inspector/front-end/HAREntry.js: 23 (WebInspector.HAREntry.prototype.build): 24 (WebInspector.HAREntry.prototype._buildRequest): 25 (WebInspector.HAREntry.prototype._buildResponse): 26 (WebInspector.HAREntry.prototype._buildContent): 27 (WebInspector.HAREntry.prototype._buildCookie): 28 (WebInspector.HAREntry.prototype._interval): 29 (WebInspector.HAREntry.prototype.get requestBodySize): 30 (WebInspector.HAREntry.prototype.get responseBodySize): 31 (WebInspector.HAREntry.prototype.get responseCompression): 32 (WebInspector.HARLog.prototype.build): 33 * inspector/front-end/Resource.js: 34 (WebInspector.Resource.prototype.set requestHeaders): 35 (WebInspector.Resource.prototype.get requestHeadersText): 36 (WebInspector.Resource.prototype.set requestHeadersText): 37 (WebInspector.Resource.prototype.get requestHeadersSize): 38 (WebInspector.Resource.prototype.get requestHttpVersion): 39 (WebInspector.Resource.prototype.set responseHeaders): 40 (WebInspector.Resource.prototype.get responseHeadersText): 41 (WebInspector.Resource.prototype.set responseHeadersText): 42 (WebInspector.Resource.prototype.get responseHeadersSize): 43 (WebInspector.Resource.prototype.get responseHttpVersion): 44 1 45 2011-06-29 Hayato Ito <hayato@chromium.org> 2 46 -
trunk/Source/WebCore/inspector/front-end/HAREntry.js
r89049 r90010 49 49 request: this._buildRequest(), 50 50 response: this._buildResponse(), 51 cache: { }, // Not supp roted yet.51 cache: { }, // Not supported yet. 52 52 timings: this._buildTimings() 53 53 }; … … 59 59 method: this._resource.requestMethod, 60 60 url: this._buildRequestURL(this._resource.url), 61 // httpVersion: "HTTP/1.1" -- Not available.61 httpVersion: this._resource.requestHttpVersion, 62 62 headers: this._buildHeaders(this._resource.requestHeaders), 63 63 queryString: this._buildParameters(this._resource.queryParameters || []), 64 64 cookies: this._buildCookies(this._resource.requestCookies || []), 65 headersSize: -1, // Not available.66 bodySize: -1 // Not available.65 headersSize: this._resource.requestHeadersSize, 66 bodySize: this.requestBodySize 67 67 }; 68 68 if (this._resource.requestFormData) 69 69 res.postData = this._buildPostData(); 70 70 71 return res; 71 72 }, … … 76 77 status: this._resource.statusCode, 77 78 statusText: this._resource.statusText, 78 // "httpVersion": "HTTP/1.1" -- Not available.79 httpVersion: this._resource.responseHttpVersion, 79 80 headers: this._buildHeaders(this._resource.responseHeaders), 80 81 cookies: this._buildCookies(this._resource.responseCookies || []), 81 82 content: this._buildContent(), 82 83 redirectURL: this._resource.responseHeaderValue("Location") || "", 83 headersSize: -1, // Not available.84 bodySize: this. _resource.resourceSize84 headersSize: this._resource.responseHeadersSize, 85 bodySize: this.responseBodySize 85 86 }; 86 87 }, … … 90 91 return { 91 92 size: this._resource.resourceSize, 92 // compression: 0, -- Not available.93 compression: this.responseCompression, 93 94 mimeType: this._resource.mimeType, 94 // text: -- Not available.95 // text: this._resource.content // TODO: pull out into a boolean flag, as content can be huge (and needs to be requested with an async call) 95 96 }; 96 97 }, … … 165 166 _buildCookie: function(cookie) 166 167 { 167 168 168 return { 169 169 name: cookie.name, … … 184 184 var startTime = timing[start]; 185 185 return typeof startTime !== "number" || startTime === -1 ? -1 : Math.round(timing[end] - startTime); 186 }, 187 188 get requestBodySize() 189 { 190 return !this._resource.requestFormData ? 0 : this._resource.requestFormData.length; 191 }, 192 193 get responseBodySize() 194 { 195 return this._resource.transferSize - this._resource.responseHeadersSize 196 }, 197 198 get responseCompression() 199 { 200 return this._resource.resourceSize - (this._resource.transferSize - this._resource.responseHeadersSize); 186 201 } 187 202 } … … 200 215 { 201 216 var webKitVersion = /AppleWebKit\/([^ ]+)/.exec(window.navigator.userAgent); 202 217 203 218 return { 204 219 version: "1.2", -
trunk/Source/WebCore/inspector/front-end/Resource.js
r89449 r90010 7 7 * 8 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer. 10 10 * 2. Redistributions in binary form must reproduce the above copyright 11 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution. 13 13 * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 14 14 * its contributors may be used to endorse or promote products derived 15 * from this software without specific prior written permission. 15 * from this software without specific prior written permission. 16 16 * 17 17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY … … 493 493 delete this._sortedRequestHeaders; 494 494 delete this._requestCookies; 495 delete this._responseHeadersSize;496 495 497 496 this.dispatchEventToListeners("requestHeaders changed"); … … 500 499 get requestHeadersText() 501 500 { 502 if (this._requestHeadersText !== undefined) 503 return this._requestHeadersText; 504 505 this._requestHeadersText = ""; 506 for (var key in this.requestHeaders) 507 this._requestHeadersText += key + ": " + this.requestHeaders[key] + "\n"; 501 if (this._requestHeadersText === undefined) { 502 this._requestHeadersText = this.requestMethod + " " + this.url + " HTTP/1.1\r\n"; 503 for (var key in this.requestHeaders) 504 this._requestHeadersText += key + ": " + this.requestHeaders[key] + "\r\n"; 505 } 508 506 return this._requestHeadersText; 509 507 }, … … 512 510 { 513 511 this._requestHeadersText = x; 514 delete this._responseHeadersSize;515 512 516 513 this.dispatchEventToListeners("requestHeaders changed"); … … 519 516 get requestHeadersSize() 520 517 { 521 if (typeof(this._requestHeadersSize) === "undefined") { 522 if (this._requestHeadersText) 523 this._requestHeadersSize = this._requestHeadersText.length; 524 else 525 this._requestHeadersSize = this._headersSize(this._requestHeaders) 526 } 527 return this._requestHeadersSize; 518 return this.requestHeadersText.length; 528 519 }, 529 520 … … 564 555 }, 565 556 557 get requestHttpVersion() 558 { 559 var firstLine = this.requestHeadersText.split(/\r\n/)[0]; 560 var match = firstLine.match(/(HTTP\/\d+\.\d+)$/); 561 return match ? match[1] : undefined; 562 }, 563 566 564 get responseHeaders() 567 565 { … … 572 570 { 573 571 this._responseHeaders = x; 574 delete this._responseHeadersSize;575 572 delete this._sortedResponseHeaders; 576 573 delete this._responseCookies; … … 578 575 this.dispatchEventToListeners("responseHeaders changed"); 579 576 }, 580 577 581 578 get responseHeadersText() 582 579 { 583 if (this._responseHeadersText !== undefined) 584 return this._responseHeadersText; 585 586 this._responseHeadersText = ""; 587 for (var key in this.responseHeaders) 588 this._responseHeadersText += key + ": " + this.responseHeaders[key] + "\n"; 580 if (this._responseHeadersText === undefined) { 581 this._responseHeadersText = "HTTP/1.1 " + this.statusCode + " " + this.statusText + "\r\n"; 582 for (var key in this.responseHeaders) 583 this._responseHeadersText += key + ": " + this.responseHeaders[key] + "\r\n"; 584 } 589 585 return this._responseHeadersText; 590 586 }, … … 593 589 { 594 590 this._responseHeadersText = x; 595 delete this._responseHeadersSize;596 591 597 592 this.dispatchEventToListeners("responseHeaders changed"); 598 593 }, 599 594 600 595 get responseHeadersSize() 601 596 { 602 if (typeof(this._responseHeadersSize) === "undefined") { 603 if (this._responseHeadersText) 604 this._responseHeadersSize = this._responseHeadersText.length; 605 else 606 this._responseHeadersSize = this._headersSize(this._responseHeaders) 607 } 608 return this._responseHeadersSize; 609 }, 610 597 return this.responseHeadersText.length; 598 }, 611 599 612 600 get sortedResponseHeaders() … … 658 646 this._parsedFormParameters = this._parseParameters(this.requestFormData); 659 647 return this._parsedFormParameters; 648 }, 649 650 get responseHttpVersion() 651 { 652 var match = this.responseHeadersText.match(/^(HTTP\/\d+\.\d+)/); 653 return match ? match[1] : undefined; 660 654 }, 661 655 … … 684 678 return headers[header]; 685 679 } 686 },687 688 _headersSize: function(headers)689 {690 // We should take actual headers size from network stack, when possible, but fall back to691 // this lousy computation when no headers text is available.692 var size = 0;693 for (var header in headers)694 size += header.length + headers[header].length + 4; // _typical_ overhead per header is ": ".length + "\r\n".length.695 return size;696 680 }, 697 681
Note: See TracChangeset
for help on using the changeset viewer.