LibWeb: Implement "current high resolution time" AO

This commit is contained in:
Shannon Booth 2024-04-11 22:06:19 +02:00 committed by Andreas Kling
commit 33bd6cfc2a
Notes: sideshowbarker 2024-07-17 22:09:47 +09:00
2 changed files with 9 additions and 0 deletions

View file

@ -27,6 +27,14 @@ DOMHighResTimeStamp coarsen_time(DOMHighResTimeStamp timestamp, bool cross_origi
return timestamp;
}
// https://w3c.github.io/hr-time/#dfn-current-high-resolution-time
DOMHighResTimeStamp current_high_resolution_time(JS::Object const& global)
{
// The current high resolution time given a global object current global must return the result
// of relative high resolution time given unsafe shared current time and current global.
return HighResolutionTime::relative_high_resolution_time(HighResolutionTime::unsafe_shared_current_time(), global);
}
// https://w3c.github.io/hr-time/#dfn-relative-high-resolution-time
DOMHighResTimeStamp relative_high_resolution_time(DOMHighResTimeStamp time, JS::Object const& global)
{

View file

@ -14,6 +14,7 @@ namespace Web::HighResolutionTime {
DOMHighResTimeStamp get_time_origin_timestamp(JS::Object const&);
DOMHighResTimeStamp coarsen_time(DOMHighResTimeStamp timestamp, bool cross_origin_isolated_capability = false);
DOMHighResTimeStamp current_high_resolution_time(JS::Object const&);
DOMHighResTimeStamp relative_high_resolution_time(DOMHighResTimeStamp, JS::Object const&);
DOMHighResTimeStamp relative_high_resolution_coarsen_time(DOMHighResTimeStamp, JS::Object const&);
DOMHighResTimeStamp coarsened_shared_current_time(bool cross_origin_isolated_capability = false);