Changeset 87070 in webkit
- Timestamp:
- May 23, 2011 6:29:25 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r87069 r87070 1 2011-05-23 Mike West <mkwst@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 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 - entry.request.httpVersion 11 - entry.request.headersSize 12 - entry.request.bodySize 13 - entry.response.httpVersion 14 - entry.response.headersSize 15 - entry.response.bodySize 16 - entry.response.content.compression 17 18 * http/tests/inspector/network/network-size.html: 19 * http/tests/inspector/resource-har-conversion-expected.txt: 20 * http/tests/inspector/resource-har-conversion.html: 21 * http/tests/inspector/resource-har-headers-expected.txt: Added. 22 * http/tests/inspector/resource-har-headers.html: Added. 23 * http/tests/inspector/resource-parameters-expected.txt: 24 * http/tests/inspector/resources-test.js: 25 1 26 2011-05-23 Csaba Osztrogonác <ossy@webkit.org> 2 27 -
trunk/LayoutTests/http/tests/inspector/network/network-size.html
r86672 r87070 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
r83583 r87070 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
r83275 r87070 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
r83583 r87070 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 : 33 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 : 0 50 53 mimeType : "application/xml" 51 54 } 52 55 redirectURL : "" 53 headersSize : -156 headersSize : <number> 54 57 bodySize : 14 55 58 } -
trunk/LayoutTests/http/tests/inspector/resources-test.js
r83275 r87070 2 2 3 3 InspectorTest.HARNondeterministicProperties = { 4 headers: 1, 5 headersSize: 1, 6 id: 1, 7 onContentLoad: 1, 8 onLoad: 1, 9 receive: 1, 4 10 startedDateTime: 1, 5 11 time: 1, 6 wait: 1,7 receive: 1,8 headers: 1,9 12 timings: 1, 10 13 version: 1, 11 startedDateTime: 1, 12 id: 1, 13 onContentLoad: 1, 14 onLoad: 1 14 wait: 1, 15 15 }; 16 16 … … 20 20 InspectorTest.HARNondeterministicPropertiesWithSize.size = 1; 21 21 InspectorTest.HARNondeterministicPropertiesWithSize.bodySize = 1; 22 InspectorTest.HARNondeterministicPropertiesWithSize.compression = 1; 23 22 24 23 25 InspectorTest.resourceURLComparer = function(r1, r2) -
trunk/Source/WebCore/ChangeLog
r87068 r87070 1 2011-05-23 Mike West <mkwst@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 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-05-23 Andrey Kosyakov <caseq@chromium.org> 2 46 -
trunk/Source/WebCore/inspector/front-end/HAREntry.js
r83275 r87070 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._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 }, … … 160 161 _buildCookie: function(cookie) 161 162 { 162 163 163 return { 164 164 name: cookie.name, … … 179 179 var startTime = timing[start]; 180 180 return typeof startTime !== "number" || startTime === -1 ? -1 : Math.round(timing[end] - startTime); 181 }, 182 183 get requestBodySize() 184 { 185 return !this._resource.requestFormData ? 0 : this._resource.requestFormData.length; 186 }, 187 188 get responseBodySize() 189 { 190 return this._resource.transferSize - this._resource.responseHeadersSize 191 }, 192 193 get responseCompression() 194 { 195 return this._resource.resourceSize - (this._resource.transferSize - this._resource.responseHeadersSize); 181 196 } 182 197 } … … 195 210 { 196 211 var webKitVersion = /AppleWebKit\/([^ ]+)/.exec(window.navigator.userAgent); 197 212 198 213 return { 199 214 version: "1.2", -
trunk/Source/WebCore/inspector/front-end/Resource.js
r85591 r87070 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 … … 492 492 delete this._sortedRequestHeaders; 493 493 delete this._requestCookies; 494 delete this._responseHeadersSize;495 494 496 495 this.dispatchEventToListeners("requestHeaders changed"); … … 499 498 get requestHeadersText() 500 499 { 501 if (this._requestHeadersText !== undefined) 502 return this._requestHeadersText; 503 504 this._requestHeadersText = ""; 505 for (var key in this.requestHeaders) 506 this._requestHeadersText += key + ": " + this.requestHeaders[key] + "\n"; 500 if (this._requestHeadersText === undefined) { 501 this._requestHeadersText = this.requestMethod + " " + this.url + " HTTP/1.1\r\n"; 502 for (var key in this.requestHeaders) 503 this._requestHeadersText += key + ": " + this.requestHeaders[key] + "\r\n"; 504 } 507 505 return this._requestHeadersText; 508 506 }, … … 511 509 { 512 510 this._requestHeadersText = x; 513 delete this._responseHeadersSize;514 511 515 512 this.dispatchEventToListeners("requestHeaders changed"); … … 518 515 get requestHeadersSize() 519 516 { 520 if (typeof(this._requestHeadersSize) === "undefined") { 521 if (this._requestHeadersText) 522 this._requestHeadersSize = this._requestHeadersText.length; 523 else 524 this._requestHeadersSize = this._headersSize(this._requestHeaders) 525 } 526 return this._requestHeadersSize; 517 return this.requestHeadersText.length; 527 518 }, 528 519 … … 563 554 }, 564 555 556 get requestHttpVersion() 557 { 558 var firstLine = this.requestHeadersText.split(/\r\n/)[0]; 559 var match = firstLine.match(/(HTTP\/\d+\.\d+)$/); 560 return match ? match[1] : undefined; 561 }, 562 565 563 get responseHeaders() 566 564 { … … 571 569 { 572 570 this._responseHeaders = x; 573 delete this._responseHeadersSize;574 571 delete this._sortedResponseHeaders; 575 572 delete this._responseCookies; … … 577 574 this.dispatchEventToListeners("responseHeaders changed"); 578 575 }, 579 576 580 577 get responseHeadersText() 581 578 { 582 if (this._responseHeadersText !== undefined) 583 return this._responseHeadersText; 584 585 this._responseHeadersText = ""; 586 for (var key in this.responseHeaders) 587 this._responseHeadersText += key + ": " + this.responseHeaders[key] + "\n"; 579 if (this._responseHeadersText === undefined) { 580 this._responseHeadersText = "HTTP/1.1 " + this.statusCode + " " + this.statusText + "\r\n"; 581 for (var key in this.responseHeaders) 582 this._responseHeadersText += key + ": " + this.responseHeaders[key] + "\r\n"; 583 } 588 584 return this._responseHeadersText; 589 585 }, … … 592 588 { 593 589 this._responseHeadersText = x; 594 delete this._responseHeadersSize;595 590 596 591 this.dispatchEventToListeners("responseHeaders changed"); 597 592 }, 598 593 599 594 get responseHeadersSize() 600 595 { 601 if (typeof(this._responseHeadersSize) === "undefined") { 602 if (this._responseHeadersText) 603 this._responseHeadersSize = this._responseHeadersText.length; 604 else 605 this._responseHeadersSize = this._headersSize(this._responseHeaders) 606 } 607 return this._responseHeadersSize; 608 }, 609 596 return this.responseHeadersText.length; 597 }, 610 598 611 599 get sortedResponseHeaders() … … 656 644 this._parsedFormParameters = this._parseParameters(this.requestFormData); 657 645 return this._parsedFormParameters; 646 }, 647 648 get responseHttpVersion() 649 { 650 var match = this.responseHeadersText.match(/^(HTTP\/\d+\.\d+)/); 651 return match ? match[1] : undefined; 658 652 }, 659 653 … … 682 676 return headers[header]; 683 677 } 684 },685 686 _headersSize: function(headers)687 {688 // We should take actual headers size from network stack, when possible, but fall back to689 // this lousy computation when no headers text is available.690 var size = 0;691 for (var header in headers)692 size += header.length + headers[header].length + 4; // _typical_ overhead per header is ": ".length + "\r\n".length.693 return size;694 678 }, 695 679
Note: See TracChangeset
for help on using the changeset viewer.