mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-10 10:09:14 +00:00
LibWeb: Make reference to global in report timing steps non-const
Marking a resource timing entry requires calling non-const methods on the global object to append to the performance buffer.
This commit is contained in:
parent
67cfb64d07
commit
618697ef13
Notes:
github-actions[bot]
2025-03-06 16:02:11 +00:00
Author: https://github.com/Lubrsi
Commit: 618697ef13
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3704
Reviewed-by: https://github.com/ADKaster ✅
3 changed files with 6 additions and 6 deletions
|
@ -644,7 +644,7 @@ void fetch_response_handover(JS::Realm& realm, Infrastructure::FetchParams const
|
||||||
fetch_params.controller()->set_full_timing_info(fetch_params.timing_info());
|
fetch_params.controller()->set_full_timing_info(fetch_params.timing_info());
|
||||||
|
|
||||||
// 3. Set fetchParams’s controller’s report timing steps to the following steps given a global object global:
|
// 3. Set fetchParams’s controller’s report timing steps to the following steps given a global object global:
|
||||||
fetch_params.controller()->set_report_timing_steps([&vm, &response, &fetch_params, timing_info, unsafe_end_time](JS::Object const& global) mutable {
|
fetch_params.controller()->set_report_timing_steps([&vm, &response, &fetch_params, timing_info, unsafe_end_time](JS::Object& global) mutable {
|
||||||
// 1. If fetchParams’s request’s URL’s scheme is not an HTTP(S) scheme, then return.
|
// 1. If fetchParams’s request’s URL’s scheme is not an HTTP(S) scheme, then return.
|
||||||
if (!Infrastructure::is_http_or_https_scheme(fetch_params.request()->url().scheme()))
|
if (!Infrastructure::is_http_or_https_scheme(fetch_params.request()->url().scheme()))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -32,7 +32,7 @@ void FetchController::visit_edges(JS::Cell::Visitor& visitor)
|
||||||
visitor.visit(m_fetch_params);
|
visitor.visit(m_fetch_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FetchController::set_report_timing_steps(Function<void(JS::Object const&)> report_timing_steps)
|
void FetchController::set_report_timing_steps(Function<void(JS::Object&)> report_timing_steps)
|
||||||
{
|
{
|
||||||
m_report_timing_steps = GC::create_function(vm().heap(), move(report_timing_steps));
|
m_report_timing_steps = GC::create_function(vm().heap(), move(report_timing_steps));
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ void FetchController::set_next_manual_redirect_steps(Function<void()> next_manua
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#finalize-and-report-timing
|
// https://fetch.spec.whatwg.org/#finalize-and-report-timing
|
||||||
void FetchController::report_timing(JS::Object const& global) const
|
void FetchController::report_timing(JS::Object& global) const
|
||||||
{
|
{
|
||||||
// 1. Assert: this’s report timing steps is not null.
|
// 1. Assert: this’s report timing steps is not null.
|
||||||
VERIFY(m_report_timing_steps);
|
VERIFY(m_report_timing_steps);
|
||||||
|
|
|
@ -35,12 +35,12 @@ public:
|
||||||
[[nodiscard]] static GC::Ref<FetchController> create(JS::VM&);
|
[[nodiscard]] static GC::Ref<FetchController> create(JS::VM&);
|
||||||
|
|
||||||
void set_full_timing_info(GC::Ref<FetchTimingInfo> full_timing_info) { m_full_timing_info = full_timing_info; }
|
void set_full_timing_info(GC::Ref<FetchTimingInfo> full_timing_info) { m_full_timing_info = full_timing_info; }
|
||||||
void set_report_timing_steps(Function<void(JS::Object const&)> report_timing_steps);
|
void set_report_timing_steps(Function<void(JS::Object&)> report_timing_steps);
|
||||||
void set_next_manual_redirect_steps(Function<void()> next_manual_redirect_steps);
|
void set_next_manual_redirect_steps(Function<void()> next_manual_redirect_steps);
|
||||||
|
|
||||||
[[nodiscard]] State state() const { return m_state; }
|
[[nodiscard]] State state() const { return m_state; }
|
||||||
|
|
||||||
void report_timing(JS::Object const&) const;
|
void report_timing(JS::Object&) const;
|
||||||
void process_next_manual_redirect() const;
|
void process_next_manual_redirect() const;
|
||||||
[[nodiscard]] GC::Ref<FetchTimingInfo> extract_full_timing_info() const;
|
[[nodiscard]] GC::Ref<FetchTimingInfo> extract_full_timing_info() const;
|
||||||
void abort(JS::Realm&, Optional<JS::Value>);
|
void abort(JS::Realm&, Optional<JS::Value>);
|
||||||
|
@ -73,7 +73,7 @@ private:
|
||||||
// https://fetch.spec.whatwg.org/#fetch-controller-report-timing-steps
|
// https://fetch.spec.whatwg.org/#fetch-controller-report-timing-steps
|
||||||
// report timing steps (default null)
|
// report timing steps (default null)
|
||||||
// Null or an algorithm accepting a global object.
|
// Null or an algorithm accepting a global object.
|
||||||
GC::Ptr<GC::Function<void(JS::Object const&)>> m_report_timing_steps;
|
GC::Ptr<GC::Function<void(JS::Object&)>> m_report_timing_steps;
|
||||||
|
|
||||||
// https://fetch.spec.whatwg.org/#fetch-controller-report-timing-steps
|
// https://fetch.spec.whatwg.org/#fetch-controller-report-timing-steps
|
||||||
// serialized abort reason (default null)
|
// serialized abort reason (default null)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue