mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:38:12 +00:00
LibWeb: Heap-allocate returned Fetch::Infrastructure::{Request,Response}
A Request/Response instance should always be heap-allocated and have clear ownership, so let's also wrap it in a NonnullOwnPtr instead of putting them on the stack.
This commit is contained in:
parent
88ee15a497
commit
a602a4c780
4 changed files with 25 additions and 25 deletions
|
@ -158,14 +158,14 @@ ErrorOr<ByteBuffer> Request::byte_serialize_origin() const
|
|||
}
|
||||
|
||||
// https://fetch.spec.whatwg.org/#concept-request-clone
|
||||
Request Request::clone() const
|
||||
NonnullOwnPtr<Request> Request::clone() const
|
||||
{
|
||||
// To clone a request request, run these steps:
|
||||
|
||||
// 1. Let newRequest be a copy of request, except for its body.
|
||||
BodyType body;
|
||||
swap(body, const_cast<BodyType&>(m_body));
|
||||
auto new_request = *this;
|
||||
auto new_request = adopt_own(*new Infrastructure::Request(*this));
|
||||
swap(body, const_cast<BodyType&>(m_body));
|
||||
|
||||
// FIXME: 2. If request’s body is non-null, set newRequest’s body to the result of cloning request’s body.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue