Bug 226382 - Prefetching cross-origin subresources for the current page gives double fetch
Summary: Prefetching cross-origin subresources for the current page gives double fetch
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: Safari 14
Hardware: Mac (Intel) macOS 11
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on: 194539
Blocks:
  Show dependency treegraph
 
Reported: 2021-05-28 11:29 PDT by Jeff Kaufman
Modified: 2023-01-25 05:02 PST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jeff Kaufman 2021-05-28 11:29:02 PDT
When a page makes a cross-origin prefetch it's not used on that page.  To reproduce:

1. Turn on Develop > Experimental Features > LinkPrefetch (tested in Version 14.1)
2. Visit https://www.jefftk.com/test/prefetch/prefetch-nested
3. See that bg.css, log.js, and hello-world are immediately fetched
4. After waiting five seconds, see that they are fetched a second time (confirmed with server logs)

I tried adding "as=" attributes, without effect: https://www.jefftk.com/test/prefetch/prefetch-nested-as

It looks to me like the document is used for prefetching if I navigate to it instead of putting it in an iframe (https://www.jefftk.com/test/prefetch/prefetch-navigate).  This one does make some sense: if you prefetch a document you could plausibly either want to navigate the whole page to it, or navigate an iframe.  Chrome handles this the same way as Safari, while Firefox does the opposite; I've filed https://github.com/whatwg/html/issues/6723
Comment 1 Radar WebKit Bug Importer 2021-06-04 11:29:19 PDT
<rdar://problem/78878195>