LibWeb: Use "current high resolution time" AO where relevant

And updating some spec comments to latest spec where it is not relevant.
This commit is contained in:
Shannon Booth 2024-04-11 22:42:35 +02:00 committed by Andreas Kling
parent 33bd6cfc2a
commit 51a52a867c
Notes: sideshowbarker 2024-07-16 23:59:28 +09:00
6 changed files with 13 additions and 17 deletions

View file

@ -201,7 +201,7 @@ void XMLDocumentBuilder::document_end()
// Queue a global task on the DOM manipulation task source given the Document's relevant global object to run the following substeps:
queue_global_task(HTML::Task::Source::DOMManipulation, m_document, [document = m_document] {
// Set the Document's load timing info's DOM content loaded event start time to the current high resolution time given the Document's relevant global object.
document->load_timing_info().dom_content_loaded_event_start_time = HighResolutionTime::unsafe_shared_current_time();
document->load_timing_info().dom_content_loaded_event_start_time = HighResolutionTime::current_high_resolution_time(relevant_global_object(*document));
// Fire an event named DOMContentLoaded at the Document object, with its bubbles attribute initialized to true.
auto content_loaded_event = DOM::Event::create(document->realm(), HTML::EventNames::DOMContentLoaded);
@ -209,7 +209,7 @@ void XMLDocumentBuilder::document_end()
document->dispatch_event(content_loaded_event);
// Set the Document's load timing info's DOM content loaded event end time to the current high resolution time given the Document's relevant global object.
document->load_timing_info().dom_content_loaded_event_end_time = HighResolutionTime::unsafe_shared_current_time();
document->load_timing_info().dom_content_loaded_event_end_time = HighResolutionTime::current_high_resolution_time(relevant_global_object(*document));
// FIXME: Enable the client message queue of the ServiceWorkerContainer object whose associated service worker client is the Document object's relevant settings object.
@ -239,7 +239,7 @@ void XMLDocumentBuilder::document_end()
JS::NonnullGCPtr<HTML::Window> window = verify_cast<HTML::Window>(relevant_global_object(*document));
// Set the Document's load timing info's load event start time to the current high resolution time given window.
document->load_timing_info().load_event_start_time = HighResolutionTime::unsafe_shared_current_time();
document->load_timing_info().load_event_start_time = HighResolutionTime::current_high_resolution_time(window);
// Fire an event named load at window, with legacy target override flag set.
// FIXME: The legacy target override flag is currently set by a virtual override of dispatch_event()
@ -251,7 +251,7 @@ void XMLDocumentBuilder::document_end()
// FIXME: Set the Document object's navigation id to null.
// Set the Document's load timing info's load event end time to the current high resolution time given window.
document->load_timing_info().dom_content_loaded_event_end_time = HighResolutionTime::unsafe_shared_current_time();
document->load_timing_info().dom_content_loaded_event_end_time = HighResolutionTime::current_high_resolution_time(window);
// Assert: Document's page showing is false.
VERIFY(!document->page_showing());