1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

LibWeb: Make Fetch::Infrastructure::Body be GC allocated

Making the body GC-allocated allows us to avoid using `JS::Handle`
for `m_stream` in its members.
This commit is contained in:
Aliaksandr Kalenik 2023-08-18 19:38:13 +02:00 committed by Andreas Kling
parent 953c19bdb7
commit bdd3a16b16
21 changed files with 117 additions and 91 deletions

View file

@ -23,6 +23,9 @@ void Request::visit_edges(JS::Cell::Visitor& visitor)
Base::visit_edges(visitor);
visitor.visit(m_header_list);
visitor.visit(m_client);
m_body.visit(
[&](JS::GCPtr<Body>& body) { visitor.visit(body); },
[](auto&) {});
m_reserved_client.visit(
[&](JS::GCPtr<HTML::EnvironmentSettingsObject> const& value) { visitor.visit(value); },
[](auto const&) {});
@ -249,8 +252,8 @@ JS::NonnullGCPtr<Request> Request::clone(JS::Realm& realm) const
new_request->set_timing_allow_failed(m_timing_allow_failed);
// 2. If requests body is non-null, set newRequests body to the result of cloning requests body.
if (auto const* body = m_body.get_pointer<Body>())
new_request->set_body(body->clone(realm));
if (auto const* body = m_body.get_pointer<JS::NonnullGCPtr<Body>>())
new_request->set_body((*body)->clone(realm));
// 3. Return newRequest.
return new_request;