From c609ec6a92bc0f8270c17fa9504cd788a8499b25 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Tue, 13 Apr 2021 19:53:50 +0300 Subject: [PATCH 1/3] Expose transferSize, encodedBodySize, decodedBodySize transferSize is based on the cache mode of the resource. --- index.html | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index ae552ff..eb3daa4 100644 --- a/index.html +++ b/index.html @@ -382,6 +382,10 @@

The PerformanceResourceTiming Interface

A PerformanceResourceTiming has an associated DOMString requested URL. +

A PerformanceResourceTiming has an associated DOMString +cache mode (the empty string or +"local"). +

A PerformanceResourceTiming has an associated [=fetch timing info=] timing info. @@ -485,6 +489,20 @@

The PerformanceResourceTiming Interface

timing info's [=fetch timing info/end time=] and the relevant global object for this. See [=/fetch=] for more info. +

The encodedBodySize getter +steps are to return this's +timing info's [=fetch timing info/encoded body size=]. +

The decodedBodySize getter +steps are to return this's +timing info's [=fetch timing info/decoded body size=]. +

The transferSize getter +steps are to perform the following steps: +

    +
  1. If this's cache mode is +"local", then return 0. +

  2. Return this's +timing info's [=fetch timing info/encoded body size=]. +

A user agent implementing PerformanceResourceTiming would need to include "resource" in Resource Timing Attributes

Creating a resource timing entry

To mark resource timing given a [=/fetch timing info=] |timingInfo|, a DOMString -|requestedURL|, a DOMString |initiatorType| and a global object |global|: +|requestedURL|, a DOMString |initiatorType| a global object |global|, and a string |cacheMode|, +perform the following steps:

  1. Create a PerformanceResourceTiming object |entry| in |global|'s [=global object/realm=]. -
  2. Setup the resource timing entry for |entry|, given |initiatorType|, |requestedURL| and -|timingInfo|. +
  3. Setup the resource timing entry for |entry|, given |initiatorType|, |requestedURL|, +|timingInfo|, and the empty string or "local" |cacheMode|.
  4. Queue |entry|.
  5. Add |entry| to |global|'s @@ -730,12 +749,13 @@

    Creating a resource timing entry

    entry buffer.

To setup the resource timing entry for PerformanceResourceTiming |entry| -given DOMStrring |initiatorType|, DOMString |requestedURL|, and [=/fetch timing info=] |timingInfo|, -perform the following steps:

+given DOMStrring |initiatorType|, DOMString |requestedURL|, [=/fetch timing info=] |timingInfo|, and +the empty string or "local" |cacheMode|, perform the following steps:

  1. Set |entry|'s initiator type to |initiatorType|.
  2. Set |entry|'s requested URL to |requestedURL|.
  3. Set |entry|'s timing info to |timingInfo|. +
  4. Set |entry|'s cache mode to |cacheMode|.

To convert fetch timestamp given {{DOMHighResTimeStamp}} |ts| and From e436224b02bd9fe7ca32c259f83aa77b65b45ba0 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Wed, 14 Apr 2021 14:40:29 +0300 Subject: [PATCH 2/3] PR fixes --- index.html | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index eb3daa4..02eea23 100644 --- a/index.html +++ b/index.html @@ -501,7 +501,8 @@

The PerformanceResourceTiming Interface

  • If this's cache mode is "local", then return 0.

  • Return this's -timing info's [=fetch timing info/encoded body size=]. +timing info's [=fetch timing info/encoded body size=] +plus 300.

    A user agent implementing PerformanceResourceTiming would @@ -741,17 +742,19 @@

    Creating a resource timing entry

    1. Create a PerformanceResourceTiming object |entry| in |global|'s [=global object/realm=].
    2. Setup the resource timing entry for |entry|, given |initiatorType|, |requestedURL|, -|timingInfo|, and the empty string or "local" |cacheMode|. +|timingInfo|, |cacheMode|.
    3. Queue |entry|.
    4. Add |entry| to |global|'s performance entry buffer.
    +<<<<<<< HEAD

    To setup the resource timing entry for PerformanceResourceTiming |entry| -given DOMStrring |initiatorType|, DOMString |requestedURL|, [=/fetch timing info=] |timingInfo|, and -the empty string or "local" |cacheMode|, perform the following steps:

    +given DOMString |initiatorType|, DOMString |requestedURL|, [=/fetch timing info=] |timingInfo|, and +a DOMString |cacheMode|, perform the following steps:

      +
    1. Assert that |cacheMode| is the empty string or "local".
    2. Set |entry|'s initiator type to |initiatorType|.
    3. Set |entry|'s requested URL to |requestedURL|.
    4. Set |entry|'s timing info to |timingInfo|. From 27c8bdaed0d94887aaae8800dd63aad4443d8206 Mon Sep 17 00:00:00 2001 From: Noam Rosenthal Date: Thu, 15 Apr 2021 09:01:32 +0300 Subject: [PATCH 3/3] PR nits --- index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index 02eea23..6141eb5 100644 --- a/index.html +++ b/index.html @@ -503,6 +503,9 @@

      The PerformanceResourceTiming Interface

    5. Return this's timing info's [=fetch timing info/encoded body size=] plus 300. +

      The constant number added to `transferSize` replaces exposing the total byte size +of the HTTP headers, as that may expose the presence of certain cookies. +See this issue.

    A user agent implementing PerformanceResourceTiming would @@ -742,7 +745,7 @@

    Creating a resource timing entry

    1. Create a PerformanceResourceTiming object |entry| in |global|'s [=global object/realm=].
    2. Setup the resource timing entry for |entry|, given |initiatorType|, |requestedURL|, -|timingInfo|, |cacheMode|. +|timingInfo|, and |cacheMode|.
    3. Queue |entry|.
    4. Add |entry| to |global|'s