Title: [278477] trunk
Revision
278477
Author
[email protected]
Date
2021-06-04 11:35:42 -0700 (Fri, 04 Jun 2021)

Log 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.

Modified Paths

Removed Paths

  • trunk/LayoutTests/platform/mac/imported/w3c/web-platform-tests/resource-timing/

Diff

Modified: trunk/LayoutTests/ChangeLog (278476 => 278477)


--- trunk/LayoutTests/ChangeLog	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/ChangeLog	2021-06-04 18:35:42 UTC (rev 278477)
@@ -1,3 +1,13 @@
+2021-06-04  Alex Christensen  <[email protected]>
+
+        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.
+
+        * performance-api/resource-timing-apis-expected.txt:
+        * platform/mac/imported/w3c/web-platform-tests/resource-timing/test_resource_timing-expected.txt: Removed.
+
 2021-06-04  Robert Jenner  <[email protected]>
 
         Cleanup unused resources in LayoutTests/storage

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-06-04 18:35:42 UTC (rev 278477)
@@ -1,3 +1,32 @@
+2021-06-04  Alex Christensen  <[email protected]>
+
+        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.
+
+        * 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:
+
 2021-06-03  Youenn Fablet  <[email protected]>
 
         Cherry-pick webrtc fix to correctly handle audio track state in case of renegotiation

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_exist-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_exist-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_exist-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -3,5 +3,5 @@
 This test validates that PerformanceObserver can observe nav timing 2 instance and that the expected attributes in nav timing 2 instance exist (but does not validate that the values are correct).
 
 
-FAIL Performance navigation timing entries are observable. assert_true: Expected attribute: decodedBodySize. expected true got false
+PASS Performance navigation timing entries are observable.
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/nav2_test_attributes_values-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -3,5 +3,5 @@
 This test validates that the values of nav timing 2 instance's timing-related attributes are in certain order and the others are of expected values.
 
 
-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
+FAIL 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
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/secure_connection_start_non_zero.https-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/secure_connection_start_non_zero.https-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/secure_connection_start_non_zero.https-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -3,5 +3,5 @@
 The tests that secureConnectionStart has a non-zero value.
 
 
-FAIL Test that secureConnectionStart is not zero assert_greater_than: secureConnectionStart is non-zero expected a number greater than 0 but got 0
+PASS Test that secureConnectionStart is not zero
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/test_document_onload-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/test_document_onload-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/navigation-timing/test_document_onload-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -3,6 +3,7 @@
 This test checks that the transferSize, encodedBodySize and decodedBodySize attributes have correct values when checked in the onload handler
 
 
-FAIL Test that the attributes have a proper value during DOMContentLoaded assert_greater_than: descr expected a number but got a "undefined"
-FAIL Test that the attributes have a proper value during onload assert_greater_than: descr expected a number but got a "undefined"
+PASS Test that the attributes have a proper value during DOMContentLoaded
+PASS Test that the attributes have a proper value during onload
+PASS Test that the attributes have a proper value during a task after onload
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-case-insensitive-null-opaque-origin.sub-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-case-insensitive-null-opaque-origin.sub-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-case-insensitive-null-opaque-origin.sub-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -3,5 +3,5 @@
 This test validates that for a cross origin resource, the timing allow check algorithm will fail when the value of Timing-Allow-Origin is a case-insensitive match to null and the origin is an opaque origin.
 
 
-FAIL Test case-insensitive null TAO value with opaque origins assert_equals: expected "PASS" but got "FAIL"
+PASS Test case-insensitive null TAO value with opaque origins
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-crossorigin-port.sub-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-crossorigin-port.sub-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-crossorigin-port.sub-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -3,5 +3,5 @@
 This test validates that for a cross origin resource with different ports, the timing allow check algorithm will fail when the value of Timing-Allow-Origin value has the right host but the wrong port in it.
 
 
-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"
+PASS Makes sure that the iframe passed the test and had an entry which passed the timing allow check
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-null-opaque-origin.sub-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-null-opaque-origin.sub-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-null-opaque-origin.sub-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -3,5 +3,5 @@
 This test validates that for a cross origin resource, the timing allow check algorithm will succeed when the value of Timing-Allow-Origin is null and the origin is an opaque origin.
 
 
