Changeset 90010 in webkit


Ignore:
Timestamp:
Jun 29, 2011 5:43:45 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

2011-06-29 Mike West <mkwst@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Missing fields in HAR
https://bugs.webkit.org/show_bug.cgi?id=58127

Setting correct expectations for the following fields newly added to
the HAR implementation:

  • entry.request.httpVersion
  • entry.request.headersSize
  • entry.request.bodySize
  • entry.response.httpVersion
  • entry.response.headersSize
  • entry.response.bodySize
  • entry.response.content.compression
  • http/tests/inspector/network/network-size.html:
  • http/tests/inspector/resource-har-conversion-expected.txt:
  • http/tests/inspector/resource-har-conversion.html:
  • http/tests/inspector/resource-har-headers-expected.txt: Added.
  • http/tests/inspector/resource-har-headers.html: Added.
  • http/tests/inspector/resource-parameters-expected.txt:
  • http/tests/inspector/resources-test.js:

2011-06-29 Mike West <mkwst@chromium.org>

Reviewed by Pavel Feldman.

Web Inspector: Missing fields in HAR
https://bugs.webkit.org/show_bug.cgi?id=58127

Specifically, this patch adds:

  • entry.request.httpVersion
  • entry.request.headersSize
  • entry.request.bodySize
  • entry.response.httpVersion
  • entry.response.headersSize
  • entry.response.bodySize
  • entry.response.content.compression

Tests: http/tests/inspector/resource-har-conversion.html

http/tests/inspector/resource-har-headers.html
http/tests/inspector/resource-parameters.html
http/tests/inspector/network/network-size.html

