mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-31 05:09:12 +00:00
LibWeb: Use DocumentLoadTimingInfo values in PerformanceTiming interface
This commit is contained in:
parent
f8b8c9c4a4
commit
e03fec2a15
Notes:
github-actions[bot]
2025-01-11 10:12:48 +00:00
Author: https://github.com/tcl3
Commit: e03fec2a15
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3156
7 changed files with 481 additions and 7 deletions
|
@ -24,4 +24,13 @@ void PerformanceTiming::initialize(JS::Realm& realm)
|
|||
WEB_SET_PROTOTYPE_FOR_INTERFACE(PerformanceTiming);
|
||||
}
|
||||
|
||||
DOM::DocumentLoadTimingInfo const& PerformanceTiming::document_load_timing_info() const
|
||||
{
|
||||
auto& global_object = HTML::relevant_global_object(*this);
|
||||
VERIFY(is<HTML::Window>(global_object));
|
||||
auto& window = static_cast<HTML::Window&>(global_object);
|
||||
auto document = window.document();
|
||||
return document->load_timing_info();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <andreas@ladybird.org>
|
||||
* Copyright (c) 2025, Tim Ledbetter <tim.ledbetter@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
@ -19,7 +20,7 @@ public:
|
|||
|
||||
~PerformanceTiming();
|
||||
|
||||
u64 navigation_start() { return 0; }
|
||||
u64 navigation_start() { return document_load_timing_info().navigation_start_time; }
|
||||
u64 unload_event_start() { return 0; }
|
||||
u64 unload_event_end() { return 0; }
|
||||
u64 redirect_start() { return 0; }
|
||||
|
@ -34,16 +35,18 @@ public:
|
|||
u64 response_start() { return 0; }
|
||||
u64 response_end() { return 0; }
|
||||
u64 dom_loading() { return 0; }
|
||||
u64 dom_interactive() { return 0; }
|
||||
u64 dom_content_loaded_event_start() { return 0; }
|
||||
u64 dom_content_loaded_event_end() { return 0; }
|
||||
u64 dom_complete() { return 0; }
|
||||
u64 load_event_start() { return 0; }
|
||||
u64 load_event_end() { return 0; }
|
||||
u64 dom_interactive() { return document_load_timing_info().dom_interactive_time; }
|
||||
u64 dom_content_loaded_event_start() { return document_load_timing_info().dom_content_loaded_event_start_time; }
|
||||
u64 dom_content_loaded_event_end() { return document_load_timing_info().dom_content_loaded_event_end_time; }
|
||||
u64 dom_complete() { return document_load_timing_info().dom_complete_time; }
|
||||
u64 load_event_start() { return document_load_timing_info().load_event_start_time; }
|
||||
u64 load_event_end() { return document_load_timing_info().load_event_end_time; }
|
||||
|
||||
private:
|
||||
explicit PerformanceTiming(JS::Realm&);
|
||||
|
||||
DOM::DocumentLoadTimingInfo const& document_load_timing_info() const;
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue