mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
LibWeb: Set navigation start time when creating a new Document
This currently uses a non spec-compliant property on the Response object, which represents the time that the Response was created. Setting this value allows `Performance.timeOrigin` to return a reasonable value.
This commit is contained in:
parent
ddea1c6248
commit
a8904451ff
Notes:
github-actions[bot]
2025-01-27 13:54:49 +00:00
Author: https://github.com/tcl3
Commit: a8904451ff
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3341
2 changed files with 8 additions and 2 deletions
|
@ -325,7 +325,11 @@ WebIDL::ExceptionOr<GC::Ref<Document>> Document::create_and_initialize(Type type
|
||||||
top_level_origin);
|
top_level_origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: 8. Let loadTimingInfo be a new document load timing info with its navigation start time set to navigationParams's response's timing info's start time.
|
// 8. Let loadTimingInfo be a new document load timing info with its navigation start time set to navigationParams's response's timing info's start time.
|
||||||
|
DOM::DocumentLoadTimingInfo load_timing_info;
|
||||||
|
// AD-HOC: The response object no longer has an associated timing info object. For now, we use response's non-standard response time property,
|
||||||
|
// which represents the time that the time that the response object was created.
|
||||||
|
load_timing_info.navigation_start_time = navigation_params.response->response_time().nanoseconds() / 1e6;
|
||||||
|
|
||||||
// 9. Let document be a new Document, with
|
// 9. Let document be a new Document, with
|
||||||
// type: type
|
// type: type
|
||||||
|
@ -336,7 +340,7 @@ WebIDL::ExceptionOr<GC::Ref<Document>> Document::create_and_initialize(Type type
|
||||||
// FIXME: permissions policy: permissionsPolicy
|
// FIXME: permissions policy: permissionsPolicy
|
||||||
// active sandboxing flag set: navigationParams's final sandboxing flag set
|
// active sandboxing flag set: navigationParams's final sandboxing flag set
|
||||||
// FIXME: opener policy: navigationParams's opener policy
|
// FIXME: opener policy: navigationParams's opener policy
|
||||||
// FIXME: load timing info: loadTimingInfo
|
// load timing info: loadTimingInfo
|
||||||
// FIXME: was created via cross-origin redirects: navigationParams's response's has cross-origin redirects
|
// FIXME: was created via cross-origin redirects: navigationParams's response's has cross-origin redirects
|
||||||
// during-loading navigation ID for WebDriver BiDi: navigationParams's id
|
// during-loading navigation ID for WebDriver BiDi: navigationParams's id
|
||||||
// URL: creationURL
|
// URL: creationURL
|
||||||
|
@ -351,6 +355,7 @@ WebIDL::ExceptionOr<GC::Ref<Document>> Document::create_and_initialize(Type type
|
||||||
document->m_policy_container = navigation_params.policy_container;
|
document->m_policy_container = navigation_params.policy_container;
|
||||||
document->m_active_sandboxing_flag_set = navigation_params.final_sandboxing_flag_set;
|
document->m_active_sandboxing_flag_set = navigation_params.final_sandboxing_flag_set;
|
||||||
document->m_navigation_id = navigation_params.id;
|
document->m_navigation_id = navigation_params.id;
|
||||||
|
document->set_load_timing_info(load_timing_info);
|
||||||
document->set_url(*creation_url);
|
document->set_url(*creation_url);
|
||||||
document->m_readiness = HTML::DocumentReadyState::Loading;
|
document->m_readiness = HTML::DocumentReadyState::Loading;
|
||||||
document->m_about_base_url = navigation_params.about_base_url;
|
document->m_about_base_url = navigation_params.about_base_url;
|
||||||
|
|
|
@ -125,6 +125,7 @@ public:
|
||||||
|
|
||||||
// Non-standard
|
// Non-standard
|
||||||
[[nodiscard]] Optional<StringView> network_error_message() const;
|
[[nodiscard]] Optional<StringView> network_error_message() const;
|
||||||
|
MonotonicTime response_time() const { return m_response_time; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit Response(GC::Ref<HeaderList>);
|
explicit Response(GC::Ref<HeaderList>);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue