NEW298443
Web Inspector: Safari Web Inspector reports incorrect (negative/huge) Time to First Byte for navigation requests served from Service Worker cache
https://bugs.webkit.org/show_bug.cgi?id=298443
Summary Web Inspector: Safari Web Inspector reports incorrect (negative/huge) Time to...
Greg Z
Reported 2025-09-05 07:34:07 PDT
Created attachment 476650 [details] html test Summary Safari Web Inspector reports extremely large or negative “Time to First Byte” (TTFB) values for navigation requests served from the Service Worker cache. In reality, the TTFB should be ~0 ms because the page is delivered immediately from the local cache. This appears to be a UI/accounting bug specific to Web Inspector; performance.getEntriesByType('navigation') reports correct values. Steps to Reproduce 1. Save the two attached files (index.html and sw.js) to the same folder. 2. Serve them locally over HTTP(S) with any static server. 3. Open index.html in Safari on iOS 18.6.2 (latest at time of filing). 4. The Service Worker will install on first load. Reload once so the navigation is served from the Service Worker cache. 5. Open Web Inspector → Network → (document) → Timing. 6. Observe that the Time to First Byte for the navigation request is displayed as a very large or negative number. 7. Compare with the in-page Navigation Timing table/console output (from performance.getEntriesByType('navigation')), which shows TTFB ≈ 0 ms, workerStart > 0, and transferSize === 0. Expected Result TTFB in Web Inspector should be ~0 ms when the navigation request is fulfilled from the Service Worker cache. Actual Result Web Inspector reports an incorrect TTFB (e.g., hundreds of millions of ms or a negative value). Attachments index.html and sw.js minimal repro. Screenshot of Web Inspector showing the incorrect TTFB. Console output from the in-page script showing the correct Navigation Timing values.
Attachments
html test (3.87 KB, text/html)
2025-09-05 07:34 PDT, Greg Z
no flags
service worker test (1.44 KB, text/javascript)
2025-09-05 07:34 PDT, Greg Z
no flags
console output with correct data from performance.getEntriesByType (313.97 KB, image/png)
2025-09-05 07:35 PDT, Greg Z
no flags
incorrect time reported in UI (49.93 KB, image/png)
2025-09-05 07:35 PDT, Greg Z
no flags
Greg Z
Comment 1 2025-09-05 07:34:31 PDT
Created attachment 476651 [details] service worker test
Greg Z
Comment 2 2025-09-05 07:35:25 PDT
Created attachment 476652 [details] console output with correct data from performance.getEntriesByType
Greg Z
Comment 3 2025-09-05 07:35:45 PDT
Created attachment 476653 [details] incorrect time reported in UI
Radar WebKit Bug Importer
Comment 4 2025-09-12 07:35:13 PDT
Note You need to log in before you can comment on or make changes to this bug.