Skip to content

Cross-origin timeline support #207

@clelland

Description

@clelland

#202 has been open for a while, but we should really have an issue for larger discussion :)

The overall plan is roughly as specified in Cross-frame Performance Timeline, which is:

  • An option to performance timeline APIs to request to include timeline events from child frames
  • An opt-in which can be used by those child frame to allow sharing of timeline events with ancestor frames
  • A source reference on timeline entries which points to the window of the frame where they originated

The current concrete proposal for each of these is:

  1. PerformanceObserverInit gains one new key: includeFrames. This is a boolean, defaulting to false, and can be used like this:
const observer = new PerformanceObserver(entryList => {/* callback */});
observer.observe({entryTypes: ["mark", "measure"],
                  includeFrames: true});
  1. We add a Document Policy configuration point, share-performance-timeline-with, which takes a list of origins (possibly *) with which the framed document consents to share its timeline entries. Examples of its usage would look like:
Document-Policy: share-performance-timeline-with=*
Document-Policy: share-performance-timeline-with="https://example.com"
Document-Policy: share-performance-timeline-with=("https://example.com/", "https://embedder.com")
  1. The source member of PerformanceEntry refers to the window of the frame in which the entry was generated.

It is an open question whether we want to, or can support this functionality on the synchronous timeline API methods getEntries, getEntriesByName and getEntriesByType. Because it requires cross-origin communication, this almost certainly would have to block while waiting for a response from child frames, possibly for a long time.

Those APIs may be useful, and are often easier to use than the PerformanceObserver API, but it may not be worth making them slower to support cross-origin frames. People who are writing new code to gather that data could just be encouraged to migrate to PerformanceObserver at the same time.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions