RESOLVED WONTFIX Bug 218996
PerformanceResourceTiming: implement transferSize, encodedBodySize and decodedBodySize
https://bugs.webkit.org/show_bug.cgi?id=218996
Summary PerformanceResourceTiming: implement transferSize, encodedBodySize and decode...
Jakub G (dailymotion)
Reported 2020-11-16 12:05:55 PST
Safari is the last browser lacking some PerformanceResourceTiming fields: https://developer.mozilla.org/en-US/docs/web/api/performanceresourcetiming (see also the following bugs: 168543 198293 185870) 'transferSize' (and 'encodedBodySize') is interesting because for example it allows distinguishing page loads with full cache vs empty cache for performance monitoring: https://nicj.net/resourcetiming-in-practice/#cached-resources Based on Nic's blog, I've been using the following code in production to iterate over critical requests and check for cache status and calculate cache hit ratio (and then be able to split performance monitoring graphs based on that): ``` if (window.PerformanceResourceTiming && 'transferSize' in PerformanceResourceTiming.prototype) { function getCacheStatus(item) { if (item.transferSize === 0) { return 'hit' } else if ( item.transferSize > 0 && item.encodedBodySize > 0 && item.transferSize < item.encodedBodySize ) { return 'revalidation' } return 'miss' } performance.getEntriesByType('resource').filter(...).map(getCacheStatus).reduce(...) } ``` But since Safari does not support it, it's not possible to have this kind of visibility about cache hit ratios for Safari users, nor compare cold cache vs warm cache RUM data.
Attachments
Patch (32.19 KB, patch)
2021-04-09 04:07 PDT, Carlos Garcia Campos
achristensen: review-
ews-feeder: commit-queue-
Smoley
Comment 1 2020-11-16 18:46:24 PST
Thnanks for filing. Apple Internal see also: rdar://43514288
Carlos Garcia Campos
Comment 2 2021-04-09 04:00:16 PDT
*** Bug 198293 has been marked as a duplicate of this bug. ***
Carlos Garcia Campos
Comment 3 2021-04-09 04:07:16 PDT
Carlos Garcia Campos
Comment 4 2021-04-09 04:09:04 PDT
Comment on attachment 425606 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=425606&action=review > LayoutTests/imported/w3c/web-platform-tests/resource-timing/TAO-null-opaque-origin.sub-expected.txt:6 > -PASS Test null TAO value with opaque origins > +FAIL Test null TAO value with opaque origins assert_equals: expected "PASS" but got "FAIL" This might be revealing a previous existing bug. > LayoutTests/imported/w3c/web-platform-tests/resource-timing/test_resource_timing.https-expected.txt:29 > -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 I get the same failure in chrome and firefox.
Alex Christensen
Comment 5 2021-04-09 08:12:11 PDT
Comment on attachment 425606 [details] Patch This is currently intentionally not implemented because of privacy concerns such as https://github.com/w3c/resource-timing/issues/238
Carlos Garcia Campos
Comment 6 2021-04-09 09:30:29 PDT
I see, let's close this then.
Note You need to log in before you can comment on or make changes to this bug.