-
Notifications
You must be signed in to change notification settings - Fork 30
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
workerStart should be clearly defined as applicable to the last SW #100
Comments
/cc @nhelfman |
Addressed in #131. Defined as the ServiceWorker startup time of the first request in the final same-origin redirect chain. Scenarios (a.com and b.com have SWs, c.com does not)
|
What does it mean to be "intercepted" by a SW? In the above case the timing details of the "internal" fetch (the one initiated by the SW) are totally opaque to the caller of the external fetch (the navigation). Think of the SW in this case as a transparent proxy server of sorts, it knows its own timing but "hides" them from the client. So any redirects that are a result of a The second interpretation is: "the service worker constructs a |
I think we typically refer to your first interpretation, but both seem valid.
At the same time, if we expose the workerStart time of an early redirect to the eventual document, which may be on a different origin, that could create a cross-origin leak. The final redirect is always same-origin with the document that would receive this info. In the case of NavigationTiming, the "navigation" is not a concept that gets any info, the committed document is. We need to keep that in mind. |
I don't think this is a problem.
|
I think we can have multiple cases: I think it's OK to expose the |
That redirect is completely hidden from the document. As far as the document knows, the document is in origin (A). Only the SW knows that something here is cross-origin at all. It's no different from the SW loading some cross-origin JSON and constructing the HTML for the navigation response by itself.
This is like the second scenario in my original comment - "the service worker constructs a Response object with a redirect status". |
Note that if the worker in origin (B) constructs a redirect response, there is no mechanism for worker (A) to forward it to the navigation. Worker (A), and any client of FETCH, only gets the response back after all the redirects are resolved (this is an important part of how FETCH works). |
The document in is origin B in that case, and is oblivious to the initial redirect from origin A (modulo referrers).
Maybe we're not talking about the same scenario. I'm thinking about A's SW, fetching example.html, which then gets redirected (by the server, and below the SW in the network stack) to B/example.html.
Yeah.
I'm not sure I understand the connection. |
That opaque response is what would be brought back to the navigation, at least according to the spec.
In the FETCH spec, |
That seems odd. So a cross-origin redirect that modifies the URL bar without a SW would now not do that once a SW is introduced? |
Yes, the SW fetch masks that redirect like a transparent proxy. The SW basically does the equivalent of CORS-fetching the HTML data and returns it to the browsing context as data stream (modified if it so chooses). |
OK, so the SW can override this by sending the internal fetch with redirect mode set to "manual", and forwarding the redirect to the caller. In this case, |
@yoavweiss I think this can be closed? |
Closing, feel free to reopen. |
Spinoff from w3c/resource-timing#118
Currently, in the case of multiple redirects, each with it's own SW, it's not clear which worker start time should be reflected in
workerStart
. We should clarify that it's either the last SW applicable, or the active SW of the final document. The latter seems to be a more consistent definition.The text was updated successfully, but these errors were encountered: