-
Notifications
You must be signed in to change notification settings - Fork 318
Installing a foreign SW as part of a subresource request #825
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think eventually we might want something like swOnly and/or skipForeignSW, but I think for an initial version of foreign fetch we don't need either of these flags. |
Yeah I definitely want to give more control to |
I don't think site B can ever rely on site A's service worker being present. Site A's storage could be revoked after site B thinks its gotten the SW installed. |
Sending a manual OPTIONS request (#880) and checking NavigatorOnLine you can know if a foreign service worker is registered so this could act as a shortcut for that in the offline scenario and you could compare response times for heuristically know if there is a service worker in the middle so I think those are shortcuts for already existent features and to have it is something desirable. |
Related to #1092 ? |
Closing due to removing foreign fetch. |
Site A has an endpoint that takes an image and compresses it. This could run in a SW and use foreign-fetch to make it available offline to others.
However, if site B tries to use this service, there's no way for it to ensure A's service worker is installed.
Ideally it'd fallback to A's server, but that won't work offline.
Site B, could poll site A, waiting for a serviceworker response rather than a server one (assuming they're different). They could do this hack either when the endpoint is needed, or as part of their install step.
This is fragile, as it assumes that the endpoint is going to try and install a SW using a link header, and that the SW install is going to succeed. Either that or the polling happens indefinitely.
Do we want a better solution here?
If this is client is controlled by a SW, send to SW. Fail if the SW does not provide a response.
Else, if there's a foreign fetch worker scoped to URL, send to that SW. Fail if the SW does not provide a response.
Else, make a head request to URL. If it provides a link header to install a SW in scope of URL, let that SW install and activate, then send the request to that SW. If no SW installs, fails to install, or does not provide a response, fail.
Do we want to allow something like this?
The text was updated successfully, but these errors were encountered: