1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-09 09:34:57 +09:00

LibWeb: Report performance based timestamps relative to ESO time origin

This commit is contained in:
Tim Ledbetter 2025-01-07 10:08:14 +00:00 committed by Alexander Kalenik
parent 8963e62a5e
commit 7488136a51
Notes: github-actions[bot] 2025-01-27 13:54:36 +00:00
12 changed files with 248 additions and 28 deletions

View file

@ -24,9 +24,7 @@ GC_DEFINE_ALLOCATOR(Performance);
Performance::Performance(JS::Realm& realm)
: DOM::EventTarget(realm)
, m_timer(Core::TimerType::Precise)
{
m_timer.start();
}
Performance::~Performance() = default;
@ -68,8 +66,8 @@ GC::Ptr<NavigationTiming::PerformanceNavigation> Performance::navigation()
// https://w3c.github.io/hr-time/#timeorigin-attribute
double Performance::time_origin() const
{
// FIXME: The timeOrigin attribute MUST return the number of milliseconds in the duration returned by get time origin timestamp for the relevant global object of this.
return static_cast<double>(m_timer.origin_time().nanoseconds()) / 1e6;
// The timeOrigin attribute MUST return the number of milliseconds in the duration returned by get time origin timestamp for the relevant global object of this.
return get_time_origin_timestamp(HTML::relevant_principal_global_object(*this));
}
// https://w3c.github.io/hr-time/#now-method