Location:
trunk
Files:
2 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r90009 r90010  
     12011-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
    1272011-06-29  Philippe Normand  <pnormand@igalia.com>
    228
  • trunk/LayoutTests/http/tests/inspector/network/network-size.html

    r87073 r90010  
    3737        InspectorTest.addResult(resource1.url);
    3838        InspectorTest.addResult("resourceSize: " + resource1.resourceSize);
    39         InspectorTest.addResult("transferSize: " + (resource1.transferSize - resource1._responseHeadersSize));
     39        InspectorTest.addResult("transferSize: " + (resource1.transferSize - resource1.responseHeadersSize));
    4040
    4141        var resource2 = WebInspector.panels.network.resources[resourcesCount - 1];
    4242        InspectorTest.addResult(resource2.url);
    4343        InspectorTest.addResult("resourceSize: " + resource2.resourceSize);
    44         InspectorTest.addResult("transferSize: " + (resource2.transferSize - resource2._responseHeadersSize));
     44        InspectorTest.addResult("transferSize: " + (resource2.transferSize - resource2.responseHeadersSize));
    4545
    4646        InspectorTest.completeTest();
  • trunk/LayoutTests/http/tests/inspector/resource-har-conversion-expected.txt

    r87073 r90010  
    2727                method : "GET"
    2828                url : "http://127.0.0.1:8000/inspector/inspector-test.js"
     29                httpVersion : "HTTP/1.1"
    2930                headers : <object>
    3031                queryString : [
     
    5960                    }
    6061                ]
    61                 headersSize : -1
     62                headersSize : <number>
    6263                bodySize : <number>
    6364            }
     
    6566                status : 304
    6667                statusText : "Not Modified"
     68                httpVersion : "HTTP/1.1"
    6769                headers : <object>
    6870                cookies : [
     
    9799                content : {
    98100                    size : <number>
     101                    compression : <number>
    99102                    mimeType : "application/x-javascript"
    100103                }
    101104                redirectURL : ""
    102                 headersSize : -1
     105                headersSize : <number>
    103106                bodySize : <number>
    104107            }
     
    114117                method : "GET"
    115118                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>
    122126                bodySize : <number>
    123127            }
     
    125129                status : 200
    126130                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>
    132138                    mimeType : "text/html"
    133139                }
    134140                redirectURL : ""
    135                 headersSize : -1
     141                headersSize : <number>
    136142                bodySize : <number>
    137143            }
     
    147153                method : "GET"
    148154                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>
    155162                bodySize : <number>
    156163            }
     
    158165                status : 304
    159166                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>
    165174                    mimeType : "application/x-javascript"
    166175                }
    167176                redirectURL : ""
    168                 headersSize : -1
     177                headersSize : <number>
    169178                bodySize : <number>
    170179            }
     
    180189                method : "POST"
    181190                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>
    188198                bodySize : <number>
    189199                postData : {
     
    195205                status : 200
    196206                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>
    202214                    mimeType : "application/xml"
    203215                }
    204216                redirectURL : ""
    205                 headersSize : -1
     217                headersSize : <number>
    206218                bodySize : <number>
    207219            }
  • trunk/LayoutTests/http/tests/inspector/resource-har-conversion.html

    r87073 r90010  
     1<!doctype html>
    12<html>
    23<head>
     
    3839                "Cookie": "a=b; $Path=/path; $Domain=example.com; a1=b1\nc1=d1"
    3940            };
     41
    4042            resource.responseHeaders = {
    4143                "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  
    1010        method : "POST"
    1111        url : "http://localhost:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2="
     12        httpVersion : "HTTP/1.1"
    1213        headers : <object>
    1314        queryString : [
     
    2324        cookies : [
    2425        ]
    25         headersSize : -1
    26         bodySize : -1
     26        headersSize : <number>
     27        bodySize : <number>
    2728        postData : {
    2829            mimeType : "application/x-www-form-urlencoded"
     
    4344        status : 200
    4445        statusText : "OK"
     46        httpVersion : "HTTP/1.1"
    4547        headers : <object>
    4648        cookies : [
     
    4850        content : {
    4951            size : 14
     52            compression : <number>
    5053            mimeType : "application/xml"
    5154        }
    5255        redirectURL : ""
    53         headersSize : -1
    54         bodySize : 14
     56        headersSize : <number>
     57        bodySize : <number>
    5558    }
    5659    cache : {
  • trunk/LayoutTests/http/tests/inspector/resources-test.js

    r87073 r90010  
    22
    33InspectorTest.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,
    412    startedDateTime: 1,
    513    time: 1,
    6     wait: 1,
    7     receive: 1,
    8     headers: 1,
    914    timings: 1,
    1015    version: 1,
    11     startedDateTime: 1,
    12     id: 1,
    13     onContentLoad: 1,
    14     onLoad: 1
     16    wait: 1,
    1517};
    1618
     
    1921InspectorTest.HARNondeterministicPropertiesWithSize = JSON.parse(JSON.stringify(InspectorTest.HARNondeterministicProperties));
    2022InspectorTest.HARNondeterministicPropertiesWithSize.size = 1;
    21 InspectorTest.HARNondeterministicPropertiesWithSize.bodySize = 1;
     23
    2224
    2325InspectorTest.resourceURLComparer = function(r1, r2)
  • trunk/Source/WebCore/ChangeLog

    r90004 r90010  
     12011-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
    1452011-06-29  Hayato Ito  <hayato@chromium.org>
    246
  • trunk/Source/WebCore/inspector/front-end/HAREntry.js

    r89049 r90010  
    4949            request: this._buildRequest(),
    5050            response: this._buildResponse(),
    51             cache: { }, // Not supproted yet.
     51            cache: { }, // Not supported yet.
    5252            timings: this._buildTimings()
    5353        };
     
    5959            method: this._resource.requestMethod,
    6060            url: this._buildRequestURL(this._resource.url),
    61             // httpVersion: "HTTP/1.1" -- Not available.
     61            httpVersion: this._resource.requestHttpVersion,
    6262            headers: this._buildHeaders(this._resource.requestHeaders),
    6363            queryString: this._buildParameters(this._resource.queryParameters || []),
    6464            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
    6767        };
    6868        if (this._resource.requestFormData)
    6969            res.postData = this._buildPostData();
     70
    7071        return res;
    7172    },
     
    7677            status: this._resource.statusCode,
    7778            statusText: this._resource.statusText,
    78             // "httpVersion": "HTTP/1.1" -- Not available.
     79            httpVersion: this._resource.responseHttpVersion,
    7980            headers: this._buildHeaders(this._resource.responseHeaders),
    8081            cookies: this._buildCookies(this._resource.responseCookies || []),
    8182            content: this._buildContent(),
    8283            redirectURL: this._resource.responseHeaderValue("Location") || "",
    83             headersSize: -1, // Not available.
    84             bodySize: this._resource.resourceSize
     84            headersSize: this._resource.responseHeadersSize,
     85            bodySize: this.responseBodySize
    8586        };
    8687    },
     
    9091        return {
    9192            size: this._resource.resourceSize,
    92             // compression: 0, -- Not available.
     93            compression: this.responseCompression,
    9394            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)
    9596        };
    9697    },
     
    165166    _buildCookie: function(cookie)
    166167    {
    167        
    168168        return {
    169169            name: cookie.name,
     
    184184        var startTime = timing[start];
    185185        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);
    186201    }
    187202}
     
    200215    {
    201216        var webKitVersion = /AppleWebKit\/([^ ]+)/.exec(window.navigator.userAgent);
    202        
     217
    203218        return {
    204219            version: "1.2",
  • trunk/Source/WebCore/inspector/front-end/Resource.js

    r89449 r90010  
    77 *
    88 * 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.
    1010 * 2.  Redistributions in binary form must reproduce the above copyright
    1111 *     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.
    1313 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
    1414 *     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.
    1616 *
    1717 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
     
    493493        delete this._sortedRequestHeaders;
    494494        delete this._requestCookies;
    495         delete this._responseHeadersSize;
    496495
    497496        this.dispatchEventToListeners("requestHeaders changed");
     
    500499    get requestHeadersText()
    501500    {
    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        }
    508506        return this._requestHeadersText;
    509507    },
     
    512510    {
    513511        this._requestHeadersText = x;
    514         delete this._responseHeadersSize;
    515512
    516513        this.dispatchEventToListeners("requestHeaders changed");
     
    519516    get requestHeadersSize()
    520517    {
    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;
    528519    },
    529520
     
    564555    },
    565556
     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
    566564    get responseHeaders()
    567565    {
     
    572570    {
    573571        this._responseHeaders = x;
    574         delete this._responseHeadersSize;
    575572        delete this._sortedResponseHeaders;
    576573        delete this._responseCookies;
     
    578575        this.dispatchEventToListeners("responseHeaders changed");
    579576    },
    580    
     577
    581578    get responseHeadersText()
    582579    {
    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        }
    589585        return this._responseHeadersText;
    590586    },
     
    593589    {
    594590        this._responseHeadersText = x;
    595         delete this._responseHeadersSize;
    596591
    597592        this.dispatchEventToListeners("responseHeaders changed");
    598593    },
    599    
     594
    600595    get responseHeadersSize()
    601596    {
    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    },
    611599
    612600    get sortedResponseHeaders()
     
    658646        this._parsedFormParameters = this._parseParameters(this.requestFormData);
    659647        return this._parsedFormParameters;
     648    },
     649
     650    get responseHttpVersion()
     651    {
     652        var match = this.responseHeadersText.match(/^(HTTP\/\d+\.\d+)/);
     653        return match ? match[1] : undefined;
    660654    },
    661655
     
    684678                return headers[header];
    685679        }
    686     },
    687 
    688     _headersSize: function(headers)
    689     {
    690         // We should take actual headers size from network stack, when possible, but fall back to
    691         // 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;
    696680    },
    697681
Note: See TracChangeset for help on using the changeset viewer.