-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core(fr): colocate PerformanceObserver installation with wait logic #12365
Conversation
* property on window to the end time of the last long task. | ||
*/ | ||
function registerPerformanceObserverInPage() { | ||
// Do not re-register if we've already run this script. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is new
} | ||
}); | ||
|
||
observer.observe({entryTypes: ['longtask'], buffered: true}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as is the buffered flag which didn't exist when we originally wrote this when PerfObservers were brand new hotness :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems like a big fix?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really that big. we previously installed it before even the document is available and we always assume that a longtask just happened so the likelihood of this catching anything new is very small.
now that we're registering slightly later in the page's lifecycle it makes more semantic sense, but again because of our assumption a longtask just happened on installation it doesn't make much of a difference in practice
Co-authored-by: Connor Clark <cjamcl@google.com>
|
Summary
Minor refactor to reduce the amount of global setup necessary to use shared navigation logic between FR and legacy. This PR moves the PerformanceObserver installation to happen on-demand when needed instead of relying on gather-runner to install it globally on document creation. Fewer magic global window properties located in different files is a nice bonus too :)
Related Issues/PRs
ref #11313