Enable NavigationPreload on Nightly
Categories
(Core :: DOM: Service Workers, task, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox99 | --- | fixed |
People
(Reporter: edenchuang, Assigned: edenchuang)
References
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
NavigationPreload API currently is disable by prefs dom.serviceWorker.navgationPreload.enabled.
This bug makes NavigationPreload be enabled on Nightly.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 1•2 years ago
|
||
Pushed by echuang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/57b7b4ac1ef3 Enable NavigationPreload API on Nightly. r=dom-worker-reviewers,smaug
Comment 3•2 years ago
|
||
Backed out for failures on test_interfaces_secureContext.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/3b262a9ac810d98cf4d1ed28f250651e09767ffc
Log link: https://treeherder.mozilla.org/logviewer?job_id=365071660&repo=autoland&lineNumber=2791
Comment 4•2 years ago
•
|
||
Pushed by echuang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c07607b89a61 Enable NavigationPreload API on Nightly. r=dom-worker-reviewers,smaug
Comment 6•2 years ago
|
||
Backed out for causing build bustages on Logging.h
Backout link : https://hg.mozilla.org/integration/autoland/rev/7dbedaab687b42d8a6ba8813ae486a744af0835b
Link to failure log : https://treeherder.mozilla.org/logviewer?job_id=367078071&repo=autoland&lineNumber=9374
Assignee | ||
Updated•2 years ago
|
Pushed by echuang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/9771e7cbe148 Enable NavigationPreload API on Nightly. r=dom-worker-reviewers,smaug
Comment 8•2 years ago
|
||
Backed out 3 changesets (Bug 1750515, Bug 1753025) for causing wpt failures on idlharness.https.any.<...>.
Backout link
Push with failures
Failure Log
Assignee | ||
Updated•2 years ago
|
Pushed by echuang@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/33e221758c25 Enable NavigationPreload API on Nightly. r=dom-worker-reviewers,smaug
Comment 10•2 years ago
|
||
bugherder |
Comment 11•2 years ago
|
||
FF99 docs work for this can be tracked in https://github.com/mdn/content/issues/13367#issuecomment-1061265650
The Service-Worker-Navigation-Preload
HTTP header is sent with the preloading resource request, with a value of true
by default, which can be set to any value with setHeader().
The value may be used by a server to configure its response in a different way than the normal fetch response. In https://developers.google.com/web/updates/2017/02/navigation-preload there is an example that suggests a special value might be set to tell the server that you want to just be sent back part of the file, or a JSON representation rather than the original, or whatever.
When would you need to set multiple different behaviors on preload? Is this so a server can somehow have requests for the resource from different managers and send them different resources?
Assignee | ||
Comment 12•2 years ago
|
||
Hello Hamish
(In reply to Hamish Willee from comment #11)
FF99 docs work for this can be tracked in https://github.com/mdn/content/issues/13367#issuecomment-1061265650
Thank you for document this.
The
Service-Worker-Navigation-Preload
HTTP header is sent with the preloading resource request, with a value oftrue
by default, which can be set to any value with setHeader().
The value may be used by a server to configure its response in a different way than the normal fetch response. In https://developers.google.com/web/updates/2017/02/navigation-preload there is an example that suggests a special value might be set to tell the server that you want to just be sent back part of the file, or a JSON representation rather than the original, or whatever.When would you need to set multiple different behaviors on preload? Is this so a server can somehow have requests for the resource from different managers and send them different resources?
In fact, we don't know how the header value will be used by the server.
ServiceWorkerNavigationPreload is a feature that speeds up the response time of ServiceWorker.
Launching a ServiceWorker could be a time-consuming task. The idea of ServiceWorkerNavigationPreload is to fetch the navigation resource through the network when launching the ServiceWorker. The fetch response would be sent to the ServiceWorker by FetchEvent.preloadResponse.
Once ServiceWorker is ready, it can directly call FetchEvent.respondWith() the preload response. Such that the ServiceWorker doesn't need call fetch () in its FetchEvent handler.
Of course, in some cases, the preloaded response can be handled/combined/modified/synthesized by ServiceWorker's FetchEvent handler. It means ServiceWorker might just need some small and meaningful data from the network. In this situation, the different values of the header could be used to identify what is really needed by the server, instead of sending the whole page.
I hope this answers your question.
Comment 13•2 years ago
|
||
Thanks Evan, it almost answers my question.
I understand that the header value is a "hint" to the server that this is a preload request. The server can then choose to send back the same resource as for a normal fetch() or something else - e.g. a part of a page. What is sent back will be something that the web page/service worker and the server need to agree.
By default true
is sent in that header, but just the fact you're getting the header at all tells you that it is a preload request, so you could in theory configure one different type of response on getting the header.
But you can change the header value from true
to to send_me_something_else
or someting_completely_different
or whatever
. This means that you can tell the server that you want many different types of responses for each of these.
So my questions are:
- When/why would you want to support multiple formats being sent back? I can see the value in partial page vs whole page, but what's the scenario for partial page vs whole page vs ? that you need to be able to change the header for?
- If you do need to do this, when do you do it? Say you want to configure which header is sent for different files in different folders - by the time the service worker gets loaded so you might change the header value the resource will already have preloaded - right? So I'm confused about when it would make sense to have more than just
true
returned.
Sorry if this is a dumb question!
Updated•2 years ago
|
Assignee | ||
Comment 14•2 years ago
•
|
||
(In reply to Hamish Willee from comment #13)
Thanks Evan, it almost answers my question.
I understand that the header value is a "hint" to the server that this is a preload request. The server can then choose to send back the same resource as for a normal fetch() or something else - e.g. a part of a page. What is sent back will be something that the web page/service worker and the server need to agree.
By default
true
is sent in that header, but just the fact you're getting the header at all tells you that it is a preload request, so you could in theory configure one different type of response on getting the header.But you can change the header value from
true
to tosend_me_something_else
orsometing_completely_different
orwhatever
. This means that you can tell the server that you want many different types of responses for each of these.So my questions are:
- When/why would you want to support multiple formats being sent back? I can see the value in partial page vs whole page, but what's the scenario for partial page vs whole page vs ? that you need to be able to change the header for?
This preload only can be used in ServiceWorker.
In fact, I always assume that ServiceWorkerNavigationPreload always gets partial content from Server.
Since ServiceWorker can save some template content in storages.
But the preload partial content can be different by the conditions.
Considering a page, could be in an iframe, that intercepted by a ServiceWorker can be shown to guest users, login users, premium users.
The page content depends on what kind of account be login in.
ServiceWorker saves some template content for all kinds of users in the cache. And ServiceWorker needs some specific user information saved in the server to synthesize the page.
According to what kind of account be login in, the header can be set with different data to get different information for page synthesizing.
This might not be a good case since it could be achieved through cookies. However, sometimes using cookies might not be a good option.
- If you do need to do this, when do you do it? Say you want to configure which header is sent for different files in different folders - by the time the service worker gets loaded so you might change the header value the resource will already have preloaded - right? So I'm confused about when it would make sense to have more than just
true
returned.
About when to set up the header value, I think I have no answer for it. It depends on what the page would provide.
But for the mentioned case, the header value could be set while the login/logout/session expired by ServiceWorkerRegistration.NavigationPreloadManager.setHeaderValue().
Sorry if this is a dumb question!
Comment 16•2 years ago
|
||
FYI, docs work pretty much complete. Just going through the last stages of review. As in a previous post, you can track this https://github.com/mdn/content/issues/13367
Thanks for all the help Evan.
Description
•