Bug 238564

Summary: Service-Worker-Navigation-Preload header not being sent when Navigation Preload is enabled.
Product: WebKit Reporter: Jeremy Wagner <jlwagner>
Component: Service WorkersAssignee: youenn fablet <youennf>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, simon.fraser, webkit-bug-importer, webkit, youennf
Priority: P2 Keywords: InRadar
Version: Safari 15   
Hardware: Mac (Intel)   
OS: macOS 12   
Attachments:
Description Flags
Patch none

Jeremy Wagner
Reported 2022-03-30 11:53:00 PDT
Overview: I'm currently working on a Workbox-powered service worker for my personal website that uses streams to precache header and footer markup and combine those precached bits of markup with content partials provided by a PHP back end for faster loading performance. I'm using Navigation Preload in this mix, and have noted that the Service-Worker-Navigation-Preload header (https://developer.mozilla.org/docs/Web/HTTP/Headers/Service-Worker-Navigation-Preload) is not being sent. This header is important for application back ends because, at least in the context of streaming partial responses, it's important to have a signal from the client that lets us know if we need to send partial content. This is where the Service-Worker-Navigation-Preload test header comes in, and it appears that Safari 15.4 (and release 142 of Safari Technical Preview) are not sending this header when Navigation Preload is enabled. Steps to reproduce: 1. Open Safari 15.4 2. Go to Developer > Experimental Features and ensure "Service Worker Navigation Preload" is enabled. 2a. If "Service Worker Navigation Preload" is not enabled, enable it and then restart Safari. 3. Navigate to https://jlwagner.net/ 4. Click on the "contact" link to go to a page where the service worker will control it. There should be two instances of the site header and footer. 5. Navigate to https://jlwagner.net/request-headers.php to view response headers. 6. There should be a list item consisting of "HTTP_SERVICE_WORKER_NAVIGATION_PRELOAD: true", but it will not appear as the header is not being sent. 7. Open a recent version of Chrome, and repeat steps 1-4. Note that there is only one header and one footer. 8. Navigate to https://jlwagner.net/request-headers.php to view response headers. 9. Note that a list item consisting of "HTTP_SERVICE_WORKER_NAVIGATION_PRELOAD: true" is present. Expected results: The Service-Worker-Navigation-Preload header is not being sent when Navigation Preload is enabled. Actual results: The Service-Worker-Navigation-Preload header should be sent when Navigation Preload is enabled. Build Date & Hardware: Safari Version 15.4 (17613.1.17.1.6) on macOS 12.3 (Intel) Additional information: Web Platform Test for the header shows a failure for Safari Technical Preview: https://wpt.fyi/results/service-workers/service-worker/navigation-preload/request-headers.https.html?label=experimental&label=master&aligned
Attachments
Patch (7.51 KB, patch)
2022-04-04 03:52 PDT, youenn fablet
no flags
youenn fablet
Comment 1 2022-04-04 03:52:06 PDT
youenn fablet
Comment 2 2022-04-04 09:45:30 PDT
Comment on attachment 456555 [details] Patch iOS w2 failure is unrelated
EWS
Comment 3 2022-04-04 10:33:05 PDT
Committed r292296 (249194@main): <https://commits.webkit.org/249194@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 456555 [details].
Radar WebKit Bug Importer
Comment 4 2022-04-04 10:34:26 PDT
Note You need to log in before you can comment on or make changes to this bug.