-PASS Test null TAO value with opaque origins
+FAIL Test null TAO value with opaque origins assert_equals: expected "PASS" but got "FAIL"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/cors-preflight.any-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/cors-preflight.any-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/cors-preflight.any-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -1,3 +1,3 @@
 
-FAIL PerformanceResourceTiming sizes fetch with preflight test assert_greater_than: No-preflight transferSize expected a number but got a "undefined"
+FAIL PerformanceResourceTiming sizes fetch with preflight test assert_greater_than: No-preflight transferSize expected a number greater than 0 but got 0
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/cors-preflight.any.worker-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/cors-preflight.any.worker-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/cors-preflight.any.worker-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -1,3 +1,3 @@
 
-FAIL PerformanceResourceTiming sizes fetch with preflight test assert_greater_than: No-preflight transferSize expected a number but got a "undefined"
+PASS PerformanceResourceTiming sizes fetch with preflight test
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/idlharness.any-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/idlharness.any-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/idlharness.any-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -24,9 +24,9 @@
 PASS PerformanceResourceTiming interface: attribute requestStart
 PASS PerformanceResourceTiming interface: attribute responseStart
 PASS PerformanceResourceTiming interface: attribute responseEnd
-FAIL PerformanceResourceTiming interface: attribute transferSize assert_true: The prototype object must have a property "transferSize" expected true got false
-FAIL PerformanceResourceTiming interface: attribute encodedBodySize assert_true: The prototype object must have a property "encodedBodySize" expected true got false
-FAIL PerformanceResourceTiming interface: attribute decodedBodySize assert_true: The prototype object must have a property "decodedBodySize" expected true got false
+PASS PerformanceResourceTiming interface: attribute transferSize
+PASS PerformanceResourceTiming interface: attribute encodedBodySize
+PASS PerformanceResourceTiming interface: attribute decodedBodySize
 PASS PerformanceResourceTiming interface: operation toJSON()
 PASS PerformanceResourceTiming must be primary interface of resource
 PASS Stringification of resource
@@ -44,11 +44,11 @@
 PASS PerformanceResourceTiming interface: resource must inherit property "requestStart" with the proper type
 PASS PerformanceResourceTiming interface: resource must inherit property "responseStart" with the proper type
 PASS PerformanceResourceTiming interface: resource must inherit property "responseEnd" with the proper type
-FAIL PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type assert_inherits: property "transferSize" not found in prototype chain
-FAIL PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type assert_inherits: property "encodedBodySize" not found in prototype chain
-FAIL PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type assert_inherits: property "decodedBodySize" not found in prototype chain
+PASS PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type
+PASS PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type
+PASS PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type
 PASS PerformanceResourceTiming interface: resource must inherit property "toJSON()" with the proper type
-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
+PASS PerformanceResourceTiming interface: default toJSON operation on resource
 PASS Performance interface: operation clearResourceTimings()
 PASS Performance interface: operation setResourceTimingBufferSize(unsigned long)
 PASS Performance interface: attribute onresourcetimingbufferfull

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/idlharness.any.worker-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/idlharness.any.worker-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/idlharness.any.worker-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -24,9 +24,9 @@
 PASS PerformanceResourceTiming interface: attribute requestStart
 PASS PerformanceResourceTiming interface: attribute responseStart
 PASS PerformanceResourceTiming interface: attribute responseEnd
-FAIL PerformanceResourceTiming interface: attribute transferSize assert_true: The prototype object must have a property "transferSize" expected true got false
-FAIL PerformanceResourceTiming interface: attribute encodedBodySize assert_true: The prototype object must have a property "encodedBodySize" expected true got false
-FAIL PerformanceResourceTiming interface: attribute decodedBodySize assert_true: The prototype object must have a property "decodedBodySize" expected true got false
+PASS PerformanceResourceTiming interface: attribute transferSize
+PASS PerformanceResourceTiming interface: attribute encodedBodySize
+PASS PerformanceResourceTiming interface: attribute decodedBodySize
 PASS PerformanceResourceTiming interface: operation toJSON()
 PASS PerformanceResourceTiming must be primary interface of resource
 PASS Stringification of resource
