Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Navigation Preload can have negative times #139
As discussed in #88 (comment), Navigation Preload requests can (and likely to) start before the SW time origin. If they appear in the SW's timeline, they will have negative times.
We should either decide they do not appear in the SW's timeline and make that explicit, and somehow otherwise resolve this issue.
Chrome's implementation starts navigation preload just before trying to start the worker. The spec makes them parallel so I don't know if there's a guarantee:
Nav preload is at step 12.7 and the request starts in "run in parallel" substeps. Running the worker is at step 17.
I think the "official moment of creation" definition might be a bit vague here. Its included in step 1 that says:
"Create a separate parallel execution environment (i.e. a separate thread or process or equivalent construct), and run the rest of these steps in that context."
Creating that separate parallel execution environment takes time. Is the timeOrigin at the start or end of this step?
The goal of navigation preload is to start the fetching before the creation of the parallel execution environment. So if the timeOrigin is measured at the end of the step then navigation preload start time will be negative.
FWIW, I have always thought the timeOrigin was marked after the thread was created and the global created on that thread. So at the end of the step. I guess we just need to clarify.