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
Add steps to intercept requests using foreign fetch. #329
Conversation
|
Yeah, that check does exist on the service worker spec side as well, but I agree that it makes sense to have the check here as well. I also added the "is this a subresource" check here, to make it clearer which requests actually can be intercepted by foreign fetch.
Duplication is indeed unfortunate. Maybe one way to deal with this would be to move all the shared substeps to a separate step, so it roughly would be something like:
|
I think in the end we should only have it on one side. With regards to duplication, what you suggest seems reasonable. An alternative might be to group what you suggest under a common skip-service-worker flag check. Not entirely sure what works better. |
368e267
to
5f1f703
Compare
Okay, factored out the common post-processing and skip-service-worker flag logic (which has the side effect of also fixing that previously things like "set response's CSP list" were called even when response was null). |
<li> | ||
<p>If <var>response</var> is null, | ||
<var>request</var> is a <span>subresource request</span> and <var>request</var>'s | ||
<span title=concept-request-origin>origin</span> is not the same as <var>request</var>'s |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"same" needs to reference "same origin" defined in HTML.
I like it! |
If response is still null after a regular service worker has tried handling it this gives a foreign fetch handler a chance to handle the request.
5f1f703
to
0cd06c3
Compare
Addressed your comments. |
Landed as 8510b2f. Thanks for working on this! |
If response is still null after a regular service worker has tried handling it
this gives a foreign fetch handler a chance to handle the request.