@@ -44,11 +44,11 @@
 PASS PerformanceResourceTiming interface: resource must inherit property "requestStart" with the proper type
 PASS PerformanceResourceTiming interface: resource must inherit property "responseStart" with the proper type
 PASS PerformanceResourceTiming interface: resource must inherit property "responseEnd" with the proper type
-FAIL PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type assert_inherits: property "transferSize" not found in prototype chain
-FAIL PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type assert_inherits: property "encodedBodySize" not found in prototype chain
-FAIL PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type assert_inherits: property "decodedBodySize" not found in prototype chain
+PASS PerformanceResourceTiming interface: resource must inherit property "transferSize" with the proper type
+PASS PerformanceResourceTiming interface: resource must inherit property "encodedBodySize" with the proper type
+PASS PerformanceResourceTiming interface: resource must inherit property "decodedBodySize" with the proper type
 PASS PerformanceResourceTiming interface: resource must inherit property "toJSON()" with the proper type
-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
+PASS PerformanceResourceTiming interface: default toJSON operation on resource
 PASS Performance interface: operation clearResourceTimings()
 PASS Performance interface: operation setResourceTimingBufferSize(unsigned long)
 PASS Performance interface: attribute onresourcetimingbufferfull

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource-timing-level1.sub-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -1,11 +1,27 @@
 
-Harness Error (TIMEOUT), message = null
-
 PASS No timeline entry for about:blank
 PASS 'iframe (Populate cache): The initial request populates the cache (if appropriate).
 PASS 'iframe (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
 PASS 'xmlhttprequest (Populate cache): The initial request populates the cache (if appropriate).
 PASS 'xmlhttprequest (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
-TIMEOUT 'script (Populate cache): The initial request populates the cache (if appropriate). Test timed out
-TIMEOUT 'script (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any). Test timed out
+PASS 'script (Populate cache): The initial request populates the cache (if appropriate).
+PASS 'script (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
+PASS 'link (Populate cache): The initial request populates the cache (if appropriate).
+PASS 'link (Potentially Cached): Immediately fetch the same URL, exercising the cache hit path (if any).
+PASS 'iframe: 250ms delay before 'responseStart', another 250ms delay before 'responseEnd'.
+PASS 'xmlhttprequest: 250ms delay before 'responseStart', another 250ms delay before 'responseEnd'.
+PASS 'script: 250ms delay before 'responseStart', another 250ms delay before 'responseEnd'.
+PASS 'link: 250ms delay before 'responseStart', another 250ms delay before 'responseEnd'.
+PASS 'iframe (Redirected): 250ms delay before 'redirectEnd', another 250ms delay before 'responseStart'.
+PASS 'xmlhttprequest (Redirected): 250ms delay before 'redirectEnd', another 250ms delay before 'responseStart'.
+PASS 'script (Redirected): 250ms delay before 'redirectEnd', another 250ms delay before 'responseStart'.
+PASS 'link (Redirected): 250ms delay before 'redirectEnd', another 250ms delay before 'responseStart'.
+PASS 'iframe 250ms delay in headers does not affect responseStart'
+PASS 'xmlhttprequest 250ms delay in headers does not affect responseStart'
+PASS 'script 250ms delay in headers does not affect responseStart'
+PASS 'link 250ms delay in headers does not affect responseStart'
+PASS 'iframe responseStart uses 1XX (first) response timings'
+PASS 'xmlhttprequest responseStart uses 1XX (first) response timings'
+PASS 'script responseStart uses 1XX (first) response timings'
+PASS 'link responseStart uses 1XX (first) response timings'
 Show details

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -8,4 +8,7 @@
 PASS There should be 2 PerformanceEntries
 PASS connectStart and fetchStart should be the same
 PASS connectEnd and fetchStart should be the same
+PASS secureConnectionStart should be zero
+PASS domainLookupStart and fetchStart should be the same
+PASS domainLookupEnd and fetchStart should be the same
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/resource_connection_reuse.https-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -8,7 +8,7 @@
 PASS There should be 2 PerformanceEntries
 PASS connectStart and fetchStart should be the same
 PASS connectEnd and fetchStart should be the same
