Changeset 278477 in webkit


Ignore:
Timestamp:
Jun 4, 2021 11:35:42 AM (3 years ago)
Author:
achristensen@apple.com
Message:

Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
https://bugs.webkit.org/show_bug.cgi?id=226629

Reviewed by Brady Eidson.

LayoutTests/imported/w3c:

  • web-platform-tests/navigation-timing/nav2_test_attributes_exist-expected.txt:
  • web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt:
  • web-platform-tests/navigation-timing/secure_connection_start_non_zero.https-expected.txt:
  • web-platform-tests/navigation-timing/test_document_onload-expected.txt:
  • web-platform-tests/resource-timing/TAO-case-insensitive-null-opaque-origin.sub-expected.txt:
  • web-platform-tests/resource-timing/TAO-crossorigin-port.sub-expected.txt:
  • web-platform-tests/resource-timing/TAO-null-opaque-origin.sub-expected.txt:

This apparent regression is actually just uncovering an existing failure.
The test expects the sum of many values to not be equal to zero.
It used to be adding undefined to many 0 values, which returned undefined, which is not equal to zero.
Now it's adding 0's and getting 0 which correctly indicates that we are not exposing timing values where we should.

  • web-platform-tests/resource-timing/cors-preflight.any-expected.txt:
  • web-platform-tests/resource-timing/cors-preflight.any.worker-expected.txt:
  • web-platform-tests/resource-timing/idlharness.any-expected.txt:
  • web-platform-tests/resource-timing/idlharness.any.worker-expected.txt:
  • web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt:
  • web-platform-tests/resource-timing/resource_connection_reuse-expected.txt:
  • web-platform-tests/resource-timing/resource_connection_reuse.https-expected.txt:
  • web-platform-tests/resource-timing/single-entry-per-resource-expected.txt:
  • web-platform-tests/resource-timing/test_resource_timing.https-expected.txt:
  • web-platform-tests/service-workers/service-worker/resource-timing-cross-origin.https-expected.txt:

Source/WebCore:

The tests for TAO are entangled with the tests for these properties. Having an implementation helps see what is still broken.
Covered by web platform tests.

  • page/PerformanceResourceTiming.cpp:

(WebCore::PerformanceResourceTiming::transferSize const):
(WebCore::PerformanceResourceTiming::encodedBodySize const):
(WebCore::PerformanceResourceTiming::decodedBodySize const):

  • page/PerformanceResourceTiming.h:
  • page/PerformanceResourceTiming.idl:

Source/WebKit:

  • NetworkProcess/cocoa/NetworkSessionCocoa.mm:

(-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):

Source/WTF:

  • Scripts/Preferences/WebPreferencesExperimental.yaml:

LayoutTests:

  • performance-api/resource-timing-apis-expected.txt:
  • platform/mac/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt: Removed.
