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

Add support for accessing cross-frame entries. #202

Open
wants to merge 3 commits into
base: gh-pages
Choose a base branch
from

Conversation

clelland
Copy link
Contributor

@clelland clelland commented Sep 21, 2022

This adds a Document-Policy configuration point for documents, named "share-performance-timeline-with", which acceps a set of origins. If it is non-empty, then ancestor frames whose origins are contained in that set can access the timeline entries of the child frame, either through a PerformanceObserver, or by passing a boolean flag into the various getEntries methods.


Preview | Diff

This adds a Document-Policy configuration point for documents, named
"share-performance-timeline-with", which acceps a set of origins. If it
is non-empty, then ancestor frames whose origins are contained in that
set can access the timeline entries of the child frame, either through
a PerformanceObserver, or by passing a boolean flag into the various
getEntries methods.
@clelland
Copy link
Contributor Author

I think this is still missing a piece -- PerformanceObservers shouldn't always get events from child frames; that needs to be conditional on PerformanceObserverInit.includeFrames.

Additionally, the way this is written may cause the finite buffers to overflow quickly; I should find a way to avoid that

@yoavweiss
Copy link
Contributor

This seems generally reasonable. May be good to share this with the WG, and see what folks think of the general shape

@clelland
Copy link
Contributor Author

WG is generally supportive (discussed at the 2022-11-10 meeting)

One question was brought up about feature detection, and how developers could know whether cross-frame entries are supported at all, if we just use a boolean parameter on getEntries*.

After some consideration, I think that developers should be able to detect the presence of this feature by looking for the source property on the PerformanceEntry interface; something like

Object.getOwnPropertyNames(PerformanceEntry.prototype).indexOf('source') != -1

index.html Outdated Show resolved Hide resolved
Copy link
Contributor

@noamr noamr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's resolve the boolean trap... I think it's material.

@noamr
Copy link
Contributor

noamr commented Feb 28, 2023

Another thing I didn't see here or in the design document is reference to to timeOrigin. Entries from different frames are going to be of different time origins and thus out of sync. I guess we could have the time origin as a property in each cross-frame entry? Would that be ergonomic?

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

Successfully merging this pull request may close these issues.

3 participants