-FAIL secureConnectStart and fetchStart should be the same assert_equals: secureConnectStart and fetchStart should be the same expected 0 but got 51.00000000000001
+PASS secureConnectionStart and fetchStart should be the same
 PASS domainLookupStart and fetchStart should be the same
 PASS domainLookupEnd and fetchStart should be the same
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/single-entry-per-resource-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/single-entry-per-resource-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/single-entry-per-resource-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -4,5 +4,5 @@
 If the user agent is to reuse the data from another existing or completed fetch initiated from the current document, abort the remaining steps.
 
 
-PASS Only one resource entry per resource
+PASS A single resource used in two elements produces a single entry.
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -6,27 +6,27 @@
 PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (iframe)
 PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (iframe)
 PASS PerformanceEntry has correct order of timing attributes (iframe)
-FAIL PerformanceEntry has correct network transfer attributes (iframe) assert_equals: encodedBodySize size expected (number) 215 but got (undefined) undefined
+PASS PerformanceEntry has correct network transfer attributes (iframe)
 PASS PerformanceEntry has correct protocol attribute (iframe)
 PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (img)
 PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (img)
 PASS PerformanceEntry has correct order of timing attributes (img)
-FAIL PerformanceEntry has correct network transfer attributes (img) assert_equals: encodedBodySize size expected (number) 249 but got (undefined) undefined
+PASS PerformanceEntry has correct network transfer attributes (img)
 PASS PerformanceEntry has correct protocol attribute (img)
 PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (link)
 PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (link)
 PASS PerformanceEntry has correct order of timing attributes (link)
-FAIL PerformanceEntry has correct network transfer attributes (link) assert_equals: encodedBodySize size expected (number) 44 but got (undefined) undefined
+PASS PerformanceEntry has correct network transfer attributes (link)
 PASS PerformanceEntry has correct protocol attribute (link)
 PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (script)
 PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (script)
 PASS PerformanceEntry has correct order of timing attributes (script)
-FAIL PerformanceEntry has correct network transfer attributes (script) assert_equals: encodedBodySize size expected (number) 133 but got (undefined) undefined
+PASS PerformanceEntry has correct network transfer attributes (script)
 PASS PerformanceEntry has correct protocol attribute (script)
 PASS window.performance.getEntriesByName() and window.performance.getEntriesByNameType() return same data (xmlhttprequest)
 PASS PerformanceEntry has correct name, initiatorType, startTime, and duration (xmlhttprequest)
 PASS PerformanceEntry has correct order of timing attributes (xmlhttprequest)
-FAIL PerformanceEntry has correct network transfer attributes (xmlhttprequest) assert_equals: encodedBodySize size expected (number) 112 but got (undefined) undefined
+FAIL PerformanceEntry has correct network transfer attributes (xmlhttprequest) assert_equals: encodedBodySize size expected 112 but got 120
 PASS PerformanceEntry has correct protocol attribute (xmlhttprequest)
 PASS window.performance Resource Timing Entries exist
 PASS window.performance Resource Timing Entries exist 1

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing-cross-origin.https-expected.txt (278476 => 278477)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing-cross-origin.https-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/resource-timing-cross-origin.https-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -1,4 +1,3 @@
 
+PASS Test that timing allow check fails when service worker changes origin from same to cross origin.
 
-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
-

Modified: trunk/LayoutTests/performance-api/resource-timing-apis-expected.txt (278476 => 278477)


--- trunk/LayoutTests/performance-api/resource-timing-apis-expected.txt	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/LayoutTests/performance-api/resource-timing-apis-expected.txt	2021-06-04 18:35:42 UTC (rev 278477)
@@ -19,9 +19,9 @@
 PASS "requestStart" in PerformanceResourceTiming.prototype is true
 PASS "responseStart" in PerformanceResourceTiming.prototype is true
 PASS "responseEnd" in PerformanceResourceTiming.prototype is true
-FAIL "transferSize" in PerformanceResourceTiming.prototype should be true. Was false.
-FAIL "encodedBodySize" in PerformanceResourceTiming.prototype should be true. Was false.
-FAIL "decodedBodySize" in PerformanceResourceTiming.prototype should be true. Was false.
+PASS "transferSize" in PerformanceResourceTiming.prototype is true
+PASS "encodedBodySize" in PerformanceResourceTiming.prototype is true
+PASS "decodedBodySize" in PerformanceResourceTiming.prototype is true
 PASS PerformanceResourceTiming.prototype.toJSON is defined.
 PASS new PerformanceResourceTiming() threw exception TypeError: Illegal constructor.
 
