-
Notifications
You must be signed in to change notification settings - Fork 1
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
RFC: Custom Fetch Handler #2
base: main
Are you sure you want to change the base?
Conversation
Considering: should it handle |
https://stackoverflow.com/a/64359741/5734400 It seems handling AbortSignal in the Service Worker is still UB... :/ Since |
Having support for It may not be that difficult, see https://github.com/kitsonk/xhr for example. However, the |
78810f2
to
a29b2c6
Compare
Co-authored-by: Jaeho Lee <[email protected]>
a29b2c6
to
67e43d0
Compare
GPT-4 response:
|
Prompt: For your point 1, I should say the FetchObject is designed to be "subset" of the ServiceWorkerGlobalScope, and no need to support full interface of it. I think it's enough to get interop with existing fetch handlers for service workers. Is that makes sense? GPT-4 response:
|
Prompt: for your point 2, indeed it can be tricky at some points, but we don't have to implement its full behavior because custom fetch handler is bit more like proxy to original stub. If there still are any difficult or complex points to be expected, please let me know. GPT-4 response:
|
Prompt: About to CORS you mentioned, this is intentionally designed to work in a cross-origin context, so the user can use it to override the relevant policy if desired. At least the custom fetch handler is treated as a "trusted code" by the first party. GPT-4 response:
|
Prompt: In other words, a custom fetch handler can never be implemented in a way that overrides the default security policy, as it is still on top of the same browser environment. One of the possible scenarios is using a controlled MessagePort to communicate with another thread, which is not a security policy violation. GPT-4 response:
|
EventSource which make a HTTP request for SSE(Server-Sent Events) should also be intercepted by the service worker |
Preview