Skip to content
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

Navigation Timing should be exposed in the Worker context #81

Closed
yoavweiss opened this issue Dec 18, 2017 · 1 comment
Closed

Navigation Timing should be exposed in the Worker context #81

yoavweiss opened this issue Dec 18, 2017 · 1 comment

Comments

@yoavweiss
Copy link
Contributor

It can be useful to have Navigation Timing data in the Worker context. One example is to create heuristics based on DNS time and HTML download time when more accurate browser heuristics are not available the the netinfo API.

Right now this can be done by PostMessaging this information from the Document, but it would have been easier if it was exposed directly in Worker.

@igrigorik
Copy link
Member

Workers and pages have independent lifecycles, time origins, and timelines. E.g. a single worker can be servicing multiple documents, each of which will have a different time origin from the worker. Which is to say, there is no clean or simple mapping of NT entries to workers.

As you already noted, it is possible to achieve what you're looking for: the document needs to postMessage the entries and timestamps to the Worker, alongside the time origin timestamp we introduced in HR-Time L2 to address this very case. On that note, when iterating on the time origin timestamp design we considered various solutions (including mapping entries to Worker) and landed on current design due to the complexities outlined above.

Closing as wontfix: the guidance here is to use postMessage with performance.timeOrigin to translate between time origins. Please feel free to reopen if you disagree. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants