NEW 258196
Navigation Preload promise never resolves
https://bugs.webkit.org/show_bug.cgi?id=258196
Summary Navigation Preload promise never resolves
Youmna
Reported 2023-06-16 05:11:30 PDT
Created attachment 466717 [details] This is the code that reproduces the bug Overview: We noticed an unexpected behaviour of the NavigationPreload implementation that was recently added to Safari. The problem arises in case we do not return the preloaded response for the current navigation but store it for later use. It seems like the preload response unexpectedly stays indefinitely pending in case it was not already resolved at the time the navigation itself has finished. To illustrate the scenario we built a simple test page on which we provide two different test cases: The navigation is answered slowly with a generated HTML response. This will ensure the navigation preload request can be resolved before the navigation itself is finished. We save the preload response for later use and try to access it via a fetch message afterwards. After the fetch successfully resolves we change the page's background color to green. The navigation is answered immediately with a generated HTML response. This will be faster than the navigation preload request can be resolved. We again save the preload response for later use and try to access it via a fetch message afterwards. Since we also passed the preload response promise to event.waitUntil we would have expected this to work and subsequently the background color of the page should also turn green. This does however never happen. In the web inspector we can also see the request stays pending indefinitely. In both Chrome and Firefox (latest version) we are not encountering this problem. We did see this problem also for Firefox when the NavigationPreloadAPI was first introduced but it seems to be fixed since version 107 in case that helps to narrow down the issue. Steps to Reproduce: 1. Open https://sw-lifecycle-test.app.baqend.com/navigationPreloadBug/index.html 2. Reload the page to ensure the Service Worker is successfully installed 3. Click on Navigate with Preload already finished 4. Go back to the index.html 5. Click on Navigate with Preload still pending Actual Results: After step 3, A slow navigation should be initiated to ensure the Preload Response is resolved before the navigation finishes A page with the text „Generated navigation” and a green background should be displayed After step 5, The same generated page should be displayed almost instantly but the background never turns green Expected Results: Both pages’ backgrounds should turn green Build Date & Hardware: 2023-06-16 on Mac OS 13.3.1 Additional Builds and Platforms: This same problem used to occur on Firefox in versions prior to version 107 Additional Information: I have attached the code used to reproduce the bug.
Attachments
This is the code that reproduces the bug (4.06 KB, application/zip)
2023-06-16 05:11 PDT, Youmna
no flags
Radar WebKit Bug Importer
Comment 1 2023-06-23 05:12:15 PDT
Note You need to log in before you can comment on or make changes to this bug.