Dynamically created <link rel="prefetch"> causes normal cache revalidation for subsequent real request
Categories
(Core :: Networking: Cache, task, P3)
Tracking
()
People
(Reporter: fragster, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: [necko-triaged])
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0
Steps to reproduce:
Create webpack project with code splitting with prefetch/preload (see https://webpack.js.org/guides/code-splitting/#prefetchingpreloading-modules) for better performance.
It creates <link rel="prefetch" as="script" href="chunkname.js"> nodes using javascript
Actual results:
Firefox load chunks only on request, causing degradation of user experience compared to webkit based browsers
Expected results:
Preload chunks when page is idle state, like webkit based browsers
Comment 1•4 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::DOM: Core & HTML' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.
(In reply to Henri Sivonen (:hsivonen) from comment #2)
Do you have a minimized test case on the Web?
http://fragster.ru/ff/
src: https://github.com/FragsterAt/firefox_bug_1691670
Comment 4•4 years ago
|
||
Thanks. I see the preload with "Initiator" as "other" in the Network panel of dev tools in Nightly on Linux.
(In reply to Henri Sivonen (:hsivonen) from comment #4)
Thanks. I see the preload with "Initiator" as "other" in the Network panel of dev tools in Nightly on Linux.
hmmmmmm
After googling I opened the about:config and found that network.prefetch-next was disabled. But I'm sure, that I didn't disable it (I didn't open about:config at all).
After enabling it, all works as expected.
Can it be turned off in another place?
In any case, when you click on the button, a request is made to the server, status 304 is returned. This can cause high delays on slow connections.
Headers in ff (after click): https://i.imgur.com/jF1ov4s.png
Timing: https://i.imgur.com/okHoWPs.png
In webkit browsers, the real request is not made, the status is displayed as "200 (from prefetch cache)".
Headers in chrome (after click): https://i.imgur.com/5mYawK0.png
Timing: https://i.imgur.com/1JUYAiL.png
Updated•4 years ago
|
Comment 7•4 years ago
|
||
(In reply to fragster from comment #5)
After googling I opened the about:config and found that network.prefetch-next was disabled. But I'm sure, that I didn't disable it (I didn't open about:config at all).
After enabling it, all works as expected.
Can it be turned off in another place?
These preferences can be tweaked by extensions:
I believe uBlock uses this API, but maybe some other extension does too?
Comment 8•4 years ago
|
||
This is a bigger project. We need to refactor prefetch code.
Updated•3 years ago
|
Description
•