@@ -50,9 +50,9 @@
 PASS [Worker] "requestStart" in PerformanceResourceTiming.prototype is true
 PASS [Worker] "responseStart" in PerformanceResourceTiming.prototype is true
 PASS [Worker] "responseEnd" in PerformanceResourceTiming.prototype is true
-FAIL [Worker] "transferSize" in PerformanceResourceTiming.prototype should be true. Was false.
-FAIL [Worker] "encodedBodySize" in PerformanceResourceTiming.prototype should be true. Was false.
-FAIL [Worker] "decodedBodySize" in PerformanceResourceTiming.prototype should be true. Was false.
+PASS [Worker] "transferSize" in PerformanceResourceTiming.prototype is true
+PASS [Worker] "encodedBodySize" in PerformanceResourceTiming.prototype is true
+PASS [Worker] "decodedBodySize" in PerformanceResourceTiming.prototype is true
 PASS [Worker] PerformanceResourceTiming.prototype.toJSON is defined.
 PASS [Worker] new PerformanceResourceTiming() threw exception TypeError: Illegal constructor.
 [Worker]

Modified: trunk/Source/WTF/ChangeLog (278476 => 278477)


--- trunk/Source/WTF/ChangeLog	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/Source/WTF/ChangeLog	2021-06-04 18:35:42 UTC (rev 278477)
@@ -1,3 +1,12 @@
+2021-06-04  Alex Christensen  <[email protected]>
+
+        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.
+
+        * Scripts/Preferences/WebPreferencesExperimental.yaml:
+
 2021-06-04  Devin Rousso  <[email protected]>
 
         Add a way to prefix output of `WTFReportBacktrace` to make log filtering easier

Modified: trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml (278476 => 278477)


--- trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml	2021-06-04 18:35:42 UTC (rev 278477)
@@ -794,6 +794,20 @@
     WebCore:
       default: false
 
+# Note: This is off by default because of privacy concerns
+# such as https://github.com/w3c/resource-timing/issues/238
+PerformanceResourceTimingSensitivePropertiesEnabled:
+  type: bool
+  humanReadableName: "PerformanceResourceTiming.transferSize, encodedBodySize, and decodedBodySize"
+  humanReadableDescription: "Enable all properties of PerformanceResourceTiming API"
+  defaultValue:
+    WebKitLegacy:
+      default: false
+    WebKit:
+      default: false
+    WebCore:
+      default: false
+
 PrivateClickMeasurementDebugModeEnabled:
   type: bool
   humanReadableName: "Private Click Measurement Debug Mode"

Modified: trunk/Source/WebCore/ChangeLog (278476 => 278477)


--- trunk/Source/WebCore/ChangeLog	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/Source/WebCore/ChangeLog	2021-06-04 18:35:42 UTC (rev 278477)
@@ -1,3 +1,20 @@
+2021-06-04  Alex Christensen  <[email protected]>
+
+        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.
+
+        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:
+
 2021-06-04  Myles C. Maxfield  <[email protected]>
 
         Use references in font loading code instead of pointers which can never be null

Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.cpp (278476 => 278477)


--- trunk/Source/WebCore/page/PerformanceResourceTiming.cpp	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.cpp	2021-06-04 18:35:42 UTC (rev 278477)
@@ -256,4 +256,44 @@
     return networkLoadTimeToDOMHighResTimeStamp(m_timeOrigin, m_resourceTiming.resourceLoadTiming().endTime());
 }
 
+uint64_t PerformanceResourceTiming::transferSize() const
+{
+    if (!m_resourceTiming.allowTimingDetails()
+        || m_resourceTiming.networkLoadMetrics().hasCrossOriginRedirect)
+        return 0;
+
+    auto encodedBodySize = m_resourceTiming.networkLoadMetrics().responseBodyBytesReceived;
+    if (encodedBodySize == std::numeric_limits<uint64_t>::max())
+        return 0;
+
+    // https://w3c.github.io/resource-timing/#dom-performanceresourcetiming-transfersize
+    return encodedBodySize + 300;
+}
+
+uint64_t PerformanceResourceTiming::encodedBodySize() const
+{
+    if (!m_resourceTiming.allowTimingDetails()
+        || m_resourceTiming.networkLoadMetrics().hasCrossOriginRedirect)
+        return 0;
+
+    auto encodedBodySize = m_resourceTiming.networkLoadMetrics().responseBodyBytesReceived;
+    if (encodedBodySize == std::numeric_limits<uint64_t>::max())
+        return 0;
+
+    return encodedBodySize;
+}
+
+uint64_t PerformanceResourceTiming::decodedBodySize() const
+{
+    if (!m_resourceTiming.allowTimingDetails()
+        || m_resourceTiming.networkLoadMetrics().hasCrossOriginRedirect)
+        return 0;
+
+    auto decodedBodySize = m_resourceTiming.networkLoadMetrics().responseBodyDecodedSize;
+    if (decodedBodySize == std::numeric_limits<uint64_t>::max())
+        return 0;
+
+    return decodedBodySize;
+}
+
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.h (278476 => 278477)


--- trunk/Source/WebCore/page/PerformanceResourceTiming.h	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.h	2021-06-04 18:35:42 UTC (rev 278477)
@@ -61,6 +61,9 @@
     double requestStart() const;
     double responseStart() const;
     double responseEnd() const;
+    uint64_t transferSize() const;
+    uint64_t encodedBodySize() const;
+    uint64_t decodedBodySize() const;
 
     const Vector<Ref<PerformanceServerTiming>>& serverTiming() const { return m_serverTiming; }
 

Modified: trunk/Source/WebCore/page/PerformanceResourceTiming.idl (278476 => 278477)


--- trunk/Source/WebCore/page/PerformanceResourceTiming.idl	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/Source/WebCore/page/PerformanceResourceTiming.idl	2021-06-04 18:35:42 UTC (rev 278477)
@@ -50,10 +50,10 @@
     readonly attribute DOMHighResTimeStamp requestStart;
     readonly attribute DOMHighResTimeStamp responseStart;
     readonly attribute DOMHighResTimeStamp responseEnd;
+    [EnabledBySetting=PerformanceResourceTimingSensitiveProperties] readonly attribute unsigned long long transferSize;
+    [EnabledBySetting=PerformanceResourceTimingSensitiveProperties] readonly attribute unsigned long long encodedBodySize;
+    [EnabledBySetting=PerformanceResourceTimingSensitiveProperties] readonly attribute unsigned long long decodedBodySize;
 
-    // Note: transferSize, encodedBodySize, and decodedBodySize are intentionally omitted
-    // because of privacy concerns such as https://github.com/w3c/resource-timing/issues/238
-
     // https://www.w3.org/TR/server-timing/#extension-to-the-performanceresourcetiming-interface
     [EnabledAtRuntime=ServerTiming] readonly attribute FrozenArray<PerformanceServerTiming> serverTiming;
 

Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm (278476 => 278477)


--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm	2021-06-04 18:35:42 UTC (rev 278477)
@@ -324,17 +324,17 @@
 
     LOG(Network, "Handle %p delegate connectionDidFinishLoading:%p", m_handle, connection);
 
