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

Interactions with the Back-forward cache? #53

Open
ArthurSonzogni opened this issue Aug 9, 2021 · 2 comments
Open

Interactions with the Back-forward cache? #53

ArthurSonzogni opened this issue Aug 9, 2021 · 2 comments

Comments

@ArthurSonzogni
Copy link

You may want to reference this from the BFCache meta bug:
whatwg/html#5880
+CC @rakina

I was wondering what kind of interation this feature will have with the Back-forward cache.
For instance, what happens exactly in the following scenario:

  1. The document create a:
const profiler = new Profiler({
  sampleInterval: 10,      // Target sampling every 10ms
  maxBufferSize: 10 * 100, // Cap at ~10s worth of samples
});
  1. The user navigate the main frame elsewhere. The old document enters the BFCache.
  2. The user navigates back. The cached document is re-activated.
  3. The re-activitated document calls:
const trace = await profiler.stop();

What kind of data trace contains?

You may want to figure out what is the expected behavior and add some tests about this.

When the document enters the BFCache, it's task runners are frozen, so I guess the trace shouldn't include any samples from when it was cached?

@acomminos
Copy link
Collaborator

When the document enters the BFCache, it's task runners are frozen, so I guess the trace shouldn't include any samples from when it was cached?

Indeed, this is the behaviour recommended by the spec:

The user agent is RECOMMENDED to pause the sampling of a profiling session if the browsing context is not in the foreground.

Though, this is not required. The Blink implementation for example does not enter the paused state when this occurs, and instead records empty samples for the time that the context/realm is not current (as per the results of executing the take a sample algorithm on a foreign realm).

Perhaps we should consider requiring implementations to pause sampling in this case? I can't think of any cases where the empty sampling would be useful.

@rakina
Copy link
Member

rakina commented Apr 27, 2022

Perhaps we should consider requiring implementations to pause sampling in this case? I can't think of any cases where the empty sampling would be useful.

This sounds reasonable. @acomminos, do you think we can update the spec to listen to "fully active" status changes (guide)?

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

3 participants