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
Userland/Libraries/LibWeb/HTML/Parser

View file

@ -293,7 +293,7 @@ void HTMLParser::the_end(JS::NonnullGCPtr<DOM::Document> document, JS::GCPtr<HTM
// 6. 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, *document, [document = document] {
// 1. 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));
// 2. 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);
@ -301,7 +301,7 @@ void HTMLParser::the_end(JS::NonnullGCPtr<DOM::Document> document, JS::GCPtr<HTM
document->dispatch_event(content_loaded_event);
// 3. 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: 4. Enable the client message queue of the ServiceWorkerContainer object whose associated service worker client is the Document object's relevant settings object.
@ -331,7 +331,7 @@ void HTMLParser::the_end(JS::NonnullGCPtr<DOM::Document> document, JS::GCPtr<HTM
auto& window = verify_cast<Window>(relevant_global_object(*document));
// 4. 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);
// 5. 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()
@ -343,7 +343,7 @@ void HTMLParser::the_end(JS::NonnullGCPtr<DOM::Document> document, JS::GCPtr<HTM
// FIXME: 7. Set the Document object's navigation id to null.
// 8. Set the Document's load timing info's load event end time to the current high resolution time given window.
document->load_timing_info().load_event_end_time = HighResolutionTime::unsafe_shared_current_time();
document->load_timing_info().load_event_end_time = HighResolutionTime::current_high_resolution_time(window);
// 9. Assert: Document's page showing is false.
VERIFY(!document->page_showing());