Location:
trunk
Files:
1 deleted
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r278472 r278477  
     12021-06-04  Alex Christensen  <achristensen@webkit.org>
     2
     3        Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
     4        https://bugs.webkit.org/show_bug.cgi?id=226629
     5
     6        Reviewed by Brady Eidson.
     7
     8        * performance-api/resource-timing-apis-expected.txt:
     9        * platform/mac/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt: Removed.
     10
    1112021-06-04  Robert Jenner  <jenner@apple.com>
    212
  • trunk/LayoutTests/imported/w3c/ChangeLog

    r278410 r278477  
     12021-06-04  Alex Christensen  <achristensen@webkit.org>
     2
     3        Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
     4        https://bugs.webkit.org/show_bug.cgi?id=226629
     5
     6        Reviewed by Brady Eidson.
     7
     8        * web-platform-tests/navigation-timing/nav2_test_attributes_exist-expected.txt:
     9        * web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt:
     10        * web-platform-tests/navigation-timing/secure_connection_start_non_zero.https-expected.txt:
     11        * web-platform-tests/navigation-timing/test_document_onload-expected.txt:
     12        * web-platform-tests/resource-timing/TAO-case-insensitive-null-opaque-origin.sub-expected.txt:
     13        * web-platform-tests/resource-timing/TAO-crossorigin-port.sub-expected.txt:
     14        * web-platform-tests/resource-timing/TAO-null-opaque-origin.sub-expected.txt:
     15        This apparent regression is actually just uncovering an existing failure.
     16        The test expects the sum of many values to not be equal to zero.
     17        It used to be adding undefined to many 0 values, which returned undefined, which is not equal to zero.
     18        Now it's adding 0's and getting 0 which correctly indicates that we are not exposing timing values where we should.
     19        * web-platform-tests/resource-timing/cors-preflight.any-expected.txt:
     20        * web-platform-tests/resource-timing/cors-preflight.any.worker-expected.txt:
     21        * web-platform-tests/resource-timing/idlharness.any-expected.txt:
     22        * web-platform-tests/resource-timing/idlharness.any.worker-expected.txt:
     23        * web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt:
     24        * web-platform-tests/resource-timing/resource_connection_reuse-expected.txt:
     25        * web-platform-tests/resource-timing/resource_connection_reuse.https-expected.txt:
     26        * web-platform-tests/resource-timing/single-entry-per-resource-expected.txt:
     27        * web-platform-tests/resource-timing/test_resource_timing.https-expected.txt:
     28        * web-platform-tests/service-workers/service-worker/resource-timing-cross-origin.https-expected.txt:
     29
    1302021-06-03  Youenn Fablet  <youenn@apple.com>
    231
  • trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_exist-expected.txt

    r277767 r278477  
    44
    55
    6 FAIL Performance navigation timing entries are observable. assert_true: Expected attribute: decodedBodySize. expected true got false
     6PASS Performance navigation timing entries are observable.
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt

    r277767 r278477  
    44
    55
    6 FAIL Performance navigation timing instance's value is reasonable. assert_true: Expected transferSize to be greater than encodedBodySize in uncached navigation. expected true got false
     6FAIL Performance navigation timing instance's value is reasonable. assert_greater_than: Expected domInteractive to be greater than 0 expected a number greater than 0 but got 0
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/secure_connection_start_non_zero.https-expected.txt

    r277767 r278477  
    44
    55
    6 FAIL Test that secureConnectionStart is not zero assert_greater_than: secureConnectionStart is non-zero expected a number greater than 0 but got 0
     6PASS Test that secureConnectionStart is not zero
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/test_document_onload-expected.txt

    r277767 r278477  
    44
    55
    6 FAIL Test that the attributes have a proper value during DOMContentLoaded assert_greater_than: descr expected a number but got a "undefined"
    7 FAIL Test that the attributes have a proper value during onload assert_greater_than: descr expected a number but got a "undefined"
     6PASS Test that the attributes have a proper value during DOMContentLoaded
     7PASS Test that the attributes have a proper value during onload
     8PASS Test that the attributes have a proper value during a task after onload
    89
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-case-insensitive-null-opaque-origin.sub-expected.txt

    r264458 r278477  
    44
    55
    6 FAIL Test case-insensitive null TAO value with opaque origins assert_equals: expected "PASS" but got "FAIL"
     6PASS Test case-insensitive null TAO value with opaque origins
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-crossorigin-port.sub-expected.txt

    r264458 r278477  
    44
    55
    6 FAIL Makes sure that the iframe passed the test and had an entry which passed the timing allow check assert_equals: expected "PASS" but got "FAIL"
     6PASS Makes sure that the iframe passed the test and had an entry which passed the timing allow check
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-null-opaque-origin.sub-expected.txt

    r267647 r278477  
    44
    55
    6 PASS Test null TAO value with opaque origins
     6FAIL Test null TAO value with opaque origins assert_equals: expected "PASS" but got "FAIL"
    77
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/cors-preflight.any-expected.txt

    r264458 r278477  
    11
    2 FAIL PerformanceResourceTiming sizes fetch with preflight test assert_greater_than: No-preflight transferSize expected a number but got a "undefined"
     2FAIL PerformanceResourceTiming sizes fetch with preflight test assert_greater_than: No-preflight transferSize expected a number greater than 0 but got 0
    33
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/cors-preflight.any.worker-expected.txt

    r264458 r278477  
    11
    2 FAIL PerformanceResourceTiming sizes fetch with preflight test assert_greater_than: No-preflight transferSize expected a number but got a "undefined"
     2PASS PerformanceResourceTiming sizes fetch with preflight test
    33
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/idlharness.any-expected.txt

    r267647 r278477  
    2525PASS PerformanceResourceTiming interface: attribute responseStart
    2626PASS PerformanceResourceTiming interface: attribute responseEnd
    27 FAIL PerformanceResourceTiming interface: attribute transferSize assert_true: The prototype object must have a property "transferSize" expected true got false
    28 FAIL PerformanceResourceTiming interface: attribute encodedBodySize assert_true: The prototype object must have a property "encodedBodySize" expected true got false
    29 FAIL PerformanceResourceTiming interface: attribute decodedBodySize assert_true: The prototype object must have a property "decodedBodySize" expected true got false
     27PASS PerformanceResourceTiming interface: attribute transferSize
     28PASS PerformanceResourceTiming interface: attribute encodedBodySize
     29PASS PerformanceResourceTiming interface: attribute decodedBodySize
    3030PASS PerformanceResourceTiming interface: operation toJSON()
    3131PASS PerformanceResourceTiming must be primary interface of resource
     
    4545PASS PerformanceResourceTiming interface: resource must inherit property "responseStart" with the proper type
    4646PASS PerformanceResourceTiming interface: resource must inherit property "responseEnd" with the proper type
    47 FAIL PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type assert_inherits: property "transferSize" not found in prototype chain
    48 FAIL PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type assert_inherits: property "encodedBodySize" not found in prototype chain
    49 FAIL PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type assert_inherits: property "decodedBodySize" not found in prototype chain
     47PASS PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type
     48PASS PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type
     49PASS PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type
    5050PASS PerformanceResourceTiming interface: resource must inherit property "toJSON()" with the proper type
    51 FAIL PerformanceResourceTiming interface: default toJSON operation on resource assert_true: property "transferSize" should be present in the output of PerformanceResourceTiming.prototype.toJSON() expected true got false
     51PASS PerformanceResourceTiming interface: default toJSON operation on resource
    5252PASS Performance interface: operation clearResourceTimings()
    5353PASS Performance interface: operation setResourceTimingBufferSize(unsigned long)
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/idlharness.any.worker-expected.txt

    r267647 r278477  
    2525PASS PerformanceResourceTiming interface: attribute responseStart
    2626PASS PerformanceResourceTiming interface: attribute responseEnd
    27 FAIL PerformanceResourceTiming interface: attribute transferSize assert_true: The prototype object must have a property "transferSize" expected true got false
    28 FAIL PerformanceResourceTiming interface: attribute encodedBodySize assert_true: The prototype object must have a property "encodedBodySize" expected true got false
    29 FAIL PerformanceResourceTiming interface: attribute decodedBodySize assert_true: The prototype object must have a property "decodedBodySize" expected true got false
     27PASS PerformanceResourceTiming interface: attribute transferSize
     28PASS PerformanceResourceTiming interface: attribute encodedBodySize
     29PASS PerformanceResourceTiming interface: attribute decodedBodySize
    3030PASS PerformanceResourceTiming interface: operation toJSON()
    3131PASS PerformanceResourceTiming must be primary interface of resource
     
    4545PASS PerformanceResourceTiming interface: resource must inherit property "responseStart" with the proper type
    4646PASS PerformanceResourceTiming interface: resource must inherit property "responseEnd" with the proper type
    47 FAIL PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type assert_inherits: property "transferSize" not found in prototype chain
    48 FAIL PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type assert_inherits: property "encodedBodySize" not found in prototype chain
    49 FAIL PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type assert_inherits: property "decodedBodySize" not found in prototype chain
     47PASS PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type
     48PASS PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type
     49PASS PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type
    5050PASS PerformanceResourceTiming interface: resource must inherit property "toJSON()" with the proper type
    51 FAIL PerformanceResourceTiming interface: default toJSON operation on resource assert_true: property "transferSize" should be present in the output of PerformanceResourceTiming.prototype.toJSON() expected true got false
     51PASS PerformanceResourceTiming interface: default toJSON operation on resource
    5252PASS Performance interface: operation clearResourceTimings()
    5353PASS Performance interface: operation setResourceTimingBufferSize(unsigned long)
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt

    r267647 r278477  
    1 
    2 Harness Error (TIMEOUT), message = null
    31
    42PASS No timeline entry for about:blank
     
    75PASS 'xmlhttprequest (Populate cache): The initial request populates the cache (if appropriate).
    86PASS 'xmlhttprequest (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
    9 TIMEOUT 'script (Populate cache): The initial request populates the cache (if appropriate). Test timed out
    10 TIMEOUT 'script (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any). Test timed out
     7PASS 'script (Populate cache): The initial request populates the cache (if appropriate).
     8PASS 'script (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
     9PASS 'link (Populate cache): The initial request populates the cache (if appropriate).
     10PASS 'link (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
     11PASS 'iframe: 250ms delay before 'responseStart', another 250ms delay before 'responseEnd'.
     12PASS 'xmlhttprequest: 250ms delay before 'responseStart', another 250ms delay before 'responseEnd'.
     13PASS 'script: 250ms delay before 'responseStart', another 250ms delay before 'responseEnd'.
     14PASS 'link: 250ms delay before 'responseStart', another 250ms delay before 'responseEnd'.
     15PASS 'iframe (Redirected): 250ms delay before 'redirectEnd', another 250ms delay before 'responseStart'.
     16PASS 'xmlhttprequest (Redirected): 250ms delay before 'redirectEnd', another 250ms delay before 'responseStart'.
     17PASS 'script (Redirected): 250ms delay before 'redirectEnd', another 250ms delay before 'responseStart'.
     18PASS 'link (Redirected): 250ms delay before 'redirectEnd', another 250ms delay before 'responseStart'.
     19PASS 'iframe 250ms delay in headers does not affect responseStart'
     20PASS 'xmlhttprequest 250ms delay in headers does not affect responseStart'
     21PASS 'script 250ms delay in headers does not affect responseStart'
     22PASS 'link 250ms delay in headers does not affect responseStart'
     23PASS 'iframe responseStart uses 1XX (first) response timings'
     24PASS 'xmlhttprequest responseStart uses 1XX (first) response timings'
     25PASS 'script responseStart uses 1XX (first) response timings'
     26PASS 'link responseStart uses 1XX (first) response timings'
    1127Show details
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse-expected.txt

    r267647 r278477  
    99PASS connectStart and fetchStart should be the same
    1010PASS connectEnd and fetchStart should be the same
     11PASS secureConnectionStart should be zero
     12PASS domainLookupStart and fetchStart should be the same
     13PASS domainLookupEnd and fetchStart should be the same
    1114
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https-expected.txt

    r267647 r278477  
    99PASS connectStart and fetchStart should be the same
    1010PASS connectEnd and fetchStart should be the same
    11 FAIL secureConnectStart and fetchStart should be the same assert_equals: secureConnectStart and fetchStart should be the same expected 0 but got 51.00000000000001
     11PASS secureConnectionStart and fetchStart should be the same
    1212PASS domainLookupStart and fetchStart should be the same
    1313PASS domainLookupEnd and fetchStart should be the same
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/single-entry-per-resource-expected.txt

    r267647 r278477  
    55
    66
    7 PASS Only one resource entry per resource
     7PASS A single resource used in two elements produces a single entry.
    88
  • trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https-expected.txt

    r267647 r278477  
    77PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (iframe)
    88PASS PerformanceEntry has correct order of timing attributes (iframe)
    9 FAIL PerformanceEntry has correct network transfer attributes (iframe) assert_equals: encodedBodySize size expected (number) 215 but got (undefined) undefined
     9PASS PerformanceEntry has correct network transfer attributes (iframe)
    1010PASS PerformanceEntry has correct protocol attribute (iframe)
    1111PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (img)
    1212PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (img)
    1313PASS PerformanceEntry has correct order of timing attributes (img)
    14 FAIL PerformanceEntry has correct network transfer attributes (img) assert_equals: encodedBodySize size expected (number) 249 but got (undefined) undefined
     14PASS PerformanceEntry has correct network transfer attributes (img)
    1515PASS PerformanceEntry has correct protocol attribute (img)
    1616PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (link)
    1717PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (link)
    1818PASS PerformanceEntry has correct order of timing attributes (link)
    19 FAIL PerformanceEntry has correct network transfer attributes (link) assert_equals: encodedBodySize size expected (number) 44 but got (undefined) undefined
     19PASS PerformanceEntry has correct network transfer attributes (link)
    2020PASS PerformanceEntry has correct protocol attribute (link)
    2121PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (script)
    2222PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (script)
    2323PASS PerformanceEntry has correct order of timing attributes (script)
    24 FAIL PerformanceEntry has correct network transfer attributes (script) assert_equals: encodedBodySize size expected (number) 133 but got (undefined) undefined
     24PASS PerformanceEntry has correct network transfer attributes (script)
    2525PASS PerformanceEntry has correct protocol attribute (script)
    2626PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (xmlhttprequest)
    2727PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (xmlhttprequest)
    2828PASS PerformanceEntry has correct order of timing attributes (xmlhttprequest)
    29 FAIL PerformanceEntry has correct network transfer attributes (xmlhttprequest) assert_equals: encodedBodySize size expected (number) 112 but got (undefined) undefined
     29FAIL PerformanceEntry has correct network transfer attributes (xmlhttprequest) assert_equals: encodedBodySize size expected 112 but got 120
    3030PASS PerformanceEntry has correct protocol attribute (xmlhttprequest)
    3131PASS window.performance Resource Timing Entries exist
  • trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing-cross-origin.https-expected.txt

    r238592 r278477  
    11
     2PASS Test that timing allow check fails when service worker changes origin from same to cross origin.
    23
    3 FAIL Test that timing allow check fails when service worker changes origin from same to cross origin. assert_unreached: unexpected rejection: assert_equals: decodedBodySize should be 0 in cross-origin request. expected (number) 0 but got (undefined) undefined Reached unreachable code
    4 
  • trunk/LayoutTests/performance-api/resource-timing-apis-expected.txt

    r267644 r278477  
    2020PASS "responseStart" in PerformanceResourceTiming.prototype is true
    2121PASS "responseEnd" in PerformanceResourceTiming.prototype is true
    22 FAIL "transferSize" in PerformanceResourceTiming.prototype should be true. Was false.
    23 FAIL "encodedBodySize" in PerformanceResourceTiming.prototype should be true. Was false.
    24 FAIL "decodedBodySize" in PerformanceResourceTiming.prototype should be true. Was false.
     22PASS "transferSize" in PerformanceResourceTiming.prototype is true
     23PASS "encodedBodySize" in PerformanceResourceTiming.prototype is true
     24PASS "decodedBodySize" in PerformanceResourceTiming.prototype is true
    2525PASS PerformanceResourceTiming.prototype.toJSON is defined.
    2626PASS new PerformanceResourceTiming() threw exception TypeError: Illegal constructor.
     
    5151PASS [Worker] "responseStart" in PerformanceResourceTiming.prototype is true
    5252PASS [Worker] "responseEnd" in PerformanceResourceTiming.prototype is true
    53 FAIL [Worker] "transferSize" in PerformanceResourceTiming.prototype should be true. Was false.
    54 FAIL [Worker] "encodedBodySize" in PerformanceResourceTiming.prototype should be true. Was false.
    55 FAIL [Worker] "decodedBodySize" in PerformanceResourceTiming.prototype should be true. Was false.
     53PASS [Worker] "transferSize" in PerformanceResourceTiming.prototype is true
     54PASS [Worker] "encodedBodySize" in PerformanceResourceTiming.prototype is true
     55PASS [Worker] "decodedBodySize" in PerformanceResourceTiming.prototype is true
    5656PASS [Worker] PerformanceResourceTiming.prototype.toJSON is defined.
    5757PASS [Worker] new PerformanceResourceTiming() threw exception TypeError: Illegal constructor.
  • trunk/Source/WTF/ChangeLog

    r278474 r278477  
     12021-06-04  Alex Christensen  <achristensen@webkit.org>
     2
     3        Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
     4        https://bugs.webkit.org/show_bug.cgi?id=226629
     5
     6        Reviewed by Brady Eidson.
     7
     8        * Scripts/Preferences/WebPreferencesExperimental.yaml:
     9
    1102021-06-04  Devin Rousso  <drousso@apple.com>
    211
  • trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml

    r277767 r278477  
    795795      default: false
    796796
     797# Note: This is off by default because of privacy concerns
     798# such as https://github.com/w3c/resource-timing/issues/238
     799PerformanceResourceTimingSensitivePropertiesEnabled:
     800  type: bool
     801  humanReadableName: "PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize"
     802  humanReadableDescription: "Enable all properties of PerformanceResourceTiming API"
     803  defaultValue:
     804    WebKitLegacy:
     805      default: false
     806    WebKit:
     807      default: false
     808    WebCore:
     809      default: false
     810
    797811PrivateClickMeasurementDebugModeEnabled:
    798812  type: bool
  • trunk/Source/WebCore/ChangeLog

    r278466 r278477  
     12021-06-04  Alex Christensen  <achristensen@webkit.org>
     2
     3        Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
     4        https://bugs.webkit.org/show_bug.cgi?id=226629
     5
     6        Reviewed by Brady Eidson.
     7
     8        The tests for TAO are entangled with the tests for these properties.  Having an implementation helps see what is still broken.
     9        Covered by web platform tests.
     10
     11        * page/PerformanceResourceTiming.cpp:
     12        (WebCore::PerformanceResourceTiming::transferSize const):
     13        (WebCore::PerformanceResourceTiming::encodedBodySize const):
     14        (WebCore::PerformanceResourceTiming::decodedBodySize const):
     15        * page/PerformanceResourceTiming.h:
     16        * page/PerformanceResourceTiming.idl:
     17
    1182021-06-04  Myles C. Maxfield  <mmaxfield@apple.com>
    219
  • trunk/Source/WebCore/page/PerformanceResourceTiming.cpp

    r278391 r278477  
    257257}
    258258
     259uint64_t PerformanceResourceTiming::transferSize() const
     260{
     261    if (!m_resourceTiming.allowTimingDetails()
     262        || m_resourceTiming.networkLoadMetrics().hasCrossOriginRedirect)
     263        return 0;
     264
     265    auto encodedBodySize = m_resourceTiming.networkLoadMetrics().responseBodyBytesReceived;
     266    if (encodedBodySize == std::numeric_limits<uint64_t>::max())
     267        return 0;
     268
     269    // https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-transfersize
     270    return encodedBodySize + 300;
     271}
     272
     273uint64_t PerformanceResourceTiming::encodedBodySize() const
     274{
     275    if (!m_resourceTiming.allowTimingDetails()
     276        || m_resourceTiming.networkLoadMetrics().hasCrossOriginRedirect)
     277        return 0;
     278
     279    auto encodedBodySize = m_resourceTiming.networkLoadMetrics().responseBodyBytesReceived;
     280    if (encodedBodySize == std::numeric_limits<uint64_t>::max())
     281        return 0;
     282
     283    return encodedBodySize;
     284}
     285
     286uint64_t PerformanceResourceTiming::decodedBodySize() const
     287{
     288    if (!m_resourceTiming.allowTimingDetails()
     289        || m_resourceTiming.networkLoadMetrics().hasCrossOriginRedirect)
     290        return 0;
     291
     292    auto decodedBodySize = m_resourceTiming.networkLoadMetrics().responseBodyDecodedSize;
     293    if (decodedBodySize == std::numeric_limits<uint64_t>::max())
     294        return 0;
     295
     296    return decodedBodySize;
     297}
     298
    259299} // namespace WebCore
  • trunk/Source/WebCore/page/PerformanceResourceTiming.h

    r278391 r278477  
    6262    double responseStart() const;
    6363    double responseEnd() const;
     64    uint64_t transferSize() const;
     65    uint64_t encodedBodySize() const;
     66    uint64_t decodedBodySize() const;
    6467
    6568    const Vector<Ref<PerformanceServerTiming>>& serverTiming() const { return m_serverTiming; }
  • trunk/Source/WebCore/page/PerformanceResourceTiming.idl

    r277767 r278477  
    5151    readonly attribute DOMHighResTimeStamp responseStart;
    5252    readonly attribute DOMHighResTimeStamp responseEnd;
    53 
    54     // Note: transferSize, encodedBodySize, and decodedBodySize are intentionally omitted
    55     // because of privacy concerns such as https://github.com/w3c/resource-timing/issues/238
     53    [EnabledBySetting=PerformanceResourceTimingSensitiveProperties] readonly attribute unsigned long long transferSize;
     54    [EnabledBySetting=PerformanceResourceTimingSensitiveProperties] readonly attribute unsigned long long encodedBodySize;
     55    [EnabledBySetting=PerformanceResourceTimingSensitiveProperties] readonly attribute unsigned long long decodedBodySize;
    5656
    5757    // https://www.w3.org/TR/server-timing/#extension-to-the-performanceresourcetiming-interface
  • trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm

    r278391 r278477  
    325325    LOG(Network, "Handle %p delegate connectionDidFinishLoading:%p", m_handle, connection);
    326326
    327     double responseEndTime = [[[connection _timingData] objectForKey:@"_kCFNTimingDataResponseEnd"] doubleValue];
    328 
    329     auto work = [self = self, protectedSelf = retainPtr(self), connection = retainPtr(connection), responseEndTime] () mutable {
     327    auto work = [self = self, protectedSelf = retainPtr(self), connection = retainPtr(connection), timingData = retainPtr([connection _timingData])] () mutable {
    330328        if (!m_handle || !m_handle->client())
    331329            return;
    332330
    333331        if (auto metrics = m_handle->networkLoadMetrics()) {
    334             if (responseEndTime)
     332            if (double responseEndTime = [[timingData objectForKey:@"_kCFNTimingDataResponseEnd"] doubleValue])
    335333                metrics->responseEnd = WallTime::fromRawSeconds(adoptNS([[NSDate alloc] initWithTimeIntervalSinceReferenceDate:responseEndTime]).get().timeIntervalSince1970).approximateMonotonicTime();
    336334            else
    337335                metrics->responseEnd = metrics->responseStart;
     336            metrics->responseBodyBytesReceived = [[timingData objectForKey:@"_kCFNTimingDataResponseBodyBytesReceived"] unsignedLongLongValue];
     337            metrics->responseBodyDecodedSize = [[timingData objectForKey:@"_kCFNTimingDataResponseBodyBytesDecoded"] unsignedLongLongValue];
    338338            metrics->markComplete();
    339339            m_handle->client()->didFinishLoading(m_handle, *metrics);
  • trunk/Source/WebKit/ChangeLog

    r278475 r278477  
     12021-06-04  Alex Christensen  <achristensen@webkit.org>
     2
     3        Implement off-by-default experimental feature for PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize
     4        https://bugs.webkit.org/show_bug.cgi?id=226629
     5
     6        Reviewed by Brady Eidson.
     7
     8        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
     9        (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
     10
    1112021-06-04  Alex Christensen  <achristensen@webkit.org>
    212
  • trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm

    r278475 r278477  
    847847            uint64_t requestHeaderBytesSent = 0;
    848848            uint64_t responseHeaderBytesReceived = 0;
    849             uint64_t responseBodyBytesReceived = 0;
    850             uint64_t responseBodyDecodedSize = 0;
    851849
    852850            for (NSURLSessionTaskTransactionMetrics *transactionMetrics in metrics.transactionMetrics) {
     
    854852                requestHeaderBytesSent += transactionMetrics.countOfRequestHeaderBytesSent;
    855853                responseHeaderBytesReceived += transactionMetrics.countOfResponseHeaderBytesReceived;
    856                 responseBodyBytesReceived += transactionMetrics.countOfResponseBodyBytesReceived;
    857                 responseBodyDecodedSize += transactionMetrics.countOfResponseBodyBytesAfterDecoding ? transactionMetrics.countOfResponseBodyBytesAfterDecoding : transactionMetrics.countOfResponseBodyBytesReceived;
    858854#else
    859855                ALLOW_DEPRECATED_DECLARATIONS_BEGIN
    860856                requestHeaderBytesSent += transactionMetrics._requestHeaderBytesSent;
    861857                responseHeaderBytesReceived += transactionMetrics._responseHeaderBytesReceived;
    862                 responseBodyBytesReceived += transactionMetrics._responseBodyBytesReceived;
    863                 responseBodyDecodedSize += transactionMetrics._responseBodyBytesDecoded ? transactionMetrics._responseBodyBytesDecoded : transactionMetrics._responseBodyBytesReceived;
    864858                ALLOW_DEPRECATED_DECLARATIONS_END
    865859#endif
     
    869863            networkLoadMetrics.requestBodyBytesSent = task.countOfBytesSent;
    870864            networkLoadMetrics.responseHeaderBytesReceived = responseHeaderBytesReceived;
    871             networkLoadMetrics.responseBodyBytesReceived = responseBodyBytesReceived;
    872             networkLoadMetrics.responseBodyDecodedSize = responseBodyDecodedSize;
    873865        }
     866#if HAVE(CFNETWORK_METRICS_APIS_V4)
     867        networkLoadMetrics.responseBodyBytesReceived = m.countOfResponseBodyBytesReceived;
     868        networkLoadMetrics.responseBodyDecodedSize = m.countOfResponseBodyBytesAfterDecoding;
     869#else
     870        ALLOW_DEPRECATED_DECLARATIONS_BEGIN
     871        networkLoadMetrics.responseBodyBytesReceived = m._responseBodyBytesReceived;
     872        networkLoadMetrics.responseBodyDecodedSize = m._responseBodyBytesDecoded;
     873        ALLOW_DEPRECATED_DECLARATIONS_END
     874#endif
     875        // Sometimes the encoded body bytes received contains a few (3 or so) bytes from the header when there is no body.
     876        // When this happens, trim our metrics to make more sense.
     877        if (!networkLoadMetrics.responseBodyDecodedSize)
     878            networkLoadMetrics.responseBodyBytesReceived = 0;
    874879    }
    875880}
Note: See TracChangeset for help on using the changeset viewer.