-    double responseEndTime = [[[connection _timingData] objectForKey:@"_kCFNTimingDataResponseEnd"] doubleValue];
-
-    auto work = [self = self, protectedSelf = retainPtr(self), connection = retainPtr(connection), responseEndTime] () mutable {
+    auto work = [self = self, protectedSelf = retainPtr(self), connection = retainPtr(connection), timingData = retainPtr([connection _timingData])] () mutable {
         if (!m_handle || !m_handle->client())
             return;
 
         if (auto metrics = m_handle->networkLoadMetrics()) {
-            if (responseEndTime)
+            if (double responseEndTime = [[timingData objectForKey:@"_kCFNTimingDataResponseEnd"] doubleValue])
                 metrics->responseEnd = WallTime::fromRawSeconds(adoptNS([[NSDate alloc] initWithTimeIntervalSinceReferenceDate:responseEndTime]).get().timeIntervalSince1970).approximateMonotonicTime();
             else
                 metrics->responseEnd = metrics->responseStart;
+            metrics->responseBodyBytesReceived = [[timingData objectForKey:@"_kCFNTimingDataResponseBodyBytesReceived"] unsignedLongLongValue];
+            metrics->responseBodyDecodedSize = [[timingData objectForKey:@"_kCFNTimingDataResponseBodyBytesDecoded"] unsignedLongLongValue];
             metrics->markComplete();
             m_handle->client()->didFinishLoading(m_handle, *metrics);
         } else {

Modified: trunk/Source/WebKit/ChangeLog (278476 => 278477)


--- trunk/Source/WebKit/ChangeLog	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/Source/WebKit/ChangeLog	2021-06-04 18:35:42 UTC (rev 278477)
@@ -1,5 +1,15 @@
 2021-06-04  Alex Christensen  <[email protected]>
 
+        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.
+
+        * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+        (-[WKNetworkSessionDelegate URLSession:task:didFinishCollectingMetrics:]):
+
+2021-06-04  Alex Christensen  <[email protected]>
+
         Make attributedBundleIdendifier a property for WKWebViewConfiguration instead of _WKWebsiteDataStoreConfiguration
         https://bugs.webkit.org/show_bug.cgi?id=226548
         <rdar://78737547>

Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm (278476 => 278477)


--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2021-06-04 18:14:46 UTC (rev 278476)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm	2021-06-04 18:35:42 UTC (rev 278477)
@@ -846,21 +846,15 @@
 
             uint64_t requestHeaderBytesSent = 0;
             uint64_t responseHeaderBytesReceived = 0;
-            uint64_t responseBodyBytesReceived = 0;
-            uint64_t responseBodyDecodedSize = 0;
 
             for (NSURLSessionTaskTransactionMetrics *transactionMetrics in metrics.transactionMetrics) {
 #if HAVE(CFNETWORK_METRICS_APIS_V4)
                 requestHeaderBytesSent += transactionMetrics.countOfRequestHeaderBytesSent;
                 responseHeaderBytesReceived += transactionMetrics.countOfResponseHeaderBytesReceived;
-                responseBodyBytesReceived += transactionMetrics.countOfResponseBodyBytesReceived;
-                responseBodyDecodedSize += transactionMetrics.countOfResponseBodyBytesAfterDecoding ? transactionMetrics.countOfResponseBodyBytesAfterDecoding : transactionMetrics.countOfResponseBodyBytesReceived;
 #else
                 ALLOW_DEPRECATED_DECLARATIONS_BEGIN
                 requestHeaderBytesSent += transactionMetrics._requestHeaderBytesSent;
                 responseHeaderBytesReceived += transactionMetrics._responseHeaderBytesReceived;
-                responseBodyBytesReceived += transactionMetrics._responseBodyBytesReceived;
-                responseBodyDecodedSize += transactionMetrics._responseBodyBytesDecoded ? transactionMetrics._responseBodyBytesDecoded : transactionMetrics._responseBodyBytesReceived;
                 ALLOW_DEPRECATED_DECLARATIONS_END
 #endif
             }
@@ -868,9 +862,20 @@
             networkLoadMetrics.requestHeaderBytesSent = requestHeaderBytesSent;
             networkLoadMetrics.requestBodyBytesSent = task.countOfBytesSent;
             networkLoadMetrics.responseHeaderBytesReceived = responseHeaderBytesReceived;
-            networkLoadMetrics.responseBodyBytesReceived = responseBodyBytesReceived;
-            networkLoadMetrics.responseBodyDecodedSize = responseBodyDecodedSize;
         }
+#if HAVE(CFNETWORK_METRICS_APIS_V4)
+        networkLoadMetrics.responseBodyBytesReceived = m.countOfResponseBodyBytesReceived;
+        networkLoadMetrics.responseBodyDecodedSize = m.countOfResponseBodyBytesAfterDecoding;
+#else
+        ALLOW_DEPRECATED_DECLARATIONS_BEGIN
+        networkLoadMetrics.responseBodyBytesReceived = m._responseBodyBytesReceived;
+        networkLoadMetrics.responseBodyDecodedSize = m._responseBodyBytesDecoded;
+        ALLOW_DEPRECATED_DECLARATIONS_END
+#endif
+        // Sometimes the encoded body bytes received contains a few (3 or so) bytes from the header when there is no body.
+        // When this happens, trim our metrics to make more sense.
+        if (!networkLoadMetrics.responseBodyDecodedSize)
+            networkLoadMetrics.responseBodyBytesReceived = 0;
     }
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to